Return aggregate calculation
=AGGREGATE(function_num, options, ref1, [ref2], ...)
| Parameter | Description |
|---|---|
function_num |
Operation to perform (1-19). |
options |
Values to ignore (0-7). |
ref1 |
First argument. |
ref2 |
[optional] Second argument (k). |
The last 6 functions require all four arguments: function_num specifies the operation, options controls various behaviors, ref1 is the array of values
LARGE(array,k)
SMALL(array,k)
PERCENTILE.INC(array,k)
QUARTILE.INC(array,quart)
PERCENTILE.EXC(array,k)
QUARTILE.EXC(array,quart)
To return the MAX value in the range A1:A10, ignoring both errors and hidden rows, provide 4 for function number and 7 for options:
=AGGREGATE(4,7,A1:A10) // max value
To return the MIN value with the same options, change the function number to 5:
=AGGREGATE(5,7,A1:A10) // min value
In the example shown above, the formula in D5 is:
=AGGREGATE(4,6,values)
The formulas in D8:D10 demonstrate how to return "nth largest" values:
=AGGREGATE(14,6,values,1) // 1st largest
=AGGREGATE(14,6,values,2) // 2nd largest
=AGGREGATE(14,6,values,3) // 3rd largest
What makes AGGREGATE especially useful for more complex formulas is that it can handle arrays natively when the function number is 14-19. For example,
=AGGREGATE(14,6,values/(TEXT(dates,"ddd")="Mon"),1)