How to SUM Filtered Cells in Excel

If you just need to sum filtered cells in excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: use =SUBTOTAL(109,B2:B20) to sum only the visible rows (=SUBTOTAL(9,B2:B20) is enough when rows are hidden only by a filter); to count them use 103 for non-empty cells or 102 for numbers.

On this page7
▤Annotated stepsExcel
1

Put the formula where the filter cannot hide it, for example above the table or in a total row.

2

Type =SUBTOTAL(109, then select the column range and close the bracket.

3

Use 103 instead of 109 to count non-empty visible cells, or 102 to count visible numbers.

4

Apply or change the filter (or hide rows) and check that the result follows.

5

In an Excel Table, Table Design ▸ Total Row inserts the same kind of SUBTOTAL formula for you.

=SUBTOTAL(109,B2:B20)
Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

What this does

SUM and COUNT read every cell in the range, including rows you cannot see. SUBTOTAL calculates over the rows that are still shown. Rows removed by a filter are always left out; the function number decides what happens to rows hidden by hand: 1–11 still include them, 101–111 leave them out as well. The pairs used most are 9/109 for a sum, 2/102 for a count of numbers and 3/103 for a count of non-empty cells. SUBTOTAL also skips other SUBTOTAL results inside its range, so subtotals are not counted twice. It is designed for vertical ranges: hiding a column does not change the result. Keep the inputs visible and clearly labelled and the whole thing stays auditable — anyone who opens the file later, including you, can see at a glance exactly what feeds the result and change one assumption without hunting through the formula. Treat “sum filtered cells in excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected filter shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a data step that keeps your analysis trustworthy into a method you can reuse, explain, and defend when the workbook leaves your screen.

A worked example

A2:A4 holds 10, 20 and 30. Hide row 3 by hand: =SUM(A2:A4) still returns 60 while =SUBTOTAL(109,A2:A4) returns 40, and =COUNT(A2:A4) returns 3 while =SUBTOTAL(102,A2:A4) returns 2. Unhide the row and filter the 20 out instead: =SUBTOTAL(9,A2:A4) now also returns 40, because filtered rows are excluded with either function number. A filtered report is only useful when its totals match what is on screen. SUBTOTAL keeps the result tied to the visible rows, so filtering one region shows that region instead of the whole column. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.

In Google Sheets

Google Sheets support for this task has not been verified. Check the function, arguments and workflow in the target product before transferring the example. Matching formula notation does not establish identical behaviour. Nothing on this page is behind a login or a download: the exact answer is at the top, and the detail below it is there for when you need it. That is the whole promise here — the answer first, and just enough context to make it stick. For “sum filtered cells in excel”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.

Common mistakes

  • Using =SUM() or =COUNT() and expecting hidden rows to drop out.
  • Using 9 when rows are hidden by hand rather than by a filter — only 101–111 skip manually hidden rows.
  • Placing the formula inside the filtered range, where the filter can hide the result itself.
  • Expecting SUBTOTAL to skip hidden columns; it only responds to hidden rows.

Frequently asked questions

What is the difference between 9 and 109?

Both leave out rows removed by a filter. 9 still includes rows hidden with Hide; 109 leaves those out too.

How do I count only the visible rows?

Use =SUBTOTAL(103,A2:A100) for non-empty visible cells, or 102 when the column holds numbers only.

Is there an alternative that also ignores errors?

AGGREGATE can skip hidden rows and error values together, for example =AGGREGATE(9,7,B2:B20) for a sum that ignores both.

Other ways people ask this

People reach this page typing “sum of filtered cells in excel” and “excel sum filtered cells”, among other phrasings; whichever wording you used, the fix above is the one you want.

Why do people search for this in so many different ways?

Because the same task has many names. “sum of filtered cells in excel”, “excel sum filtered cells” all point at the one operation explained on this page, which is why they all lead here.