What Most People Miss About the Subtotal Command in Excel

Yes, you can use the SUBTOTAL command in Excel to sum filtered data. But if you’re typing =SUBTOTAL(9,A2:A1000) without understanding function numbers or hiding rows manually, you’ll get wrong totals every time.

The Problem

You’ve got sales data in A1:E27—names, regions, dates, units sold, and revenue. Someone applied AutoFilter on Region, then hid rows manually (Ctrl+9) to ‘clean up’ the view. You slap =SUM(E2:E27) in E28. It returns $312,480. But only 12 rows are visible—and three of them are hidden by filter, not row hiding. Your total includes $67,210 from inactive regions. Worse: your colleague copies that SUM down to a report tab, and no one notices until finance flags a $42K variance.

NameRegionDateUnitsRevenue
Sarah ChenAPAC2024-03-1514$18,200
James OkaforEMEA2024-03-169$12,600
Maya PatelNA2024-03-1722$29,700
Diego RuizLATAM2024-03-187$8,400
Aiko TanakaAPAC2024-03-1919$25,650
Liam ByrneEMEA2024-03-2013$17,550
Nina DuboisNA2024-03-2116$21,600
Tariq HassanMENA2024-03-2211$14,850
Elena PetrovaEMEA2024-03-238$10,800
Rajiv MehtaAPAC2024-03-2425$33,750

This table shows raw data—no filters, no hidden rows. Yet most users apply =SUM(E2:E11) here and call it done. That’s fine… until they filter for APAC only and forget to update the formula.

The Solution

  1. Select your data range (A1:E11). Press Alt + A + T — this opens the Subtotal dialog.
  2. In 'At each change in', pick Region (column B).
  3. In 'Use function', choose Sum.
  4. In 'Add subtotal to', check Revenue (column E).
  5. Uncheck 'Replace current subtotals' if you’re testing. Click OK.

Excel inserts outline rows with collapsible groups and automatic =SUBTOTAL(9,E2:E11) formulas. These ignore hidden rows—even ones hidden by filters. Try filtering Region = APAC now. The subtotal at the bottom updates to $77,600. Not $312,480. Not $124,350. Exactly what’s visible.

RegionRevenueSubtotal
APAC$18,200
APAC$25,650$77,600
APAC$33,750
EMEA$12,600$40,950
EMEA$17,550
EMEA$10,800$40,950
NA$29,700
NA$21,600$51,300
Total$170,850

That final $170,850? It’s =SUBTOTAL(9,E2:E11). It updates instantly when you collapse APAC or hide rows with Ctrl+9. No manual edits. No errors.

Going Further

You don’t need the dialog box. Type =SUBTOTAL(9,E2:E11) directly into any cell. Function number 9 = SUM. Use 1 for AVERAGE, 2 for COUNT, 4 for MAX, 5 for MIN, 109 for SUM ignoring hidden rows *and* manually hidden rows (not just filtered ones). Yes—109 is different from 9. Most people miss that.

Try this: Hide row 5 manually (right-click → Hide), then apply filter for EMEA. With =SUBTOTAL(9,E2:E11), row 5 stays excluded. With =SUBTOTAL(109,E2:E11), it’s still excluded—but if you unhide row 5 *and* clear the filter, both return identical results. 109 is safer for reports where users might hide rows outside filters.

You can nest SUBTOTAL inside IF: =IF(SUBTOTAL(103,A2:A11)>0,SUBTOTAL(9,E2:E11),"No data"). 103 counts visible cells — useful for dynamic headers.

When NOT to Use This

Don’t use SUBTOTAL on non-contiguous ranges. =SUBTOTAL(9,A2:A5,C2:C5) returns #VALUE!. Excel doesn’t support it.

Avoid it in tables with merged cells. If column B has merged Region headers spanning 3 rows, SUBTOTAL fails silently—or worse, returns zero. Unmerge first.

Never use it in shared workbooks with Track Changes enabled. SUBTOTAL formulas break when multiple users edit simultaneously. Switch to AGGREGATE instead—it’s more stable and supports error ignoring.

If your data has blanks in the grouping column (e.g., empty Region cells), SUBTOTAL treats them as a separate group. That creates phantom subtotals. Clean missing values first with =IF(B2="","Unknown",B2).

Keyboard Shortcuts

ActionShortcutNotes
Open Subtotal dialogAlt + A + TWorks only when data is selected
Hide selected rowsCtrl + 9SUBTOTAL(109) respects this; 9 does not
Toggle outline levelsAlt + Shift + 0–90 = show all, 1 = top level only
Recalculate all formulasF9Critical after filtering—SUBTOTAL updates live, but F9 forces refresh
David Park

David Park

David brings deep expertise in office supply evaluation and procurement. He has tested hundreds of products to help teams make informed purchasing decisions.