How to use the Excel AGGREGATE Function (Step-by-Step Guide)
Excel AGGREGATE Function: Quick Steps
- Enter the Data
- Enter the Aggregate Formula
- Press Enter
Have you ever spent hours cleaning up errors in your Excel data or struggling to calculate values in a filtered list? The AGGREGATE function in Excel is here to rescue you from those headaches. Unlike basic functions, AGGREGATE Excel lets you perform calculations while automatically ignoring errors, hidden rows, or other messy data issues—saving you time and frustration.
In this guide, you’ll learn how to use the AGGREGATE function in Microsoft Excel with real-world examples. We’ll cover how to sum data while ignoring errors, find the maximum value in a filtered list, and count non-empty cells without manual cleanup. Whether you’re analyzing large datasets or working with dynamic reports, mastering AGGREGATE Excel will make your workflow smoother and more efficient.

Table of Content
What is the AGGREGATE Function in Excel
The AGGREGATE function performs calculations while allowing you to control how Excel handles hidden rows, errors, and other data anomalies. It can execute up to 19 different functions such as SUM, AVERAGE, MIN, and more. This function is especially useful when working with filtered datasets or when errors are present, as it can exclude these elements from the calculations.
AGGREGATE Function Syntax and Parameters
The general syntax of the AGGREGATE function is as follows:
=AGGREGATE(function_num, options, ref1, [ref2], …)
Parameters:
- function_num: A number between 1 and 19, representing the type of calculation to perform (e.g., 1 for AVERAGE, 9 for SUM).
- options: A number that specifies how to handle hidden rows, errors, or filtered-out data.
- ref1, [ref2]: One or more ranges or arrays on which the function will be applied.
List of Functions (function_num)
This table lists the types of calculations you can perform using the AGGREGATE function in Excel. Each function is identified by a unique function number, allowing you to specify the desired operation in your formula.
Function Number | Function | Reference (if applicable) |
---|---|---|
1 | AVERAGE | |
2 | COUNT | |
3 | COUNTA | |
4 | MAX | |
5 | MIN | |
6 | PRODUCT | |
7 | STDEV.S | |
8 | STDEV.P | |
9 | SUM | |
10 | VAR.S | |
11 | VAR.P | |
12 | MEDIAN | |
13 | MODE.SNGL | |
14 | LARGE | k |
15 | SMALL | k |
16 | PERCENTILE.INC | k |
17 | QUARTILE.INC | quart |
18 | PERCENTILE.EXC | k |
19 | QUARTILE.EXC | quart |
Behavior Options and Their Uses
The AGGREGATE function lets you choose options to ignore errors, hidden rows, and other functions. You can set these options using the options argument, with values ranging from 0 to 7 as shown in the table below.
Option | Behavior |
---|---|
0 | Ignore SUBTOTAL and AGGREGATE functions |
1 | Ignore hidden rows, SUBTOTAL, and AGGREGATE functions |
2 | Ignore error values, SUBTOTAL, and AGGREGATE functions |
3 | Ignore hidden rows, error values, SUBTOTAL, and AGGREGATE functions |
4 | Ignore nothing |
5 | Ignore hidden rows |
6 | Ignore error values |
7 | Ignore hidden rows and error values |
Note: The AGGREGATE function was introduced in Excel 2010. If you are using a version older than 2010, the function will not be available
How To Use the Aggregate Function in Microsoft Excel
The AGGREGATE function Excel is a versatile tool that performs calculations like SUM, AVERAGE, or COUNT while ignoring errors, hidden rows, or filtered data. Below are practical examples to demonstrate how to effectively use the AGGREGATE function for accurate data analysis.

Example 1: Sum Data While Ignoring Errors
Sum all sales values in Sales Q4 (E2:E6 ) while ignoring errors like #DIV/0!
and #VALUE!
.
Step 1: Select a Blank Cell
Click on an empty cell where you want the sum result to appear (e.g., G2
).
Step 2: Enter the Aggregate Formula and Press Enter
Type the following formula:
=AGGREGATE(9, 6, E2:E6)
- 9: Specifies the SUM function.
- 6: Ignores errors.
- E2:E6: The range to sum.
Step 3: Preview the Results
Press Enter and Preview Results. The Result is 1340.

Example 2: Finding the Maximum Value in a Filtered List
We want to find the maximum value in Sales Q3 (D2:D6) after applying a filter. The function should only consider visible rows and ignore hidden rows.
Step 1: Apply a Filter
Apply a filter to the dataset to hide certain rows.

Step 2: Select a Blank Cell
Click on an empty cell where you want the maximum value to appear (e.g., G2).
Step 3: Enter the Aggregate Formula and Press Enter
Type the following formula:
=AGGREGATE(4, 5, D2:D6)
- 4: Specifies the MAX function.
- 5: Ignores hidden (filtered) rows.
- D2:D6: The range to evaluate.
Press Enter to calculate the maximum value from visible rows.
Step 4: Preview Result
Press Enter and Preview the Result. The maximum value (e.g., 420
if all rows are visible).

Example 3: Count Non-Empty Cells While Ignoring Errors
Count the number of non-empty cells in a range while excluding cells with errors.
Step 1: Select a Blank Cell
Choose an empty cell to display the count (e.g., G4
).
Step 2: Enter the Aggregate Formula and Press Enter
Type the following formula:
=AGGREGATE(3, 6, C2:C6)
3
: Specifies the COUNTA function (counts non-empty cells).6
: Ignores errors.C2:C6
: The range to evaluate.
Step 3: Preview the Result
Press Enter and Preview the Results the result is 5.

Tips for Using the AGGREGATE Function
- Choose the Right Function Number: Ensure you select the correct
function_num
for the operation you want to perform. - Use Options Wisely: Use the
options
argument to ignore errors, hidden rows, or nested functions as needed. - Combine with Other Functions: AGGREGATE can be combined with other Excel functions for more advanced calculations.
- Test Your Formulas: Always test your formulas with sample data to ensure they work as expected.
Conclusion
The AGGREGATE function in Excel is a powerhouse for handling complex calculations in messy or dynamic datasets. By learning to sum while ignoring errors, calculate maximum values in filtered lists, or count non-empty cells effortlessly, you’ll spend less time fixing data and more time gaining insights.
Ready to simplify your Excel tasks? Start using the AGGREGATE Excel function today and see how it transforms your spreadsheets. Whether you’re a beginner or a seasoned user, this tool is a game-changer for smarter, faster data analysis.