FormulaCraft

SUBTOTAL

SUBTOTAL applies a chosen aggregation — 9 for SUM, 1 for AVERAGE, 3 for COUNTA — and crucially skips rows hidden by a filter and any nested SUBTOTALs, so totals stay correct as you filter.

Topic:SUM & aggregation
Excel
=SUBTOTAL(9, A2:A4)
Google Sheets
=SUBTOTAL(9, A2:A4)

Verified example

Computed by a real spreadsheet engine on the sample data below.

Sales
100
200
300

=SUBTOTAL(9, A2:A4)600

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 19 selects the SUM function (use 1 for average, 2/3 for count).
  2. 2A2:A4 is the range to aggregate.
  3. 3Rows hidden by a filter are excluded automatically.

Need a version for your data?

Try: “Sum the sales column but ignore rows hidden by my filter

More on SUM & aggregation

See all →

Related

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: