How to Sum Only Filtered Rows in Excel

SUM also adds rows hidden by a filter. To add only the visible rows, use SUBTOTAL with function number 9 (sum).

Formula to use

=SUBTOTAL(9, C2:C100)

Sum of rows visible after filtering

Use 109 to leave out manually hidden rows too

Both 9 and 109 leave out rows hidden by a filter. To also leave out rows you hid yourself with right-click > Hide, use 109.

  • =SUBTOTAL(109, C2:C100)Sum without hidden rows

Count and average visible rows

Just change the function number: 3 counts non-empty cells (COUNTA) and 1 is the average.

  • =SUBTOTAL(3, A2:A100)Number of visible rows
  • =SUBTOTAL(1, C2:C100)Average of visible rows

Grand total for a table with subtotals

SUBTOTAL leaves out other SUBTOTAL results in its range. So even with subtotal rows mixed in, you get the grand total in one formula.

Common mistakes

If the formula sits inside the filtered range (right below the data), it can be filtered out too. Put the total above the table or after one blank row.

Try the functions used here

Change the arguments in the function playground and watch the calculation step by step.

FAQ

How do I see it without a formula?
Select the cells and the status bar at the bottom of Excel shows their sum, average and count.
How do I add only visible rows that meet a condition?
The simplest way is to set the condition with a filter and then use SUBTOTAL(9, …).

More guides