Fix Excel COUNTIF Returning #VALUE! Across Multiple Worksheets
Question details
Count cells greater than zero across multiple Excel worksheets without a #VALUE! error.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to count cell R43 when it is greater than zero on each worksheet from Sheet1 through Sheet5.
- Observed behavior
- The formula =COUNTIF(Sheet1:Sheet5!R43,">0") returns #VALUE!.
Check the exact worksheet names and confirm that R43 is the cell you want to test on each sheet. If you use a sheet list, place it in unused cells on the worksheet containing the formula.
Use a worksheet list with SUMPRODUCT and INDIRECT
Use this approach when you have many worksheets and want to maintain their names in a list.
COUNTIF does not directly accept a three-dimensional reference such as Sheet1:Sheet5!R43. INDIRECT builds an individual reference for each listed worksheet, and SUMPRODUCT adds the results.
On the worksheet containing your result, enter the exact names Sheet1 through Sheet5 in cells M1:M5, one name per cell.
Select the result cell and enter =SUMPRODUCT(COUNTIF(INDIRECT("'"&SUBSTITUTE($M$1:$M$5,"'","''")&"'!R43"),">0")), then press Enter.
For 19 worksheets, enter their names in M1:M19 and change $M$1:$M$5 in the formula to $M$1:$M$19. Change R43 if you need to test a different cell.

Add separate COUNTIF results for each worksheet
Use separate references for a small, fixed set of worksheets without maintaining a sheet-name list.
Count values across worksheets with WPS Spreadsheet
In WPS Spreadsheet, add separate COUNTIF results to count cells greater than zero across worksheets without using an unsupported 3D COUNTIF reference.
- 1. Open the workbook: Open WPS Spreadsheet and use Open to select your Excel workbook.
- 2. Check the sheet names: Review the worksheet tabs and confirm the names of the sheets containing the cells you want to count.
- 3. Add the COUNTIF formula: Select a result cell and enter =COUNTIF(Sheet1!R43,">0")+COUNTIF(Sheet2!R43,">0"). Add another COUNTIF term for each additional sheet.
- 4. Save the workbook: Press Enter to calculate the count, then use File > Save or Save As to save your changes.

Frequently Asked Questions
Why does COUNTIF return #VALUE! for Sheet1:Sheet5!R43?
Excel COUNTIF does not directly support the 3D worksheet reference Sheet1:Sheet5!R43. Use individual sheet references or build them from a worksheet-name list with INDIRECT.
Can I use the sheet-list formula for 19 worksheets?
Yes. Enter the 19 exact worksheet names in M1:M19, then change the sheet-list range in the SUMPRODUCT formula to $M$1:$M$19.
What if a worksheet name contains spaces or an apostrophe?
Enclose the sheet name in single quotes in a direct reference, such as 'Sales East'!R43. For the sheet-list formula, SUBSTITUTE doubles any apostrophes in the listed name.
Does the formula count zero or blank cells?
No. The criterion ">0" counts numeric values greater than zero; zero and blank cells are not counted.




