How to sum a filtered column in excel
Tutor 5 (37 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To sum only the visible cells in a filtered column, use the SUBTOTAL function.
Use =SUBTOTAL(9, Range) to sum visible cells produced by a filter. Use =SUBTOTAL(109, Range) when you need to ignore rows hidden manually in addition to filtered rows.
Explanation
-
SUBTOTALis designed to operate on lists and tables and ignores rows hidden by Excel's AutoFilter. -
Function number
9tellsSUBTOTALto perform a SUM. Function number109tellsSUBTOTALto perform a SUM and ignore values in rows hidden manually (hidden with right-click → Hide). -
SUBTOTALwill include values in cells that are visible after filtering and will update automatically when the filter changes.
Common formulas (copy-paste into Excel)
-
Sum visible cells in column B (rows 2–100):
=SUBTOTAL(9, B2:B100)
-
Sum visible cells in column B and ignore rows hidden manually:
=SUBTOTAL(109, B2:B100)
What if my data is an Excel Table?
To sum a filtered column inside an Excel Table, use the structured reference form. Example if the Table name is Table1 and the column header is Amount:
=SUBTOTAL(9, Table1[Amount])
or to ignore manual hides:
=SUBTOTAL(109, Table1[Amount])
Are there alternative methods?
Yes. Use AGGREGATE for more control or a SUMPRODUCT + SUBTOTAL combination for special cases.
-
AGGREGATEexample (sums while allowing more ignore-options):=AGGREGATE(9, 5, B2:B100)
-
SUMPRODUCT+SUBTOTALexample (works row-by-row to sum only visible rows):=SUMPRODUCT(SUBTOTAL(3, OFFSET(B2, ROW(B2:B100)-ROW(B2), 0, 1)) * (B2:B100))
Note: AGGREGATE and SUMPRODUCT approaches are advanced. SUBTOTAL is simpler and recommended for ordinary filtering.
Step-by-step: Quick way to do this (numbered)
-
Select any cell inside your data range.
-
Turn on filtering: go to the Data tab and choose Filter (the menu location is the same on Windows and Mac; keyboard shortcuts differ by Excel version).
-
Apply the filter(s) you need so only the rows you want remain visible.
-
Enter the
SUBTOTALformula in a cell where you want the sum (examples above). -
Change filters and watch the
SUBTOTALresult update automatically.
Platform differences (Windows vs Mac)
-
Function behavior:
SUBTOTALandAGGREGATEwork the same on Windows and Mac. -
Menu locations: Data → Filter is the same on both platforms.
-
Keyboard shortcuts: shortcuts for toggling filters differ across Excel versions and platforms; use the menu if unsure.
Troubleshooting
-
Result is larger than expected → Some filtered rows are hidden manually; switch to
SUBTOTAL(109, ...)to ignore manual hides. -
Formula returns 0 but numbers are visible → Confirm numbers are actual numeric values, not text. Convert text numbers to numeric.
-
Summing only part of a filtered column → Ensure the
Rangein theSUBTOTALformula covers exactly the column cells you intend to sum.
Best practice
-
Put the
SUBTOTALresult outside the filtered data range so it does not become part of the filter. -
Use Excel Tables (
Insert → Table) and structured references to make formulas clearer and more robust. -
Use
SUBTOTAL(109, ...)when users might manually hide rows; useSUBTOTAL(9, ...)when only filter hiding is expected.
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
Why are margins not working
Answers · 1
Why is page layout not working
Answers · 1
How to print repeated rows on top in excel
Answers · 1
How to print header on each page
Answers · 1