Exceljet

Quick, clean, and to the point

Sum visible rows in a filtered list

Excel formula: Sum visible rows in a filtered list
Generic formula 
=SUBTOTAL(9,range)
Explanation 

If you want to sum only the visible rows in a filtered list (i.e. only those rows not filtered out), you can use the SUBTOTAL function with function number 9 or 109. What makes SUBTOTAL especially useful is that it automatically ignores rows that are hidden in a filtered list or table.

Following the example in the screen above, to sum cells in column F for visible rows only, use:

=SUBTOTAL(9,F5:F14)

If you are hiding rows manually (i.e. right-click, Hide), use this version instead:

=SUBTOTAL(109,F5:F14)

By changing the function number, the SUBTOTAL function can perform many other calculations (e.g. COUNT, SUM, MAX, MIN, etc.). See the full list of function numbers on this page).

Author 
Dave Bruns

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.