SUBTOTAL

Returns the result of a specified aggregation function applied on a range of cells.

Parameter List

Syntax
SUBTOTAL(function_coderange1)
function_code

The code of the function to execute. Use 1 for AVERAGE, 2 for COUNT, 3 for COUNTA, 4 for MAX, 5 for MIN, 6 for PRODUCT, 7 for STDEV, 8 for STDEVP, 9 for SUM, 10 for VAR_S, and 11 for VAR_P.

range1

Values to which apply the function.

Examples

SUBTOTAL(1, A1:A5) returns 3, the average of all the numbers in range A1:A5.