Category: FUNCTION | Updated: 2026-11-22

How to Use the AGGREGATE Function in Google Sheets

Syntax

=AGGREGATE(function_number, options, range1, [range2, ...])
  • function_number: Specifies the aggregation method (e.g., 1 = AVERAGE, 4 = MAX, 5 = MIN, 9 = SUM, 14 = LARGE, 15 = SMALL).
  • options: Specifies what data to ignore (e.g., 4 = ignore nothing, 5 = ignore hidden rows, 6 = ignore error values, 7 = ignore hidden rows and error values).
  • range1: The cell range to aggregate.
  • range2, … (optional): Additional cell ranges, or the rank (k) when using LARGE or SMALL.

Example Table

Even when an #N/A error appears in the sales list, specifying option 6 ignores the error and calculates the total properly.

Column A (Product) Column B (Sales) Explanation
Row 1 Product Sales
Row 2 Product A 1200 Valid value
Row 3 Product B #N/A Error value (ignored)
Row 4 Product C 1800 Valid value
Row 5 Total 3000 =AGGREGATE(9, 6, B2:B4)

Common Errors and Caveats

  • #VALUE! error: When using array-type function numbers such as 14 (LARGE) or 15 (SMALL), you must provide the rank (k) as the 4th argument. Missing this argument results in an error.
  • Compatibility with Excel: Google Sheets supports the AGGREGATE function, but if you export your spreadsheet to older versions of Excel or other tools, be sure to check compatibility.

Frequently Asked Questions

Q. What is the difference between the SUBTOTAL and AGGREGATE functions?

A. AGGREGATE is a more capable superset of SUBTOTAL. In addition to ignoring hidden rows, it lets you specify options to ignore error values (such as #N/A or #DIV/0!) within the range.

Q. How do you use the AGGREGATE function to sum values while ignoring errors?

A. Specify 9 (SUM) as the function number and 6 (ignore error values) as the option, like "=AGGREGATE(9, 6, A2:A10)".