AGGREGATE()

SyntaxThis function has two forms:

Definition. This function returns an aggregate in a list or database.

Arguments

Note

If a second ref argument is required but not specified, the AGGREGATE() function returns the #VALUE! error. If one or more of the references is a 3-D reference, then AGGREGATE() returns the #VALUE! error.

If the references include additional AGGREGATE() functions, the nested functions could be ignored, so they are not considered multiple. The same applies if the references contain subtotals.

Remember: The AGGREGATE() function is intended for data columns or vertical ranges, not for rows or horizontal ranges. Hiding a column doesn’t affect the result. However, if you hide a row, the result is different.

Background. The AGGREGATE() function is very powerful. This function was added to Excel 2010 to remove some restrictions the other functions have. Most functions return an error if the calculated references are incorrect. In such cases in the previous Excel versions, you had to run a complex IFERROR() query. With the AGGREGATE() function you can also control the behavior of hidden cells.

The AGGREGATE() function allows you to calculate formulas for value ranges with subtotals without including the subtotals in the result. See Figure 16-4 for an example of when this function could be useful.

The SUBTOTAL() function cannot ignore the errors.

Figure 16-4. The SUBTOTAL() function cannot ignore the errors.

In the figure, the SUM() and SUBTOTAL() functions cannot add the values in column C. However, the formula

=AGGREGATE(9,3,C18:C29)

returns a useful result despite the error and the subtotals. You can also ignore hidden cells so that you only add the values in the visible range. With only one click, you can include entire ranges in the result or hide them.

Example. This function is used for numerous purposes, such as a series of measurements for which the total is calculated regardless of errors or subtotals.

See Also

SUBTOTAL()