Skip to main content

How to sum visible cells only based on criteria in Excel?

Author: Xiaoyang Last Modified: 2024-12-12

In Excel, it may be easy for us to sum cells based on criteria with the SUMIFS function. However, if there is a range of filtered data, to sum the visible cells only with one or more criteria as below screenshot shown, how could you achieve this task in Excel?


Sum visible cells only based on one or more criteria with helper column

To get the total values of the visible cells only based on one or more criteria, you can create a formula helper column first, and then apply the SUMIFS function to get the total result.

For example, to get the total order of the product Hoodie in the filtered range, please do as this:

1. Enter or copy the following formula into a blank cell beside your data range, and then drag the fill handle down to fill this formula to other visible cells, see screenshot:

=AGGREGATE(9,5,D4)

A screenshot of Excel illustrating the use of the AGGREGATE formula to calculate visible cell values

2. After getting the visible values of column D, you should use the below SUMIFS function to get the total value, see screenshot:

=SUMIFS(E2:E12,A2:A12,A17)
Note: In the above formula, E2:E12 represents the helper column created in step 1 that you want to sum; A2:A12 is the criteria range, and A17 is the condition applied to the criteria range.

A screenshot of Excel demonstrating the SUMIFS formula summing visible cells based on criteria

Tips: If you want to sum the visible cells based on more criteria, such as to get the total order of the product Hoodie which is red, please apply the below formula:
=SUMIFS(E2:E12,A2:A12,A17,C2:C12,B17)

A screenshot of Excel showing the SUMIFS formula applied with multiple criteria for summing visible cells

If there are more criteria need to be added, you just need to join the criteria within the SUMIFS function like this: =SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], [criteria_range3, criteria3], ...)


Sum visible cells only based on criteria with formula

You can also create a formula based on the SUMPRODUCT, SUBTOTAL, OFFSET, ROW and MIN functions together to sum visible cells based on one or more criteria in Excel.

Please copy or enter the below formula into a blank cell to output the result, and then press Enter key to get the result, see screenshot:

=SUMPRODUCT(SUBTOTAL(3,OFFSET(A2:A12,ROW(A2:A12)-MIN(ROW(A2:A12)),,1)),(A2:A12=A17)*(D2:D12))

A screenshot of Excel using a SUMPRODUCT formula to sum visible cells based on criteria

Note: In the above formula, A2:A12=A17 is the criteria range and criteria that you want to use, and D2:D12 is the sum range that you want to sum.
Tips: To sum the visible cells based on multiple criteria, you just need to add the criteria like this: =SUMPRODUCT(SUBTOTAL(3,OFFSET(reference,ROW(reference)-MIN(ROW(reference)),,1)),(criteria_range1=criteria1)*(criteria_range2=criteria2)*(criteria_range3=criteria3)*(sum_range)).

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!