Excel Function

SUBTOTAL

Returns a subtotal with specified aggregate function.

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

Arguments

function_num

Required

SUBTOTAL operation code: 1=AVERAGE, 2=COUNT, 3=COUNTA, 4=MAX, 5=MIN, 6=PRODUCT, 7=STDEV.S, 8=STDEV.P, 9=SUM, 10=VAR.S, 11=VAR.P. Use 101-111 for the same operations while excluding manually hidden rows.

ref1

Required

Specify a reference range. You can drag or click start/end cells.

Practice Preview

Use SUBTOTAL to calculate a subtotal for Sales in column D with 9 (SUM). You can set ranges by dragging from the start cell to the end cell in the same argument field.

Example Table

#
AProduct ID
BProduct Name
CCategory
DSales
2P001AppleFood1200
3P002BananaFood980
4P003NotebookStationery450
5P004PenStationery300
6P005GrapesFood1500
7P006RulerStationery250
8P007PeachFood860

How to Use (Formula)

=SUBTOTAL(9, D2:D8)

Result

5540

Practice This Function

SUBTOTAL FAQ

How do I use SUBTOTAL in Excel?

Use SUBTOTAL when you want to summarize filtered data. Enter Function number, Reference range in that order, then add optional arguments when needed.

Where can I practice SUBTOTAL?

Use the "Start Function Practice" button to jump straight into SUBTOTAL drills.

What arguments does SUBTOTAL use?

The main arguments are Function number, Reference range. Enter them in order.