
Excel Filtered Sum — How to Accurately Add Only Visible Values
When you need an Excel filtered sum, use SUBTOTAL or AGGREGATE. Here are solutions for each situation, including excluding hidden rows, ignoring errors, and conditional sums.
Quick Fix: 90 Seconds
=SUBTOTAL(9, D2:D999)
=SUBTOTAL(109, D2:D999)
=AGGREGATE(9, 6, D2:D999)
How SUBTOTAL Works (9 vs. 109)
9 calculates a sum, while 109 also excludes manually hidden rows. Use SUBTOTAL consistently for totals in filtered ranges.
Ignore Errors with AGGREGATE
=AGGREGATE(9,6,D2:D999)
Sum Only Visible Values with Criteria
=SUMPRODUCT(SUBTOTAL(103,OFFSET($A$2,ROW(A2:A999)-ROW($A$2),0))*($B$2:$B$999="Seoul")*($D$2:$D$999))
Automatically Expand with Tables and PivotTables
- Table Total Row: Ctrl+T → Table Design > Total Row.
- PivotTable: Insert a PivotTable using the table as the source, then set the value field to Sum.
Practical Examples
// Sum of visible amounts
=SUBTOTAL(109, D2:D999)
// Sum of visible values while ignoring errors
=AGGREGATE(9, 6, D2:D999)
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Total does not change | Using SUM | Use SUBTOTAL or AGGREGATE |
| Includes manually hidden rows | Using 9 | Change to 109 |
| Fails because of an error | #DIV/0! or similar | Use AGGREGATE(9,6,range) |
| Need a conditional sum | SUBTOTAL alone is limited | Use SUMPRODUCT+SUBTOTAL(103) |
| New rows are omitted | Fixed range | Use a table (Ctrl+T) or PivotTable |
Related Posts
- TEXTSPLIT Preprocessing
- Automatically Expand When Adding Data
- Get Started with PivotTables in 10 Minutes
- SUMIFS and AVERAGEIFS Patterns
- Print an Excel Worksheet on One Page