SUBTOTAL function

SUBTOTAL calculates subtotals. If a range already contains subtotals, these are not used for further calculations.

Syntax

SUBTOTAL (function, range)

function is a number that stands for one of the functions in the following table:

Table 1. Function indexes and corresponding functions
Function Index Function
1 AVERAGE
2 COUNT
3 COUNTA
4 MAX
5 MIN
6 PRODUCT
7 STDEV
8 STDEVP
9 SUM
10 VAR
11 VARP

range is the range whose cells are included.