How to Return Text Instead of Zero in Excel COUNTIFS Formula
Question details
The user wants to display a specific text string instead of the default '0' when an Excel COUNTIFS formula finds no matching records.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Counting records based on specific criteria where no matches are found, which results in an output of zero.
- Observed behavior
- The COUNTIFS function returns a numeric 0, but the user prefers to display a custom text message to make the spreadsheet more readable.
Ensure your base COUNTIFS formula is working correctly and accurately returning zero before attempting to modify it or apply custom formatting.
Use the LET and IF Functions to Replace Zero with Text
Wrap your COUNTIFS function in a LET and IF statement to dynamically output text when the count is zero without calculating the formula twice.
The LET function allows you to assign the result of your COUNTIFS formula to a variable (e.g., 'c'). You can then use the IF function to evaluate that variable. If 'c' is greater than zero, it returns the numeric count; if it is zero, it returns your specified text.
Click on the cell where you want the counted result or text to appear.
Enter the formula using the LET function. For example: =LET(c, COUNTIFS(Trades!$R$5:$R$1099, D37, Trades!$O$5:$O$1099, ">0"), IF(c, c, "No Trades")). Replace the ranges, criteria, and text with your own data.
Press Enter. If the count matches no criteria, the cell will now display 'No Trades' instead of 0.

Apply Custom Number Formatting to Display Zero as Text
Change the cell format to display custom text when the value is exactly zero, keeping the underlying value numeric for future calculations.
Easily Manage Formulas and Data Formatting in WPS Office
WPS Spreadsheet offers full support for advanced formulas like COUNTIFS and IF, as well as powerful custom cell formatting to make your data presentable and easy to read.
- 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your data.
- 2. Enter the formula: Select the target cell and input your formula, such as =IF(COUNTIFS(...)>0, COUNTIFS(...), "No Data").
- 3. View the customized result: Press Enter to instantly see your custom text displayed instead of a zero when no records match your criteria.

Frequently Asked Questions
Can I use the IF function without LET to achieve this?
Yes, you can use a standard IF function like =IF(COUNTIFS(range, criteria)=0, "text", COUNTIFS(range, criteria)). However, this requires the program to calculate the COUNTIFS formula twice, which might slow down performance on very large datasets.
Will the custom number formatting method affect my other formulas referencing this cell?
No. When you use the custom number format General;General;"text", the underlying value of the cell remains a numeric 0. Any other mathematical formulas referencing this cell will still treat it as 0.
Why is my COUNTIFS formula returning a #NAME? error when using LET?
The #NAME? error usually occurs if your spreadsheet software version does not support the LET function. If you encounter this error, switch to the standard IF method or use custom cell formatting instead.
Can I hide the zero completely instead of showing text?
Yes. You can hide zeros by applying the custom number format 0;-0;;@ in the Format Cells dialog, or by going to your worksheet settings and unchecking the option to show a zero in cells that have zero value.




