SUBTOTAL

Returns a subtotal in a list or database. It is generally easier to create a list with subtotals using the Subtotals command (Data menu). Once the subtotal list is created, you can modify it by editing the SUBTOTAL function.

Syntax

SUBTOTAL(function_num,ref1,ref2, …)

Function_num   is the number 1 to 11 that specifies which function to use in calculating subtotals within a list.

Function_Num

Function

1

AVERAGE

2

COUNT

3

COUNTA

4

MAX

5

MIN

6

PRODUCT

7

STDEV

8

STDEVP

9

SUM

10

VAR

11

VARP


Ref1,ref2, …   are 1 to 29 ranges or references for which you want the subtotal.

Remarks

Example

SUBTOTAL(9,C3:C5) will generate a subtotal of the cells C3:C5 using the SUM function