How to Count Cells Excluding Blanks and Specific Values in Excel
Question details
The user needs to count the number of cells in a range that do not contain a specific value (such as "Closed") while also ensuring that blank cells are not included in the final count.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating metrics or tracking data entries where specific completed statuses and empty rows must both be omitted from the total count.
- Observed behavior
- Using a standard COUNTIF formula with a not-equal criterion (e.g., <>"Closed") produces an unexpectedly large result because it inadvertently counts all blank cells in the range as matching the criteria.
Ensure your dataset does not contain hidden rows or trailing spaces in seemingly blank cells, as these invisible characters can cause counting formulas to return inaccurate results.
Use the COUNTIFS Function to Exclude Blanks and Specific Values
The standard COUNTIFS function allows you to evaluate multiple conditions simultaneously, making it the most reliable method across all versions of Excel and WPS Spreadsheet.
Click on the empty cell where you want the final, filtered count to be displayed.
Type the formula: `=COUNTIFS('All Defects'!I:I, "<>Closed", 'All Defects'!I:I, "<>")`.
Press Enter. This instructs the software to count cells only if they do not equal "Closed" and are simultaneously not blank, yielding an accurate total.

Use TOCOL and SUM Functions for Dynamic Arrays
If you are using Excel 365 or the latest WPS Office, you can utilize dynamic array functions to filter out blanks entirely before checking for your specific text criteria.
Easily Manage Complex Data Counting in WPS Spreadsheet
WPS Spreadsheet provides robust support for both classic and modern dynamic array formulas, making it effortless to count, filter, and track complex data without worrying about blank cells skewing your results.
- 1. Open your dataset: Launch WPS Spreadsheet and open the file containing the data you want to analyze.
- 2. Select a cell for the formula: Click on an empty cell where you want the calculated count to appear.
- 3. Apply the formula: Type either the COUNTIFS or TOCOL formula, such as `=COUNTIFS(I:I, "<>Closed", I:I, "<>")`.
- 4. Get accurate results instantly: Press Enter to execute the formula and instantly view your precise count excluding blanks and closed values.

Frequently Asked Questions
Why does the standard COUNTIF formula count blank cells when using a not-equal criterion?
In spreadsheet logic, a blank cell evaluates as an empty text string (""). Since an empty string is technically "not equal" to your specified text (like "Closed"), the COUNTIF function includes those blank cells in the final calculation.
How do I exclude multiple different specific values along with blank cells?
You can easily expand the COUNTIFS formula by adding more criteria pairs. For instance, using `=COUNTIFS(A:A, "<>Closed", A:A, "<>Pending", A:A, "<>")` will successfully exclude cells containing "Closed", cells containing "Pending", and all empty cells.
What should I do if my counting formula still includes blank-looking cells?
Cells that appear blank might actually contain hidden characters like spaces or non-breaking spaces. You can use the Find and Replace tool to clear invisible spaces, or utilize the TRIM function to clean your data range before executing the count.




