What Most People Miss About How SUBTOTAL Formula Works in Excel

It’s 4:47 PM on Friday. Your manager just asked for a consolidated report by 5. You have 12 spreadsheets open and no idea how to combine them. You paste everything into one sheet, apply AutoFilter to show only Q3 sales, and type =SUM(C2:C100). You hit Enter. The number looks right—until you realize it’s summing all rows, including the ones you just filtered out. You panic. Then you remember someone mentioned SUBTOTAL. But what does that 9 or 109 actually mean? And why did your colleague’s version return zero?

The Problem

You’re tracking regional sales across 8 territories. Data is in columns A:E — Territory, Rep Name, Date, Units Sold, Revenue. You’ve applied AutoFilter to show only Q3 entries (July–September 2024), but your =SUM(E2:E100) still includes rows for April and May. Worse: you added manual row hiding to hide test entries (rows 12, 27, and 41), and now SUM counts those too. Your dashboard shows $312,890 — but the filtered view only displays $187,240 worth of visible rows.

TerritoryRep NameDateUnits SoldRevenue
NorthwestSarah Chen2024-07-1242$14,360
SoutheastJames Lopez2024-08-0331$10,570
MidwestAmina Patel2024-07-2956$19,150
NortheastDavid Kim2024-09-0528$9,580
SouthwestLena Torres2024-08-1749$16,760
NorthwestSarah Chen2024-06-1433$11,290
MidwestAmina Patel2024-09-2261$20,860
NortheastDavid Kim2024-05-3022$7,520

That last row? It’s May — not Q3 — and shouldn’t be included. But SUM(E2:E9) doesn’t care. It adds every cell in the range. And if you manually hid row 6 (the June entry), SUM still includes it. That’s the core frustration: Excel’s basic functions ignore visibility state entirely.

The Solution

SUBTOTAL fixes this — but only if you use the right function number and understand its dual behavior. It’s not magic. It’s arithmetic with context awareness.

  1. Type =SUBTOTAL(9,E2:E9) in cell E11. The 9 tells Excel to run SUM, but with one critical rule: skip hidden rows (both filtered and manually hidden).
  2. Apply AutoFilter to column C (Date). Click the dropdown → Custom Filter → “is after or equal to” 2024-07-01 and “is before or equal to” 2024-09-30. Rows for May and June disappear visually.
  3. Check E11. It now shows $81,270 — the sum of only the 5 visible Q3 rows. Not $93,090 (the full SUM).
  4. Now manually hide row 7 (Amina Patel’s July 29 entry). Press Ctrl+9. Watch E11 drop to $62,120. SUBTOTAL(9,…) respects both filter and manual hide.
What You DidFormula UsedResultShortcut
Initial full-range sum=SUM(E2:E9)$93,090
After Q3 filter applied=SUBTOTAL(9,E2:E9)$81,270Alt+= (then edit)
After hiding row 7=SUBTOTAL(9,E2:E9)$62,120Ctrl+9
Same filter + SUBTOTAL(109,E2:E9)=SUBTOTAL(109,E2:E9)$81,270Alt+M, U, S (for Subtotal dialog)

Here’s the counterintuitive part: 9 and 109 both do SUM — but 109 ignores only filtered rows, not manually hidden ones. So if you hide row 7 manually, SUBTOTAL(109,…) still includes it. Use 9 if you need full visibility-awareness. Use 109 only when you want to ignore filters but keep manually hidden rows in the math.

Going Further

You can nest SUBTOTAL inside other formulas. Try this in F2: =IF(SUBTOTAL(103,A2:A9)>1,"Multiple reps","Single rep"). 103 counts visible non-blank cells in column A — perfect for dynamic headers. Or combine with AVERAGE: =SUBTOTAL(1,E2:E9) (1 = AVERAGE) gives you the average of visible rows only.

Need running totals that respect filters? Put =SUBTOTAL(9,$E$2:E2) in F2 and drag down. Each row sums only visible rows from the top down to itself. Yes — it works even with filters active.

One more trick: If you use Excel Tables (Ctrl+T), SUBTOTAL automatically appears in the Total Row. Right-click any cell in the table → “Table → Total Row”. Click the dropdown in the total cell and pick “Sum”. Excel inserts SUBTOTAL(109,…) — because Tables don’t support manual row hiding, so 109 is safer.

When NOT to Use This

Don’t use SUBTOTAL if you’re aggregating data across multiple worksheets. SUBTOTAL won’t work in 3D references like SUBTOTAL(9,Sheet1:Sheet3!E2:E9) — Excel returns #VALUE!. Use SUM or SUMIFS instead.

Avoid SUBTOTAL inside array formulas (pre-Excel 365). It breaks. In older versions, =SUBTOTAL(9,IF(A2:A9="Northwest",E2:E9)) returns an error. Use SUMPRODUCT or SUMIFS for conditional visible-only sums.

And never use SUBTOTAL(9,…) on a range that includes another SUBTOTAL result. It double-counts. If row 10 already has =SUBTOTAL(9,E2:E9), don’t then write =SUBTOTAL(9,E2:E10). Excel treats nested SUBTOTALs as regular numbers — no recursion protection.

Keyboard Shortcuts

ActionShortcutNotes
Insert AutoSum (then edit to SUBTOTAL)Alt+=Press again to cycle through SUM, AVERAGE, COUNT — then type “SUBTOTAL”
Hide selected rowsCtrl+9Critical for testing SUBTOTAL(9) vs (109)
Open Subtotal dialog (for grouped data)Alt+M, U, SOnly works on sorted, grouped ranges — not for simple visibility-aware sums
Toggle AutoFilterCtrl+Shift+LFast way to test visible-row behavior
Emily Watson

Emily Watson

Emily is an expert in workplace culture and team dynamics. Her articles help professionals navigate interpersonal challenges and build better coworker relationships.