Function Problems

How to Count Only Visible Filtered Rows with Multiple Criteria in Excel

Bushra ParveenBushra Parveen Nov 11, 2026 869 views

Question details

The user needs to count specific data rows using multiple criteria while exclusively evaluating visible rows and ignoring those hidden by filters.

How to Count Only Visible Filtered Rows with Multiple Criteria
Product
Spreadsheets
Device & OS
not provided
Scenario
Counting data matching multiple specific conditions after applying column filters.
Observed behavior
Standard functions like COUNTIFS include hidden and filtered-out rows in their calculation, resulting in an inaccurate count of the currently displayed data.
Before you start

Ensure your data ranges are identical in size across your formulas, and verify that your target criteria are correctly spelled before applying the array formula.

Solution 1Recommended

Use SUMPRODUCT combined with SUBTOTAL and OFFSET

This method replaces COUNTIFS by creating an array formula that checks both your specific conditions and the visibility status of each row.

Because COUNTIFS evaluates an entire range regardless of row visibility, you must use a combination of functions to achieve this. The SUBTOTAL function can ignore hidden rows (using argument 103), while OFFSET feeds it one row at a time. SUMPRODUCT then multiplies these visibility results against your custom criteria.

1
Select the destination cell

Click on the cell where you want the final visible row count to be displayed.

2
Input the array formula

Type the formula: =SUMPRODUCT(($A$12:$A$400="sample1")*(DM$12:DM$400>0)*SUBTOTAL(103,OFFSET($A$12,ROW($A$12:$A$400)-ROW($A$12),0)))

3
Adjust the first criterion

Modify the range $A$12:$A$400 to match your first data column, and change "sample1" to the specific text or value you want to match.

4
Adjust the second criterion

Modify the range DM$12:DM$400 to match your second data column, and adjust >0 to your desired numerical or text condition.

5
Calculate the result

Press Enter. The formula will immediately calculate the count of rows that meet both criteria and are currently visible.

Understanding the 103 Argument: The number 103 in the SUBTOTAL function specifies a COUNTA operation that strictly excludes any hidden or filtered rows, making it the critical component for this calculation.
Seamless Formula Compatibility

Efficiently Manage Complex Formulas with WPS Spreadsheet

WPS Spreadsheet fully supports advanced array formulas, including SUMPRODUCT, SUBTOTAL, and OFFSET, allowing you to seamlessly analyze complex, filtered datasets without worrying about formula errors.

  1. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your spreadsheet file containing the filtered data.
  2. 2. Apply your data filters: Navigate to the 'Data' tab and use the 'Filter' tool to hide rows you do not want to see.
  3. 3. Enter the SUMPRODUCT formula: Paste your tailored SUMPRODUCT and SUBTOTAL formula into an empty cell just as you would in standard spreadsheet software.
  4. 4. Instantly analyze data: Hit Enter to calculate. The results will dynamically update whenever you change your filter settings.
Fully compatible with Microsoft Excel formulas and advanced array functions.Smooth performance when processing complex logic on large datasets.Familiar user interface that requires no new learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the COUNTIFS function ignore filtered rows automatically?

The COUNTIFS function is designed to evaluate the physical contents of the cells within a defined range. It does not possess a built-in mechanism to check the display status (hidden or visible) of those cells, which is why SUBTOTAL is needed.

Does this formula work for rows hidden manually rather than by filters?

Yes. By using the function argument 103 inside the SUBTOTAL formula, it guarantees that both filtered-out rows and manually hidden rows are excluded from the calculation.

Can I use whole column references like A:A in this formula?

It is not recommended. Array formulas utilizing SUMPRODUCT and OFFSET evaluate cell by cell. Using entire column references (e.g., A:A) forces the spreadsheet to calculate over a million rows, which can significantly slow down performance. Always use specific ranges like $A$12:$A$400.