ExcelMathAdvanced

AGGREGATE

Performs calculations while ignoring hidden rows or errors.

Read the syntaxReview worked examplesOpen the spreadsheet app
=AGGREGATE(function_num, options, array, [k])

This static page keeps the function indexed for search, while the spreadsheet app handles interactive exploration and saved formulas.

What the function does

Overview

Performs calculations while ignoring hidden rows or errors.

AGGREGATE is an advanced multi-purpose function that evaluates lists and databases using one of 19 underlying operations (such as SUM, AVERAGE, or LARGE). Unlike the SUBTOTAL function, AGGREGATE provides 'options' to selectively ignore hidden rows, error values (#N/A, #VALUE!, #DIV/0!), and even nested SUBTOTAL or AGGREGATE results to prevent double-counting. It supports two syntax variations: Reference-form (for functions 1-13) and Array-form (for functions 14-19). A critical technical edge case is that AGGREGATE does not support 3D references across multiple worksheets. For statistical functions 14-19, the [k] argument must be provided or the function returns a #VALUE! error. Best practice involves using option 6 or 7 when dealing with data imported from external sources that may contain intermittent calculation errors to ensure report stability without manually cleaning data.

Quick reference

Syntax

=AGGREGATE(function_num, options, array, [k])

Inputs

Arguments

function_numOperation ID (9=SUM, 1=AVERAGE, etc.)
Example: 9
optionsBehavior (6=Ignore errors)
Example: 6
arrayRange to calculate
Example: A2:A100

Formula patterns

Examples

1

sum visible cells and ignore errors

=AGGREGATE(9, 7, A2:A100)
summingerror handlingvisibility
2

find 2nd largest value ignoring errors

=AGGREGATE(14, 6, B2:B50, 2)
rankingstatisticalerror suppression
3

average visible rows while ignoring nested subtotals

=AGGREGATE(1, 0, C2:C100)
averagingfiltered listssubtotals

Avoid these issues

Common Errors

1

#VALUE!

Cause: The function_num is between 14-19 but the mandatory [k] argument is missing.

Fix: Add the required rank or percentile value as the fourth argument (e.g., k=1 for the smallest value in SMALL).

2

#VALUE!

Cause: A 3D reference or a range from another worksheet is passed which the function cannot process.

Fix: Ensure all references are 2D and point to the current worksheet only.

Platform support

Compatibility

Excel 2010+Excel-first

Source: Microsoft Support

Common questions

Frequently Asked Questions

Performs calculations while ignoring hidden rows or errors.

um: Operation ID (9=SUM, 1=AVERAGE, etc.) options: Behavior (6=Ignore errors) array: Range to calculate

#VALUE!: Add the required rank or percentile value as the fourth argument (e.g., k=1 for the smallest value in SMALL). #VALUE!: Ensure all references are 2D and point to the current worksheet only.