ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Math
  3. How to Sum Only Visible (Filtered) Cells in Excel

How to Sum Only Visible (Filtered) Cells in Excel

By ExcelReady Team·Updated November 1, 2026·5 min read

The short answer

To sum only visible cells in Excel, use SUBTOTAL instead of SUM. =SUBTOTAL(9,C2:C8) adds only the rows left showing after you filter. =SUBTOTAL(109,C2:C8) also skips rows you hid by hand. SUM always adds every cell, hidden or not. AGGREGATE(9,5,C2:C8) does the same and can skip error values too.

Key takeaways

  • SUM adds every cell, including rows hidden by a filter.
  • =SUBTOTAL(9,range) ignores rows hidden by a filter; =SUBTOTAL(109,range) also ignores rows hidden manually.
  • AutoSum on a filtered list writes a SUBTOTAL(9,...) formula for you.
  • =AGGREGATE(9,7,range) sums visible cells and skips errors such as #N/A.
  • To copy only the visible rows, select visible cells first: Alt+; on Windows, ⌘⇧Z on Mac.
On this page+
  1. Why SUM includes hidden rows
  2. How to sum only filtered rows with SUBTOTAL
  3. SUBTOTAL 9 vs 109: filtered rows vs hidden rows
  4. How to sum visible cells and skip errors with AGGREGATE
  5. How to sum visible cells with a condition
  6. How to copy only the visible cells
  7. Common mistakes
  8. Practise it

To sum visible cells only in Excel, replace SUM with SUBTOTAL. SUM adds every cell in the range, even rows a filter has hidden, so your total doesn't change when you filter. =SUBTOTAL(9,C2:C8) adds only the rows you can see. This guide explains the difference between SUBTOTAL 9 and 109, the AGGREGATE alternative, and how to sum visible rows with a condition.

Why SUM includes hidden rows#

SUM adds every number in its range, whatever is on screen. Filtering or hiding a row only changes what you see, not what's in the range.

The examples use this order list in A1:C8:

ABC
1OrderRegionAmount
21001North250
31002South400
41003North175
51004East320
61005South90
71006North410
81007East150

=SUM(C2:C8) returns 1,795. Now filter the Region column to show only North. Three rows are left on screen, adding up to 835, but SUM still says 1,795. That's the problem SUBTOTAL solves. The SUM function guide covers what SUM does include.

How to sum only filtered rows with SUBTOTAL#

Use function number 9, which tells SUBTOTAL to sum.

Excel formula
=SUBTOTAL(9,C2:C8)

With no filter, this returns 1,795, the same as SUM. Filter to North and it changes to 835 (250 + 175 + 410). Filter to South and it shows 490. The total always matches what's on screen.

To add a filter, click inside the table and press Ctrl+Shift+L on Windows or ⌘⇧F on Mac, then use the arrows in the header row. The lesson on filtering a table walks through it.

The quickest way to get this formula: filter first, then click the cell below the column and press AutoSum (Windows: Alt+=; Mac: ⌘⇧T). On a filtered list, Excel writes =SUBTOTAL(9,...) instead of SUM.

SUBTOTAL 9 vs 109: filtered rows vs hidden rows#

Both numbers sum, but they treat manually hidden rows differently. Rows hidden by a filter are always ignored.

FormulaIgnores filtered rows?Ignores rows hidden with Hide?
=SUM(C2:C8)NoNo
=SUBTOTAL(9,C2:C8)YesNo
=SUBTOTAL(109,C2:C8)YesYes

So if you right-click row 3 and choose Hide, SUBTOTAL(9,...) still includes its 400, while SUBTOTAL(109,...) drops it. If you want "what I see is what I add", use 109. The SUBTOTAL function guide lists the other function numbers, such as 1 (101) for AVERAGE and 3 (103) for COUNTA.

If you format the list as an Excel table (Insert > Table, or Ctrl+T on Windows) and turn on Total Row from the Table Design tab, Excel adds a total that uses SUBTOTAL(109,...) automatically. It respects both filters and hidden rows, and you can switch it to an average or count from the drop-down in the total cell. That's often the quickest way to get a visible-only total without typing anything.

The comparison of SUBTOTAL vs SUM goes deeper into when each is the right choice. One useful extra: SUBTOTAL ignores other SUBTOTAL formulas inside its range, so group totals don't get counted twice in a grand total.

How to sum visible cells and skip errors with AGGREGATE#

AGGREGATE works like SUBTOTAL with more options, including skipping error values. It's available in Excel 2010 and later.

Excel formula
=AGGREGATE(9,5,C2:C8)

The first argument, 9, means SUM. The second is the option:

OptionWhat it ignores
5Hidden rows
6Error values
7Hidden rows and error values

If one amount shows #N/A from a failed lookup, SUM and SUBTOTAL both return #N/A. =AGGREGATE(9,7,C2:C8) skips it and adds the rest of the visible cells.

How to sum visible cells with a condition#

SUMIF and SUMIFS can't tell whether a row is hidden. The simplest fix is a helper column that marks visible rows.

  1. In D2, type =SUBTOTAL(103,A2) and fill it down to D8.
  2. Each cell shows 1 if its row is visible and 0 if it is hidden.
  3. Use the helper as an extra condition:
Excel formula
=SUMIFS(C2:C8,B2:B8,"North",D2:D8,1)

SUBTOTAL 103 counts non-empty cells in visible rows only, so on a single cell it returns 1 or 0. Now the North total responds to any other filter you apply, such as a date filter.

How to copy only the visible cells#

Copying a filtered range in Excel normally pastes only the visible rows. With manually hidden rows, it can paste the hidden ones too. To be sure:

  1. Select the range.
  2. Press Alt+; on Windows or ⌘⇧Z on Mac to select visible cells only. You can also use Home > Find & Select > Go To Special > Visible cells only.
  3. Copy and paste as usual.

The guide to selecting visible cells only covers this step in more detail.

Common mistakes#

Check these if a visible total looks wrong:

  1. Using SUM after filtering. Replace it with SUBTOTAL(9) or SUBTOTAL(109).
  2. Using 9 when rows were hidden by hand. Switch to 109.
  3. Expecting hidden columns to be skipped. SUBTOTAL only skips hidden rows.
  4. Putting the total inside the filtered range. Place it below or above the data so the filter doesn't hide it.

For other ways to pick which rows get added, see how to sum every other row and how to filter and sum with formulas.

Practise it#

Filtered totals are a common trap in Excel tests: the right answer changes when the filter does. Practise filtering a table in a live spreadsheet: you apply the filter and it checks your work instantly. Then practise SUM and AutoSum, and try the intermediate Excel test when you're ready.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Write a total that will respect filters and hidden rows. Click C10 and use SUBTOTAL with function number 109 on C2:C8. With nothing hidden, it matches SUM.

fx
ABCD
1
Order
Region
Amount
2
1001
North
250
3
1002
South
400
4
1003
North
175
5
1004
East
320
6
1005
South
90
7
1006
North
410
8
1007
East
150
9
10
Visible total
11
12
13

Tip: The function number comes first: 109 means SUM that skips hidden rows.

Practise this in a lesson

LessonFilter a tableTurn on filter buttons with Ctrl+Shift+L, filter by one or several values and by a number condition, total and count only the visible rows with SUBTOTAL, then clear the filters.LessonSUM and AutoSumAdd up a column of numbers with SUM, then let AutoSum write the formula for you.Function guideSUBTOTALTotal filtered lists and grouped data without double counting using SUBTOTAL. Function codes 9, 109 and more, plus a live exercise.

Frequently asked questions

How do I sum only filtered cells in Excel?

+

Use =SUBTOTAL(9,C2:C8) instead of SUM. When you filter the table, the result updates to show the total of the visible rows only.

What is the difference between SUBTOTAL 9 and 109?

+

Both ignore rows hidden by a filter. SUBTOTAL 109 also ignores rows you hid manually with Hide Rows, while SUBTOTAL 9 still includes them.

Why does SUM include hidden rows?

+

SUM is designed to add every number in the range, whatever is on screen. Hiding or filtering a row only changes what you see. Use SUBTOTAL or AGGREGATE to respect hidden rows.

How do I sum visible cells with a condition?

+

Add a helper column with =SUBTOTAL(103,A2), which shows 1 for a visible row and 0 for a hidden one. Then use SUMIFS with that column equal to 1 as one of the conditions.

Does SUBTOTAL ignore hidden columns?

+

No. SUBTOTAL only ignores hidden rows. If you sum across a row, hidden columns are still included.

Sources

  • SUBTOTAL function - Microsoft Support
  • AGGREGATE function - Microsoft Support
  • Filter data in a range or table - Microsoft Support

Written and checked by the ExcelReady Team. First published November 1, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. Why SUM includes hidden rows
  2. How to sum only filtered rows with SUBTOTAL
  3. SUBTOTAL 9 vs 109: filtered rows vs hidden rows
  4. How to sum visible cells and skip errors with AGGREGATE
  5. How to sum visible cells with a condition
  6. How to copy only the visible cells
  7. Common mistakes
  8. Practise it

Keep reading

Productivity· 5 min read

Select and Copy Only Visible Cells in Excel

To copy only the visible cells, select the range, press Alt+; on Windows or Command+Shift+Z on a Mac, then copy and paste as usual. Hidden rows and columns are left out. You can also use Home, Find & Select, Go To Special, Visible cells only. Filtered lists already copy visible rows only, but manually hidden rows need this step.

Comparisons· 7 min read

SUBTOTAL vs SUM in Excel: Totals That Respect Filters

SUM adds every number in a range, whether rows are filtered, hidden or already totals. SUBTOTAL with 9 adds only the rows a filter leaves visible and skips other SUBTOTAL formulas, so group totals aren't counted twice. SUBTOTAL with 109 also skips rows you hid by hand. Use SUM for fixed totals and SUBTOTAL for lists people filter.

Math· 5 min read

The Excel SUM Function: A Beginner's Guide

The Excel SUM function adds numbers. Type =SUM( then the cells to add, then ), for example =SUM(B2:B5) to add B2 through B5. A colon makes a range, and a comma adds separate cells or ranges, like =SUM(B2,B4:B5). SUM skips text and empty cells, so it doesn't break on gaps.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free