SUBTOTAL Function

About

SUBTOTAL function in Excel can return different aggregations like SUM, COUNT, AVERAGE, MAX, MIN etc. for the supplied values. SUBTOTAL function also has the option to include or exclude hidden rows.

Function Type

Math and trigonometry

Purpose

Get the subtotal in a list or database

Return value

A number equivalent to the preferred aggregation.

Syntax

=SUBTOTAL(function_num,ref1,[ref2],...)

Arguments

function_num – A number from 1-11 or 101-111 that specifies the function to use. 1-11 includes manually-hidden rows, while 101-111 excludes them. Filtered-out cells are always ignored.

Functionfunction_num to include hidden Rowsfunction_num to exclude hidden Rows
AVERAGE1101
COUNT2102
COUNTA3103
MAX4104
MIN5105
PRODUCT6106
STDEV7107
STDEVP8108
SUM9109
VAR10110
VARP11111

ref1 – A reference or named range to subtotal

ref2 – [optional] The second reference or second named range to subtotal


Example 1


Notes

SUBTOTAL function ignores formulas containing SUBTOTAL function.

Total Row feature of Excel Tables uses SUBTOTAL function to provide aggregations.


Read about Excel Functions

Excel Functions in Alphabetical Order (Complete list)

Complete List of Excel Functions (Category wise)


New Dynamic Array Functions in Excel

LET Function in Excel

STOCKHISTORY Function in Excel