Open In App

How to use the Excel AGGREGATE Function (Step-by-Step Guide)

Last Updated : 03 Feb, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

Excel-Template
Excel AGGREGATE Function

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 NumberFunctionReference (if applicable)
1AVERAGE
2COUNT
3COUNTA
4MAX
5MIN
6PRODUCT
7STDEV.S
8STDEV.P
9SUM
10VAR.S
11VAR.P
12MEDIAN
13MODE.SNGL
14LARGEk
15SMALLk
16PERCENTILE.INCk
17QUARTILE.INCquart
18PERCENTILE.EXCk
19QUARTILE.EXCquart

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.

OptionBehavior
0Ignore SUBTOTAL and AGGREGATE functions
1Ignore hidden rows, SUBTOTAL, and AGGREGATE functions
2Ignore error values, SUBTOTAL, and AGGREGATE functions
3Ignore hidden rows, error values, SUBTOTAL, and AGGREGATE functions
4Ignore nothing
5Ignore hidden rows
6Ignore error values
7Ignore 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.

Excel AGGREGATE Function
Enter the Data into the Sheet

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.

Excel AGGREGATE Function
Prepare Your Data >> Use the Aggregate Formula>> Press Enter

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.

Excel AGGREGATE Function
Select the Columns >> Right - Click>> Select "Hide"

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).

Excel AGGREGATE Function
Prepare your Data >> Filter the Data>>Use Aggregate Function >> Press OK

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.

Excel AGGREGATE Function
Select a Blank Cell>> Enter the Aggregate Function >> Press Enter

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.


Next Article

Similar Reads