To sum only the visible rows in a filtered Excel list, use =SUBTOTAL(109, range). The 109 tells Excel to add up the numbers while ignoring rows hidden by a filter and also ignoring any rows you hid manually. If you only need to skip filtered-out rows but still count manually hidden rows, use 9 instead of 109. The function works in every current Excel version on Windows, Mac, and the web, and the labels you see in menus can differ slightly by version and region.
What You'll Need
- Excel 2010 or later (Windows, Mac, or Excel for the web). The 1xx function numbers were introduced in Excel 2010, so older files may show a #NAME? error until they are opened in a newer version.
- A list or table with a header row and numeric values in at least one column.
- The AutoFilter turned on for that list (Data tab > Filter, or Ctrl+Shift+L on Windows).
Step-by-Step
- Set up your data as a clean list. Put headers in one row and keep one record per row. Do not leave blank rows inside the data, because a blank row can break the filter range and make SUBTOTAL miss rows.
- Turn on AutoFilter. Select any cell inside the list, then go to the Data tab and click Filter. On Windows you can also press Ctrl+Shift+L. Drop-down arrows appear in the header row.
- Pick a cell for the total. A good spot is just below the last data row or in a small summary block to the side. Leave one blank row between the data and the total so the total is not swept into the filter range.
- Type the formula. Enter
=SUBTOTAL(109, B2:B100), replacing B2:B100 with the actual range of numbers you want to add. You can also type=SUBTOTAL(109,and then drag over the range with the mouse, then close the bracket and press Enter. - Check the result against the unfiltered data. With no filter applied, SUBTOTAL(109) should equal a plain SUM of the same range, because every row is visible. If it does not, you have hidden rows or a range that is too small.
- Apply a filter and watch the total change. Use a drop-down to show only some rows. The SUBTOTAL result should drop to the sum of the visible rows only. Clear the filter and it returns to the full total.
- Use 9 instead of 109 if you want manually hidden rows included. Function number 9 ignores filtered-out rows but still adds rows you hid by right-clicking and choosing Hide. Function number 109 ignores both filtered and manually hidden rows. Choose based on what you want the total to mean.
- Copy the formula down or across if needed. SUBTOTAL adjusts its range as you copy, just like SUM. If you want a fixed range, use absolute references such as
$B$2:$B$100. - Consider an Excel Table instead. If you convert the range to a table (Insert > Table), Excel adds a Total Row you can turn on from the Table Design tab. The total row uses SUBTOTAL automatically, so it updates with filters without you writing the formula.
Common Mistakes
- Using SUM instead of SUBTOTAL. SUM adds every row in the range, including rows hidden by a filter. That is the single most common reason a filtered total looks wrong.
- Mixing up 9 and 109. Both ignore filtered rows, but only 109 also ignores manually hidden rows. Pick the one that matches what you mean by visible.
- Putting the total inside the filtered range. If the SUBTOTAL cell sits within the range it is summing, you get a circular reference or a doubled total. Keep the total outside the data range.
- Leaving blank rows in the data. AutoFilter stops at the first blank row, so rows below it are never filtered and SUBTOTAL keeps counting them.
- Typing the range by hand and missing rows. When new rows are added below the range, the formula does not grow. Use a table or extend the range deliberately.
- Expecting SUBTOTAL to work on text. Function 109 sums numbers only. Text and blanks are ignored, which is usually what you want, but it means a column of text values returns 0.
Tips
- SUBTOTAL also has function numbers for other operations: 101 for AVERAGE, 102 for COUNT, 103 for COUNTA, 104 for MAX, and 105 for MIN. The 1xx versions all ignore manually hidden rows as well as filtered ones.
- If you want a quick check, put
=SUBTOTAL(103, A2:A100)next to your total to count visible rows. It is a fast way to confirm the filter is doing what you think. - Nested SUBTOTALs are ignored by an outer SUBTOTAL, which helps avoid double counting when you have subtotals inside a list.
- For a running total that respects filters, combine SUBTOTAL with OFFSET or use a table with a total row; plain SUM cannot do this.
- Keyboard shortcut Ctrl+Shift+L toggles filters on Windows. On Mac, use the Data menu instead, since shortcuts vary by version.
Troubleshooting
- The formula returns #NAME?. The file is probably in an older format or opened in a very old Excel version that does not recognise 109. Save as .xlsx and open in Excel 2010 or later.
- The total does not change when you filter. Check that the range in the formula matches the filtered range exactly. If the filter covers A1:D100 but the formula sums B2:B50, rows outside B2:B50 are not counted and the total will look stuck.
- The total includes rows you hid manually. You are using 9, not 109. Change the first argument to 109.
- The total is zero. The range may contain text rather than numbers, or the numbers may be stored as text. Select the column and use Data > Text to Columns, or multiply by 1 in a helper column, to convert.
- The total is double what you expect. The SUBTOTAL cell is probably inside the range it sums, or you have two SUBTOTAL formulas covering overlapping ranges. Move the total outside the data.
- If that did not work, clear all filters, confirm the range with a plain SUM in a spare cell, then reapply the filter. If the plain SUM and SUBTOTAL disagree with no filter applied, the range is wrong.
Frequently Asked Questions
What does the 109 in SUBTOTAL mean?
It is the function number for SUM in the 1xx series. The 1xx numbers tell Excel to ignore rows hidden by a filter and rows you hid manually. The older 9 does the same for filters but still counts manually hidden rows.
Does SUBTOTAL work with Excel Tables?
Yes. When you turn on the Total Row for a table, Excel inserts a SUBTOTAL formula automatically, and it updates as you filter. You can also type SUBTOTAL inside a table like any other formula.
Can I use SUBTOTAL on multiple columns at once?
Yes. Select the summary cells under each column and enter the formula once, or copy it across. Each column needs its own SUBTOTAL with the matching range.
Why does SUBTOTAL ignore my hidden rows but SUM does not?
SUM has no concept of visibility. SUBTOTAL checks whether each row is visible before adding it, which is why it is the right tool for filtered lists.
Does SUBTOTAL work in Excel for the web and on Mac?
Yes. The function and the 1xx numbers are supported in current Excel for the web and Excel for Mac. Menu labels and shortcut keys can differ slightly by version and region.
What happens if I filter by colour or by icon?
SUBTOTAL respects rows hidden by any filter, including colour and icon filters, because those rows are not visible. It does not look at cell colour itself.