How to sum only filtered or visible cells in Excel?

Maybe it is easy for you to sum a column of numbers in Excel, but sometimes you need to filter or hide some data to meet your criteria. After hiding or filtering, and now you just want to add up only the filtered or visible values. If you apply the Sum function in Excel, all the values including the hidden data will be added, in this case, how could you sum only the filtered or visible cell values in Excel?

Sum only filtered or visible cell values with formula

Sum only filtered or visible cell values with User Defined Function

Sum/Count/Average only filtered or visible cells with Kutools for Excel

Sum/Count/Average visible cells only in a specified range with ignoring hidden or filtered cells/rows/columns

The normally SUM/Count/Average function will count all cells in the specified range on matter cells are hidden/filtered or not. While the Subtotal function can only sum/count/average with ignoring hidden rows. However, Kutools for Excel SUMVISIBLE/COUNTVISIBLE/AVERAGEVISIBLE functions will easily calculate the specified range with ignoring any hidden cells, rows, or columns. See screenshot:

ad sum count average visible cells only

Kutools for Excel includes more than 120 handy Excel tools. Free to try with no limitation in 30 days. Read More      Free Download Now

Recommended Productivity Software

Office Tab: Use tabbed interface in Office as the use of web browser Chrome, Firefox and Internet Explorer.
Kutools for Excel: Adds 120 powerful new features to Excel. Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Brings back your familiar menus to Office 2007, 2010, 2013 and 2016 (includes Office 365).

arrow blue right bubbleSum only filtered or visible cell values with formula


With this SUBTOTAL function which ignores rows that have been excluded by a filter, you can easily add up only the visible cells. You can do as this:

Supposing you have a range of data, and they have been filtered as you need, see screenshot:

doc-sum-visible-cells1

1. In a blank cell, C13 for example, enter this formula: =Subtotal(109,C2:C12), see screenshot:

doc-sum-visible-cells2

2. Then press Enter key and the subtotal value of only the filtered data has been worked out.

Notes:

1. The number 109 in the above formula is indicated that when you sum the numbers, the hidden values will be ignored.

2. This formula also can help you sum only the visible cells if there are hidden rows in your worksheet.


arrow blue right bubbleSum only filtered or visible cell values with User Defined Function

If you are interested in the following code, it also can help you to sum only the visible cells.

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module window.

Function SumVisible(WorkRng As Range) As Double
'Update 20130907
Dim rng As Range
Dim total As Double
For Each rng In WorkRng
    If rng.Rows.Hidden = False And rng.Columns.Hidden = False Then
        total = total + rng.Value
    End If
Next
SumVisible = total
End Function

3. Save this code and enter the formula =SumVisible(C2:C12) into a blank cell. See screenshot:

doc-sum-visible-cells3 doc-sum-visible-cells4

4. Then press Enter key and you will get the result that you want.


arrow blue right bubble Sum/Count/Average only filtered or visible cells with Kutools for Excel

If you have Kutools for Excel installed, you can quickly calculate the sum/count/average only visible or filtered out cells in Excel easily.

Kutools for Excel - Combines More Than 120 Advanced Functions and Tools for Microsoft Excel

doc sum visible cell 4

For example you want to sum only visible cells only, please select the cell you will place the summing result at, type the formula =SUMVISIBLE(C3:C12) (C3:C13 is the range where you will sum only visible cells) into it, and press the Enter key. See left screenshot:

For counting only visible cells, please apply this formula =COUNTVISIBLE(C3:C12);

For averaging only visible cells, please apply this formula =AVERAGEVISIBLE(C3:C12).

And then the summing result is calculated with ignoring all hidden cells. See screenshot:

doc sum visible cell 3

Note: If you can't remember the formulas exactly, you can following below steps to sum/count/average only visible cells easily:

1. Select the cell you will place the summing result into, and click Kutools > Functions > Statistical & Math > SUMVISIBLE (or AVERAGEVISBLE, COUNTVISIBLE as you need). See screenshot:

2. In the opening Function Arguments dialog box, please specify the range where you will sum ignoring hidden cells, and click the OK button. See screenshot:

doc sum visible cell 2

And then the summing result is calculated with ignoring all hidden cells. See screenshot:


Easily sum/count only filtered out/visible cells by deleting hidden rows in Excel

When summing/counting filtered out cells in Excel, the SUM function or Count function will not ignore hidden cells. If hidden/filtered rows are removed, we can only sum or count visible cells easily. You can try Kutools for Excel's Delete Hidden (Visible) Rows & Columns utility to solve it.

ad delete hidden rows columns 3

Kutools for Excel includes more than 120 handy Excel tools. Free to try with no limitation in 30 days. Read More      Free Download Now

arrow blue right bubbleRelated articles:

How to sum the absolute values in Excel?

How to quickly sum every other or nth row/column in Excel?


Is your problem solved?

Recommended Productivity Tools

The following tools will greatly save your time and effort, which one do you prefer?
Office Tab: Using handy tabs in your Office, as the way of Chrome, Firefox and New Internet Explorer.
Kutools for Excel: 120 powerful new functions for Excel, Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Bring back familiar menus to Office 2007, 2010, 2013 and 365, as if it were Office 2000 and 2003.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 More than 120 powerful advanced functions which designed for Excel:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more     btn download     btn purchase

Add comment


Security code
Refresh