Sum Visible Cells Only

SUM and SUMIF add up every row, even the ones a filter has hidden. SUBTOTAL is built to ignore filtered rows, so the total changes as you filter the table.

Free, no sign-up required · 5 free generations a day

Last updated

Describe your task, get the formula

Type what you need in plain English, or pick an example below. You get the formula, a step-by-step explanation, and a worked example.

Visible-cells formulas

Syntax
=SUBTOTAL(109, C2:C100)
=SUBTOTAL(103, A2:A100)
=SUMIFS(C:C, B:B, "West", D:D, 1)

109 is SUM that ignores hidden rows and 103 is COUNTA that does. The third formula covers the case SUBTOTAL cannot: it uses a helper column D containing =SUBTOTAL(103,A2) in every row, which is 1 for visible rows and 0 for hidden ones, as an extra condition.

Examples

Sum only the filtered rows

=SUBTOTAL(109,C2:C100)

Adds the visible cells in column C. Put the formula above the data or in a separate cell, outside the filtered range, so it stays in view.

Count the visible rows

=SUBTOTAL(103,A2:A100)

Counts the non-empty cells in column A that are still visible, which tells you how many rows match the current filter.

Sum visible rows that also meet a condition

=SUMIFS(C:C,B:B,"West",D:D,1)

Column D holds =SUBTOTAL(103,A2) in each row, giving 1 for visible rows and 0 for filtered-out ones. Adding D=1 to SUMIFS limits the total to what you can see.

Common mistakes and how to fix them

The total does not change when you filter

The formula is using SUM, SUMIF, or SUMIFS, which always include hidden rows. Switch to SUBTOTAL, or add the helper-column condition.

Rows hidden by hand are still counted

Function numbers 1 to 11 include manually hidden rows, while 101 to 111 skip them. Use 109 rather than 9 if you also hide rows manually.

SUBTOTAL ignores another SUBTOTAL in the range

This is by design, to avoid double counting, but it means a total row placed inside the range is skipped. Keep totals outside the data range.

Frequently asked questions

Does SUBTOTAL work with a Google Sheets filter?

Yes. SUBTOTAL(109,range) skips rows hidden by a filter and rows hidden manually in Google Sheets as well.

What other calculations does SUBTOTAL support?

Average (101), count of numbers (102), count of non-empty cells (103), max (104), min (105), and product (106), plus several others, each with a 100-series number that ignores hidden rows.

Is there an alternative to SUBTOTAL?

AGGREGATE does the same and can also ignore errors, for example =AGGREGATE(9,5,C2:C100) sums the visible cells.

Don't want to write it by hand?

Describe what you need in plain English and get a ready-to-use formula in seconds.

Try the formula generator