ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

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

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Data tools
  3. SUBTOTAL in Excel: Totals That Ignore Filtered Rows

SUBTOTAL in Excel: Totals That Ignore Filtered Rows

By ExcelReady Team·Updated October 30, 2026·5 min read

The short answer

SUBTOTAL calculates a total that skips rows hidden by a filter: =SUBTOTAL(109,D2:D11) adds only the visible amounts, while SUM adds every row. The first argument picks the calculation: 9 or 109 sums, 1 or 101 averages, 3 or 103 counts non-empty cells. The 100s also skip rows you hid by hand.

Key takeaways

  • =SUBTOTAL(function_num, range) runs a calculation on the visible rows only.
  • 9 and 109 both sum; 109 also ignores rows hidden by hand, while both ignore rows hidden by a filter.
  • 103 counts visible non-empty cells, 101 averages and 104 finds the largest.
  • SUBTOTAL skips other SUBTOTAL results in its range, so a grand total doesn't double count.
  • It ignores hidden rows, not hidden columns.
On this page+
  1. What does the Excel SUBTOTAL function do?
  2. SUBTOTAL function numbers: 9 vs 109
  3. Example: total only the filtered rows
  4. 9 or 109: rows hidden by hand
  5. SUBTOTAL ignores other subtotals
  6. Where SUBTOTAL appears without you typing it
  7. Quick checks without a formula
  8. Limits and common mistakes
  9. Practise it

The Excel SUBTOTAL function calculates a total, count or average of only the rows you can see. When you filter a list, SUM keeps adding the hidden rows, but =SUBTOTAL(109,D2:D11) adds just the visible ones and updates every time the filter changes. This guide is for anyone who filters data and wants totals that match what is on screen.

The examples use a list of 10 expense claims in A1:D11, with the columns Employee, Department, Region and Amount.

What does the Excel SUBTOTAL function do?#

SUBTOTAL runs one of 11 calculations on a range and skips rows hidden by a filter:

Excel formula
=SUBTOTAL(function_num, ref1, [ref2], ...)
  • function_num: a number that picks the calculation, such as 109 for sum.
  • ref1: the range to calculate, like D2:D11. You can add more ranges after it.

It looks like SUM with an extra number in front, and with no filter on it gives the same result as SUM. The difference shows when rows are hidden. If you are new to totals, start with our SUM function guide.

SUBTOTAL function numbers: 9 vs 109#

Each calculation has two numbers. The 1 to 11 set includes rows you hid by hand. The 101 to 111 set skips them. Both sets skip rows hidden by a filter.

CalculationIncludes hand-hidden rowsSkips hand-hidden rows
AVERAGE1101
COUNT (numbers)2102
COUNTA (non-empty)3103
MAX4104
MIN5105
PRODUCT6106
STDEV7107
STDEVP8108
SUM9109
VAR10110
VARP11111

The ones you will use most are 109 (sum), 103 (count non-empty cells), 101 (average) and 104 (largest).

Example: total only the filtered rows#

Filter the expense list to the Sales and Marketing departments with amounts over $1,000. Four rows stay visible:

EmployeeDepartmentAmount
Ana LopezSales$1,250
Chloe KimSales$2,100
Gus MollMarketing$1,480
Jo BrooksMarketing$1,150

Now compare the formulas below the list:

FormulaResultWhat it shows
=SUM(D2:D11)$10,820All 10 claims, hidden or not
=SUBTOTAL(109,D2:D11)$5,980The 4 visible claims
=SUBTOTAL(103,A2:A11)4How many rows are showing
=SUBTOTAL(101,D2:D11)$1,495The average visible claim
=SUBTOTAL(104,D2:D11)$2,100The largest visible claim

Clear the filter and the SUBTOTAL results grow back to the full totals. For counting, use 103 on a column with a value in every row, like the names. 109 on a text column gives 0, because there are no numbers to add. Put these formulas in rows the filter can't hide, above or below the data. Our guide on how to filter data in Excel covers the filter clicks.

9 or 109: rows hidden by hand#

Choose by how rows get hidden. Filtered rows are always skipped. Rows you hide yourself, by right-clicking a row number and choosing Hide, are skipped only by the 100s.

  • Use 109 for a total of "what I can see". This fits most reports.
  • Use 9 if you hide rows only to tidy the view but still want them counted.

When in doubt, use 109. It always matches what is on screen.

SUBTOTAL ignores other subtotals#

SUBTOTAL skips cells in its range that hold other SUBTOTAL formulas, so a grand total never counts a group twice. Say D6 holds =SUBTOTAL(9,D2:D5) for the North group and D10 holds =SUBTOTAL(9,D7:D9) for the South group. A grand total of =SUBTOTAL(9,D2:D10) adds only the original amounts, not the two group subtotals. With SUM, the same range would add everything twice.

This is how Excel's Data > Subtotal command works. It sorts groups, inserts a SUBTOTAL row under each one and adds a grand total, all without double counting. A pivot table can do the same job with more flexibility; see our pivot tables beginner's guide and pivot table subtotals and % of total.

Where SUBTOTAL appears without you typing it#

Excel writes SUBTOTAL for you in two common places:

  • AutoSum on filtered data. Click below a filtered column and press Alt+= (Mac: ⌘⇧T). Excel inserts =SUBTOTAL(9,...) instead of SUM, so the total follows the filter.
  • The Total Row of an Excel table. Turn it on with Table Design > Total Row. The total cell uses =SUBTOTAL(109,[Amount]), and its drop-down switches between Sum, Average, Count and more.

If you need a list of the matching rows rather than a total, the FILTER function can return them in a new place. See FILTER function vs AutoFilter.

Quick checks without a formula#

You don't always need a formula to see a visible total. Select the Amount cells of a filtered list and look at the status bar at the bottom of the window. It shows the Average, Count and Sum of the selected cells that are visible. Right-click the status bar to add Min and Max.

The status bar is great for a quick look, but it disappears when you click elsewhere. Use SUBTOTAL when the number needs to stay on the sheet, appear in a report or feed another formula. When you type =SUBTOTAL( in a cell, Excel shows a list of every function number with its name, so you don't need to memorize the table above.

Limits and common mistakes#

  • Hidden columns are not skipped. SUBTOTAL works on rows. A range across hidden columns is added in full.
  • The formula inside its own range. =SUBTOTAL(109,D2:D13) typed in D13 is a circular reference. Stop the range at the last data row.
  • Errors in the data. One #N/A in the range makes SUBTOTAL return #N/A. AGGREGATE can skip both hidden rows and errors: =AGGREGATE(9,7,D2:D11).
  • Forgetting the number. =SUBTOTAL(D2:D11) is missing function_num. The number always comes first.

Filtering and visible totals are everyday tasks in many admin and office jobs.

Practise it#

SUBTOTAL makes the most sense when you watch it change as you filter. In ExcelReady's filter a table lesson, you filter the expense list from this guide, total the visible rows with SUBTOTAL(109, ...), count them with 103, then clear the filters and watch both numbers grow back. Try the exercise on this page, then practise SUBTOTAL with live filters.

Try it yourself

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

Click D11 and total the amounts in D2:D9 with SUBTOTAL, using 109 so the total would skip any rows hidden by a filter. With no filter on, the result matches SUM.

fx
ABCDE
1
Employee
Department
Region
Amount
2
Ana Lopez
Sales
North
1250
3
Ben Ortiz
Marketing
West
640
4
Chloe Kim
Sales
West
2100
5
Dev Patel
IT
North
980
6
Emma Reed
Finance
East
430
7
Femi Ade
Sales
East
760
8
Gus Moll
Marketing
North
1480
9
Hana Sato
IT
West
1720
10
11
Visible total
12
13
14

Tip: The calculation number goes first, then the range. Don't include row 11 itself.

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.Function guideSUMAdd up columns, rows and separate ranges with Excel's SUM function. Clear examples, common mistakes and a live practice exercise.

Frequently asked questions

What is the difference between SUBTOTAL 9 and 109?

+

Both add up the visible rows of a filtered list. 109 also skips rows you hid by hand (right-click > Hide), while 9 still includes them.

Why does SUM include hidden rows?

+

SUM adds every cell in its range, visible or not. Use =SUBTOTAL(109, range) when you want the total to follow a filter.

How do I count visible rows in Excel?

+

Use =SUBTOTAL(103, range) on a column that has a value in every row, such as names. It counts only the non-empty cells you can see.

Does SUBTOTAL work with hidden columns?

+

No. SUBTOTAL only skips hidden rows. A horizontal range with hidden columns is still added in full.

Why does AutoSum insert SUBTOTAL instead of SUM?

+

When the data is filtered, AutoSum writes =SUBTOTAL(9, ...) so the total follows the filter. You can keep it or change 9 to 109.

Sources

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

Written and checked by the ExcelReady Team. First published October 30, 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. What does the Excel SUBTOTAL function do?
  2. SUBTOTAL function numbers: 9 vs 109
  3. Example: total only the filtered rows
  4. 9 or 109: rows hidden by hand
  5. SUBTOTAL ignores other subtotals
  6. Where SUBTOTAL appears without you typing it
  7. Quick checks without a formula
  8. Limits and common mistakes
  9. Practise it

Keep reading

Data tools· 5 min read

Pivot Tables in Excel: A Beginner's Guide

A pivot table summarizes a long table in a few clicks, without formulas. Click a cell in your data, choose Insert > PivotTable, and click OK to put it on a new sheet. Then drag fields into Rows, Columns and Values: Region in Rows and Sales in Values gives total sales for each region.

Data tools· 6 min read

Pivot Table Tricks: Subtotals, Filters and % of Total

To show a percent of total in a pivot table, click the ▾ on the field in the Values area, choose Value Field Settings, open Show Values As and pick % of Grand Total. Each number then shows its share of the total, and the parts add up to 100%. You can also right-click a value and choose Show Values As.

Data tools· 5 min read

How to Filter Data in Excel (Ctrl+Shift+L)

To filter data in Excel, click any cell in your table and press Ctrl+Shift+L (Mac: ⌘⇧F), or choose Data > Filter. Arrow buttons appear in the header row. Click an arrow, untick (Select All), tick the values you want and click OK. Hidden rows aren't deleted: clear the filter and they come back.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free