Fix COUNTIFS Returning Zero for a Linked Excel Workbook
Question details
The user needs to troubleshoot a COUNTIFS formula that returns zero when matching data across Excel worksheets or workbooks.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Counting records against criteria stored in another worksheet or linked workbook.
- Observed behavior
- The COUNTIFS formula returns zero instead of the expected count.
Identify the cells containing the COUNTIFS formula, its criteria, and the data being counted. Open both workbooks if the formula uses an external reference.
Normalize the values and criteria being compared
Use this approach when apparently matching values differ in type, length, or hidden characters.
In empty cells, use formulas such as =ISTEXT(A2), =ISNUMBER(A2), and =LEN(A2) on a source value and its corresponding criterion. Compare the results for unexpected differences.
In a blank helper column, enter =TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))) and fill it down. Apply the same cleanup to the matching criteria, adjusting A2 to the relevant cell.
If the values should be numbers, use =IFERROR(VALUE(A2),A2) in a helper column and fill it down. Keep identifiers with meaningful leading zeros as text instead.
Edit the COUNTIFS formula to reference the cleaned helper range and cleaned criterion, then press Enter to check the result.

Verify the linked workbook and COUNTIFS ranges
Use this approach to rule out incorrect references, unavailable source data, or mismatched range dimensions.
Review COUNTIFS Data in WPS Spreadsheet
WPS Office is a free, lightweight Office alternative with a familiar spreadsheet interface. Open compatible Excel files to review formulas and data as you migrate, although it does not repair Microsoft Excel itself.

Frequently Asked Questions
Why does COUNTIFS return zero when values look the same?
The values may contain hidden spaces or characters, or one may be stored as text and the other as a number. Use LEN, ISTEXT, and ISNUMBER in empty cells to compare them, then clean or convert values as appropriate.
Does the linked workbook need to be open for COUNTIFS?
Some COUNTIFS formulas that reference external ranges require the source workbook to be open and may return an error when it is closed. Open the source through File > Open and recalculate the formula.
Do all COUNTIFS ranges need to be the same size?
Yes. Each criteria range must have the same number of rows and columns. Check the ranges in the formula bar and adjust them so they cover corresponding cells.
How can I remove hidden spaces before counting?
Use a helper column with =TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))) and fill it down. Clean the criteria in the same way, then point COUNTIFS to the cleaned cells.




