AGGREGATE Function
Calculate a sum, average, count, maximum or another aggregate of a list while ignoring error values or nested subtotals. function_num selects the calculation: 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), 15 (SMALL), 16 (PERCENTILE.INC), 17 (QUARTILE.INC), 18 (PERCENTILE.EXC) or 19 (QUARTILE.EXC). options from 0 to 7 selects what is ignored, as in Excel: 2, 3, 6 and 7 ignore error values, and 0 to 3 ignore nested SUBTOTAL and AGGREGATE results. ref1 is the range to aggregate; the functions 14 to 19 take their k (the rank, percentile or quartile) as the fourth argument, and return #NUM! without it. A function_num or options outside these ranges returns #VALUE!.
Syntax
AGGREGATE(function_num, options, ref1, k)
Category: Math. Minimum arguments: 3. Maximum arguments: 255.
Available for supported offline calculation.
Examples
=AGGREGATE(9,6,A1:A5)
With 10, 20, a #DIV/0! error, 40 and 50 in A1:A5, the formula returns 120: the sum of the numbers, with the error ignored (options 6).
Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.