Sum the Visible Rows from a Filtered List in Excel

Add to Favorites

How to SUM only the visible rows from a filtered data set in Excel.

To do this, we will use the SUBTOTAL() function.



Example - Filtered Data

Example - Exclude Manually Hidden Rows



=SUBTOTAL(9, range_to_sum)

9 tells the function to perform a sum.

range_to_sum is the range that you want to sum.

Example - Filtered Data


This sums all visible values from a filtered list or table for the range B4:B8.




If I remove or change the filter, watch how the total will update:



This is the beauty of this function; it works with your filtered data sets.

Example - Exclude Manually Hidden Rows

The above function only works on data that is being filtered. It does NOT work on rows that are manually hidden (right-click a row and then click Hide).

To exclude data that is also manually hidden, we change the function to this:


109 this was a 9 in the first example. Changing this to 109 means that rows that are hidden via a filter and also via manually hiding the row will now not show up in the sum.

B4:B8 this is still just the range to sum.


The SUBTOTAL function allows you to apply a number of regular functions to filtered data, for a full list and explanation, view our tutorial on the SUBTOTAL function in Excel.

Make sure to download the file for this tutorial so you can work with the above examples in Excel.

Excel Function: SUBTOTAL()
Downloadable Files: Excel File

Question? Ask it in our Excel Forum

Our Excel Courses

  • Skill Level: All Levels
  • |
  • 5 hours+

How to make a fully featured professional form in Excel that is unbreakable. This includes how to use the form to store, view, edit, and delete data from a data storage worksheet.

  • Skill Level: All Levels
  • |
  • 2 hours

Send Emails from Excel using VBA and Macros. This course starts from the Basics and builds up to more advanced examples with attaching workbooks, worksheets, PDF's, automatically sending emails, including a signature, error handling, increasing speed, and more.

Similar Content on TeachExcel
Average the Visible Rows in a Filtered List in Excel
Tutorial: Average the results from a filtered list in Excel. This method averages only the visible ...
MAX and MIN Values from a Filtered List in Excel
Tutorial: How to get the MAX and MIN values from a filtered data set. This method returns the value ...
Count the Visible Rows in a Filtered List in Excel
Tutorial: How to use the COUNT or COUNTA function on a filtered list of data so that hidden rows ar...
Filter Data to Show the Top 10 Items from a Data Set in Excel - AutoFilter
Macro: This Excel macro filters data in Excel in order to display the top 10 items from the data ...
Extract a Word from a Sentence / Cell in Excel with this UDF - Allows for a User-Defined Delimiter
Macro: Extract whole words from a cell or sentence in Excel with this UDF. This allows you to spe...
SUBTOTAL Function - Work on Filtered Data in Excel
Tutorial: Perform basic functions on a filtered dataset in excel, including SUM, AVERAGE, COUNT, COU...