Function Problems

How to Count Nonblank FILTER Results Without Empty Strings in Excel

Muhammad TalhaMuhammad Talha Nov 2, 2026 869 views

Question details

The user wants to count the number of valid records returned by the FILTER function without mistakenly counting empty text strings or error values.

How to Count Nonblank FILTER Results Without Counting Empty Strings
Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Counting filtered data records where the if_empty argument of the FILTER function returns an empty string, which usually trips up standard counting formulas.
Observed behavior
The COUNTA function evaluates an empty string ("") or an error as a valid entry, incorrectly returning 1 even when the FILTER function finds no matching records.
Before you start

Ensure that your data ranges and criteria ranges have the exact same dimensions before nesting the FILTER function inside other formulas. This prevents #CALC! or #VALUE! errors that can skew your counting results.

Solution 1Recommended

Use IFERROR to Handle Empty Results with COUNTA and FILTER

Wrap your COUNTA and FILTER combination inside an IFERROR function to return exactly 0 when no matching records are found.

The most robust way to solve this issue is by intentionally omitting the if_empty argument in your FILTER function. By doing this, FILTER will return an error when it finds no matches. We can then use IFERROR to catch that error and force the formula to output 0 instead of counting an empty string.

1
Select the target cell

Click on the blank cell where you want the final count of your filtered records to be displayed.

2
Enter the base FILTER function

Write your basic FILTER function without the if_empty argument. For example: FILTER(A2:A10, B2:B10="Criteria"). This ensures the formula returns an error if no records match.

3
Wrap with the COUNTA function

Enclose the FILTER function within a COUNTA function to count the returned array of items. Type: COUNTA(FILTER(A2:A10, B2:B10="Criteria")).

4
Add IFERROR to catch zero matches

Finally, wrap the entire formula in IFERROR to output a zero if the FILTER fails to find matches. The final formula should look like this: =IFERROR(COUNTA(FILTER(A2:A10, B2:B10="Criteria")), 0).

5
Confirm the formula

Press Enter to apply. If required by a legacy Excel version, press Ctrl+Shift+Enter to evaluate it as an array formula.

Use IFERROR to Handle Empty Results with COUNTA and FILTER
Formula Breakdown: By omitting the if_empty argument in FILTER, it naturally generates an error when no matches exist. IFERROR catches this and cleanly returns 0, avoiding COUNTA's flaw of counting empty strings.
Advanced Spreadsheets

Easily Analyze Data with Array Functions in WPS Spreadsheet

WPS Spreadsheet offers full support for advanced dynamic array functions like FILTER, COUNTA, and IFERROR, allowing you to seamlessly process complex data structures without compatibility issues.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook containing the data to be filtered.
  2. 2. Input your data: Ensure your dataset is organized in clear columns without merged cells.
  3. 3. Apply the nested formula: Type =IFERROR(COUNTA(FILTER(range, criteria)), 0) in your desired results cell and press Enter. WPS Spreadsheet handles the dynamic array automatically.
100% compatible with Microsoft Excel array formulas.Supports dynamic arrays natively, eliminating the need for Ctrl+Shift+Enter.Lightweight and fast, even with large datasets and complex calculations.Free to download with a highly intuitive user interface.
QA img-9

Frequently Asked Questions

Why does COUNTA return 1 when FILTER finds no matches?

When the FILTER function doesn't find any matches and uses an empty string ("") as its if_empty argument, COUNTA sees this empty text string as a valid, non-blank entry and counts it as 1. COUNTA counts any cell that is not completely empty, including formulas that return empty text.

Can I use COUNTBLANK instead of COUNTA to solve this?

No, COUNTBLANK specifically counts empty cells in a specified range. To count the number of valid records returned by a FILTER array, you need to count non-blank cells, which is exactly what COUNTA does, provided you use an error-handling wrapper like IFERROR to bypass the empty string issue.

Do I need to press Ctrl+Shift+Enter for the FILTER function?

In newer versions of Excel (Microsoft 365) and WPS Office that natively support dynamic arrays, you only need to press Enter. However, in older versions or specific legacy setups, you may need to press Ctrl+Shift+Enter to evaluate nested array formulas correctly.

What happens if my ranges in the FILTER function have different dimensions?

The FILTER function requires the return array and the criteria array to have matching row dimensions. If they differ, the formula will return a #VALUE! error. If you are using the IFERROR wrapper, it will catch this error and output 0, potentially masking your dimensional mistake. Always ensure your ranges align perfectly.