1. Home
  2. Functions
  3. Math
  4. AGGREGATE

AGGREGATE function

Returns a sum, average, count, percentile and more of a range, with options to skip hidden rows, errors and other subtotals.

Syntax

=AGGREGATE(function_num, options, ref1, [k], ...)

Arguments

ArgumentRequiredDescription
function_numRequired1 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, 19 QUARTILE.EXC
optionsRequired0 to 7: which values to skip (hidden rows, error values, nested subtotals)
ref1RequiredThe range or array
kOptionalFor functions 14 to 19: the position, percentile or quartile

How to use AGGREGATE

AGGREGATE takes 3 required arguments and 1 optional argument, and accepts more values in the same pattern. Type =AGGREGATE( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=AGGREGATE(9, 6, A1:A3)Result 4
Data in the sheet
A
11
2=1/0
33
=AGGREGATE(14, 6, A1:A4, 2)Result 3
Data in the sheet
A
11
2=1/0
33
45
=AGGREGATE(9, 0, A1:A3)Result #DIV/0!
Data in the sheet
A
11
2=1/0
33

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.