Formula Errors

How to Make COUNTA, UNIQUE, and FILTER Return Zero for Blank Results in Excel

Huda QurayshiHuda Qurayshi Oct 10, 2026 876 views

Question details

The user needs a combined COUNTA, UNIQUE, and FILTER formula to return exactly 0 or remain blank when there are no qualifying matching results in the dataset.

How to Make COUNTA, UNIQUE, and FILTER Return Zero for Blank Results
Product
Excel
Device & OS
not provided
Scenario
Filtering a dataset for unique values based on multiple conditions and counting the results, especially in cases where no matching data exists.
Observed behavior
The formula returns 1 when no qualifying data exists because COUNTA interprets the empty string returned by the FILTER function as a valid text value.
Before you start

Verify that your version of Excel or spreadsheet software supports dynamic array functions like UNIQUE and FILTER, and double-check your data range references for any typos.

Solution 1Recommended

Use IF and COUNTIFS to Test for Matching Rows First

Prevent the COUNTA function from executing by verifying if any data matches your criteria first using COUNTIFS.

This method involves pre-checking your conditions. If no rows meet your criteria, the IF function immediately outputs 0, bypassing the COUNTA and FILTER operations entirely and avoiding the erroneous '1' result.

1
Select the target cell

Click on the cell where you want to output the counted unique values.

2
Wrap the formula in IF and COUNTIFS

Modify your existing formula by nesting it inside an IF statement that checks your criteria using COUNTIFS first.

3
Enter the formula

Input the following formula: =IF(COUNTIFS('BP Data'!D:D,A3,'BP Data'!G:G,">0")=0, 0, COUNTA(UNIQUE(FILTER('BP Data'!M:M,('BP Data'!D:D=A3)*('BP Data'!G:G>0),""))))

4
Apply the calculation

Press Enter to apply. The cell will now accurately display 0 when there are no qualifying matches.

Use IF and COUNTIFS to Test for Matching Rows First
Efficient Calculation: Testing for matching rows beforehand is highly efficient, especially for large datasets, as it skips heavier array calculations when there are no matches.
Efficiently Handle Dynamic Arrays in WPS Spreadsheet

Master Advanced Formulas with WPS Office

WPS Spreadsheet fully supports modern dynamic array functions like FILTER, UNIQUE, and TOCOL, making it effortless to analyze complex data without error messages. Its seamless interface and robust calculation engine ensure your formulas work exactly as intended.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the document containing your data.
  2. 2. Select the output cell: Click on the cell where you want to calculate your unique counts.
  3. 3. Enter the refined formula: Type your IFERROR or IF-COUNTIFS formula exactly as you would in standard spreadsheet applications.
  4. 4. Calculate instantly: Press Enter. WPS Spreadsheet handles the dynamic array and instantly outputs the accurate count without erroneous '1' results.
Fully compatible with Microsoft Excel formulas and file formats (.xlsx).Built-in support for advanced dynamic arrays (FILTER, UNIQUE, TOCOL).Free and lightweight suite with a clean, intuitive interface.Cross-platform compatibility for Windows, Mac, Linux, iOS, and Android.
QA img-9

Frequently Asked Questions

Why does COUNTA return 1 for a blank FILTER result?

When the FILTER function has no matches and returns an empty text string ("") as instructed by its 'if_empty' argument, COUNTA sees this empty string as a valid non-blank value, thereby returning a count of 1.

What happens if I don't provide a third argument to the FILTER function?

If no matching data is found and the third argument is omitted, the FILTER function returns a #CALC! error. Wrapping your formula in IFERROR can catch this error and turn it into a 0.

Are UNIQUE and FILTER functions available in all spreadsheet versions?

No, dynamic array functions like UNIQUE, FILTER, and TOCOL are available in newer spreadsheet software like modern WPS Office Spreadsheet, Microsoft 365, and Excel 2021 or later. Older versions do not support them natively.