Formula Errors

Fix COUNTIFS Returning Zero for a Linked Excel Workbook

Camila MilosovichCamila Milosovich Nov 18, 2026 870 views

Question details

The user needs to troubleshoot a COUNTIFS formula that returns zero when matching data across Excel worksheets or workbooks.

Fix COUNTIFS Returning Zero for a Linked Excel Workbook
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.
Before you start

Identify the cells containing the COUNTIFS formula, its criteria, and the data being counted. Open both workbooks if the formula uses an external reference.

Solution 1Recommended

Normalize the values and criteria being compared

Use this approach when apparently matching values differ in type, length, or hidden characters.

1
Compare value types and lengths

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.

2
Clean text in helper columns

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.

3
Convert numeric values if needed

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.

4
Count the cleaned values

Edit the COUNTIFS formula to reference the cleaned helper range and cleaned criterion, then press Enter to check the result.

Normalize the values and criteria being compared
Check meaningful spaces: TRIM removes leading and trailing spaces and reduces repeated internal spaces, so use it only when those differences should not affect a match.
Free Microsoft Office alternative

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.

Review COUNTIFS formulas and matching data in WPS SpreadsheetOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar interface for an easier transition from ExcelWork with a free, lightweight office suite
microsoft office alternative - wps office

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.