Tutor 5 (55 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Summing filtered data in Excel requires using functions that ignore hidden rows created by filters. Standard SUM formulas include all cells, even those hidden by a filter. The correct approach is to use the SUBTOTAL function or AGGREGATE function.
1. Using the SUBTOTAL Function
SUBTOTAL calculates values only for visible cells after applying a filter. It can perform sums, averages, counts, and more.
Syntax:
SUBTOTAL(function_num, ref1, [ref2], ...)
-
function_numdetermines the calculation type. -
ref1, ref2are the ranges to sum.
For summing visible data, use 109 as function_num:
=SUBTOTAL(109, B2:B50)
-
109ignores hidden rows from filters. -
B2:B50is the range of values to sum.
Example:
If column B contains sales amounts and you filter by product category, the formula will sum only the visible rows for the selected category.
2. Using the AGGREGATE Function
AGGREGATE is more flexible than SUBTOTAL and can ignore errors and hidden rows simultaneously.
Syntax:
AGGREGATE(function_num, options, array, [k])
-
function_numspecifies the calculation.9is for sum. -
optionsdefine behavior.5ignores hidden rows only. -
arrayis the data range.
Example:
=AGGREGATE(9, 5, B2:B50)
-
9→ SUM -
5→ Ignore hidden rows -
B2:B50→ Values to sum
This formula sums only the visible rows after filtering.
3. Key Points to Remember
-
SUBTOTALignores rows hidden by filters automatically. -
AGGREGATEcan handle errors and hidden rows with more options. -
Both formulas do not require manual adjustments when filters change.
-
Standard
SUMincludes hidden rows and will not reflect filtered results.
4. Example Scenario
Suppose you have a sales report for multiple regions in column A, and sales amounts in column B. You filter to show only the “West” region.
-
Using:
=SUM(B2:B50)
Will sum all regions, not just the “West.”
-
Using:
=SUBTOTAL(109, B2:B50)
Will sum only the visible “West” sales.
This method ensures accuracy in filtered data calculations.
You can apply these formulas to any numeric data table where filtering is required, ensuring correct totals without manual calculations.
. Was this Helpful?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 is today function not working
Answers · 1
How to extract date from datetime in excel
Answers · 1
Why is the date value not working
Answers · 1
How to create a date formula
Answers · 1