FormulaCraft

How to sum visible cells only 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.

CategoryAmount
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 (Data > Filter in Excel; Data > Create a filter in Sheets).
  2. 2In an empty cell outside the filtered range, type =SUBTOTAL(9,B2:B6) where B2:B6 is your numeric column.
  3. 3The result updates dynamically as you change filter criteria, always showing the sum of visible rows only.

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

Why does my SUBTOTAL result not change when I apply a filter?

Make sure SUBTOTAL is placed outside the filtered range and that the range argument correctly covers the data rows. SUBTOTAL cells inside the filtered range may themselves be hidden.

Does Google Sheets support SUBTOTAL?

Yes — Google Sheets supports SUBTOTAL with the same function codes as Excel.

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: