Excel SUM Only Filtered Cells

There are two ways to “excel sum only filtered cells”: the quick way you copy and the durable way you understand. This page gives you both. The exact Excel answer is above; below, we build the small mental model that makes the fix stick, so the next variation of the same problem solves itself.

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. For “excel sum only filtered cells”, the reliable version is a short checking loop, not just the first command that appears to work. Run it on a deliberately small range first, watch how the affected filter change, and only then apply the same setup to the full sheet. 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 is what makes a data step that keeps your analysis trustworthy useful in real work: repeatable, auditable, and not dependent on memory or luck.

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. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. For “excel sum only filtered cells”, 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

On the way here you may have searched this as “how to select only filtered cells in excel” and “excel how to sum only filtered cells” — it is all the same task, and this page is the single, complete answer to it.

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

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