Function Problems

How to Return Text Instead of Zero in Excel COUNTIFS Formula

Ayan MasoodAyan Masood Nov 10, 2026 869 views

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.

How to Return Text Instead of Zero from an Excel COUNTIFS Formula
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.
Before you start

Ensure your base COUNTIFS formula is working correctly and accurately returning zero before attempting to modify it or apply custom formatting.

Solution 1Recommended

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.

1
Select the target cell

Click on the cell where you want the counted result or text to appear.

2
Input the LET formula

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.

3
Apply the formula

Press Enter. If the count matches no criteria, the cell will now display 'No Trades' instead of 0.

Use the LET and IF Functions to Replace Zero with Text
Compatibility Note: The LET function is available in newer versions of Excel. If you are using an older version, you will need to use a standard IF statement, calculating the COUNTIFS twice: =IF(COUNTIFS(...)>0, COUNTIFS(...), "text").
WPS Spreadsheet Solution

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. 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your data.
  2. 2. Enter the formula: Select the target cell and input your formula, such as =IF(COUNTIFS(...)>0, COUNTIFS(...), "No Data").
  3. 3. View the customized result: Press Enter to instantly see your custom text displayed instead of a zero when no records match your criteria.
Fully compatible with Microsoft Excel formulas, functions, and file formats.Intuitive interface for managing complex data sets and criteria.Robust custom cell formatting options to display data exactly how you want.Lightweight software that processes large data arrays smoothly and for free.
microsoft office alternative - wps office

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.