Fix COUNTIFS Formula Returning Zero Due to Cell Reference Error in Excel
Question details
The user needs to correct a COUNTIFS formula that fails to count matching rows because a dynamic cell reference was incorrectly wrapped in quotation marks.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Counting rows where a department listed on one sheet matches a dynamic cell reference on another sheet, while also checking for a 'Yes' value in a second column.
- Observed behavior
- The formula evaluates to zero because Excel treats the cell reference enclosed in quotation marks as a literal text string instead of retrieving the value from the referenced cell.
Verify your formula syntax in the formula bar. Quotation marks should only be used to enclose literal text criteria (like "Yes"), not cell references or addresses.
Remove Quotation Marks from the Cell Reference
Fix the formula by removing the quotation marks around the dynamic cell reference, allowing Excel to properly read the cell's underlying value.
When building functions like COUNTIF or COUNTIFS, placing quotation marks around a cell address (e.g., "Sheet2!$A2") tells the application to look for that exact text string rather than the data stored inside the cell. Removing the quotes restores the dynamic reference.
Click on the cell containing the COUNTIFS formula that is currently returning a zero.
Click inside the formula bar at the top of the screen to edit your function syntax.
Locate the dynamic cell reference in your formula arguments and delete the double quotation marks surrounding it. For example, change "Sheet2!$A2" to Sheet2!$A2.
If you are entering this formula directly on Sheet2, you do not need the sheet name. You can simplify the reference to just $A2 (e.g., =COUNTIFS(Sheet1!$B:$B, $A2, Sheet1!$H:$H, "Yes")).
Press the Enter key. The formula should now correctly calculate the rows matching your criteria. You can drag the fill handle down to copy this relative formula to other cells.

Write Complex Formulas Seamlessly with WPS Spreadsheet
WPS Spreadsheet provides robust support for logical and statistical formulas like COUNTIFS. With intelligent syntax highlighting and formula prompts, it helps you avoid quotation mark errors and reference cells across multiple sheets with ease.
- 1. Open your workbook: Launch WPS Spreadsheet and open your existing data file.
- 2. Start the COUNTIFS function: Select your target cell, type =COUNTIFS(, and you will see helpful tooltips appear on the screen.
- 3. Select the criteria range: Click the tab for your first sheet and select the column containing the department data, then type a comma.
- 4. Reference the target cell: Click the specific cell containing the department name on your current sheet. WPS will automatically insert the cell reference without quotation marks.
- 5. Add text criteria: Type a comma, highlight your second range, type another comma, enter "Yes", and press Enter to finalize.

Frequently Asked Questions
Why does my COUNTIFS formula return 0 even though the data visually matches?
This commonly occurs when a cell reference is mistakenly enclosed in quotation marks, making the formula search for the literal cell address text. It can also happen if your data contains hidden spaces, non-printing characters, or if the numbers are formatted as text.
How do I correctly reference a cell on another sheet?
To reference a cell on a different sheet, include the sheet name followed by an exclamation mark before the cell address (e.g., Sheet1!A1). If the sheet name contains spaces, you must wrap the sheet name in single quotes, such as 'Data Sheet'!A1.
Can I use wildcard characters with a cell reference in COUNTIFS?
Yes, but you cannot put the cell reference inside the wildcard's quotation marks. Instead, enclose the wildcards in quotes and use an ampersand (&) to join them to the cell reference. For example: "*" & A2 & "*".




