Formula Errors

How to Count Cells Excluding Blanks and Specific Values in Excel

Adam DavisAdam Davis Nov 10, 2026 869 views

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.

How to Count Cells Excluding Blanks and Specific Values
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the target cell

Click on the empty cell where you want the final, filtered count to be displayed.

2
Enter the COUNTIFS formula

Type the formula: `=COUNTIFS('All Defects'!I:I, "<>Closed", 'All Defects'!I:I, "<>")`.

3
Apply the calculation

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 the COUNTIFS Function to Exclude Blanks and Specific Values
Broad Compatibility: This COUNTIFS method is highly recommended because it is fully backward compatible with older versions of spreadsheet software.
Advanced Formulas in WPS Spreadsheet

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. 1. Open your dataset: Launch WPS Spreadsheet and open the file containing the data you want to analyze.
  2. 2. Select a cell for the formula: Click on an empty cell where you want the calculated count to appear.
  3. 3. Apply the formula: Type either the COUNTIFS or TOCOL formula, such as `=COUNTIFS(I:I, "<>Closed", I:I, "<>")`.
  4. 4. Get accurate results instantly: Press Enter to execute the formula and instantly view your precise count excluding blanks and closed values.
Fully compatible with Microsoft Excel formulas like COUNTIF, COUNTIFS, and SUM.Supports modern dynamic array functions such as TOCOL for advanced data analysis.Intuitive formula builder interface to help prevent syntax errors.Lightweight, efficient, and free alternative to standard spreadsheet software.
microsoft office alternative - wps office

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.