Count Nonblank Cells Next to Blank Cells in Excel and WPS Spreadsheets
Question details
Count populated cells in one range only when the corresponding cells in an adjacent range are blank.

- Product
- Microsoft Excel and WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- A user wants to count cells in A1:A10 only when the matching cells in B1:B10 are blank.
- Observed behavior
- The desired result is a count of rows where column A is nonblank and the corresponding cell in column B is blank.
Check that the two ranges cover the same rows and have the same dimensions. Choose an empty cell outside those ranges for the result.
Use SUMPRODUCT to Count Matching Rows
Use this formula to test both conditions row by row and return a single count.
SUMPRODUCT evaluates whether each cell in column A is nonblank and its corresponding cell in column B is blank. The double minus signs convert those results to numbers for counting.
Open the worksheet in Excel or WPS Spreadsheets and click an empty cell outside A1:B10.
Type =SUMPRODUCT(--(A1:A10<>""),--(B1:B10="")) into the selected cell or formula bar.
Press Enter. The result counts only rows where the cell in A1:A10 is nonblank and the corresponding cell in B1:B10 is blank.
To use different rows, edit both ranges in the formula bar so they start and end on corresponding rows.

Count Matching Rows in WPS Spreadsheets
Use SUMPRODUCT in WPS Spreadsheets to count nonblank cells only when their adjacent cells are blank.
- 1. Open your worksheet: Launch WPS Spreadsheets and open the workbook containing the two columns.
- 2. Choose a result cell: Click an empty cell outside the ranges you want to evaluate.
- 3. Enter the formula: Type =SUMPRODUCT(--(A1:A10<>""),--(B1:B10="")) in the selected cell, adjusting both ranges if needed.
- 4. View the result: Press Enter to display the count of qualifying rows.

Frequently Asked Questions
Does the formula count a zero in column A?
Yes. A numeric zero is nonblank, so it is counted if the corresponding cell in column B is blank.
What happens if a cell contains a formula that returns an empty string?
The comparisons treat the empty string as blank. That row is excluded if it appears in column A and can qualify if it appears in column B.
Why is a cell that looks blank not being treated as blank?
It may contain spaces or other characters. Click the cell and inspect the formula bar, then remove unwanted characters if appropriate.
Can I use ranges other than A1:A10 and B1:B10?
Yes. Replace both ranges in the formula with ranges of the same size that cover corresponding rows, such as A2:A20 and B2:B20.




