FormulaCraft

How to sum a filtered range in Excel and Google Sheets

Topic:SUM & aggregation
Excel & Google Sheets
=SUBTOTAL(9,B2:B6)

Verified example

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

CategorySales
A100
B200
A150
B300
A250

=SUBTOTAL(9,B2:B6)1000

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

Step by step

  1. 1Apply a filter to your data table (Data > Filter / Create a filter).
  2. 2In a cell outside the data table, type =SUBTOTAL(9,B2:B6) where B2:B6 is your values column.
  3. 3Change the filter criteria. The SUBTOTAL result updates immediately to reflect only the visible rows.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

What is the difference between SUM and SUBTOTAL?

SUM sums all cells in the range regardless of visibility. SUBTOTAL(9,...) sums only the visible (non-hidden) cells, making it filter-aware.

Can I use SUMIF on a filtered range and get only visible totals?

No — SUMIF counts hidden rows. Combine SUBTOTAL with a helper column, or use AGGREGATE (Excel) for conditional filtered sums.

More on SUM & aggregation

See all →

Formulas used

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

Last reviewed: