Syntax
SUBTOTAL(function_code, range1, [range2, ...])
Description
Uses another function (SUMM, PRODUCT, etc.) to calculate the subtotal for a set of numbers.
Function_code: The numeric code of the function to be used to calculate the subtotal. Use codes 1-11 to include manually hidden cells in the count, or 101‑111 to exclude them. Cells hidden using a filter are always excluded.
Function_code |
Function_code |
Function |
|---|---|---|
1 |
101 |
AVERAGE |
2 |
102 |
COUNT |
3 |
103 |
COUNTA |
4 |
104 |
MAX |
5 |
105 |
MIN |
6 |
106 |
PRODUCT |
7 |
107 |
STDEV |
8 |
108 |
STDEVP |
9 |
109 |
SUM |
10 |
110 |
VAR |
11 |
111 |
VARP |
range1: The first range or array over which to calculate a subtotal.
[range2; ...]: Additional ranges or arrays over which to calculate subtotals. This parameter is optional.
Example
=SUBTOTAL(9; B2:B5): Calculate the sum of values in cells B2:B5, taking into account the values in the cells hidden manually.
=SUBTOTAL(109; B2:B5): Calculate the sum of values in cells B2:B5, without taking into account the values in the cells hidden manually.
