# How to Use COUNTIF for Cells Not Equal to Text or Blank in Excel – 5 Examples

This is a sample dataset of the electricity bill of a Store in the 1st 6 six months of 2021.

The column Result was added to the dataset.

### Method 1 – Using the COUNTIF Function to Count Cells Not Equal to Blank

Steps:

• Select E5.
• Enter the COUNTIF.
• Select the range B5:C10 and provide a condition.
• Set the condition Not equal (<>) in the 2nd argument. This is the formula.
`=COUNTIF(B5:C10,"<>")`

• Press ENTER.

This is the output. There are 2 blank cells and 10 cells are non-zero.

Note: <> This sign means not equal. As no data is provided after it, it compares with blanks and returns non-blank cells.

### Method 2 – Applying the COUNTIF Function to Count Cells That Do Not Contain Text

Steps:

• Choose E5.
• Enter the COUNTIF.
• Select the range B5:C10 and provide a condition.
• In the 2nd argument enter “ <>* ” and set this condition. The formula is:
`=COUNTIF(B5:C10,"<>*")`

• Press ENTER.

The output displays the total count of cells that don’t have text value and the number of empty and numeric cells.

### Method 3 – Utilizing the COUNTIF Function for Cells Not Equal to a Specific Text in Excel

Steps:

• Enter the COUNTIF in E5
• Select the range B5:C10.
• In the 2nd argument enter “ <>Jan ”. Cells that don’t contain “Jan” will be counted and this condition will be set. The formula is:
`=COUNTIF(B5:C10,"<>Jan")`

• Press ENTER.

11 is the output. Only 1 cell contains Jan. There are 11 cells that don’t have the text “Jan” will be counted and this condition will be set. The formula is:

### Method 4 – Combining the COUNTBLANK Function with the COUNTIF Function to Count Cells Not Equal to a Specific Text or Blank

Steps:

• Select E5.
• Enter the COUNTIF.
• Select the range B5:C10.
• In the 2nd argument enter “ <>Feb ”. Cells that don’t contain “Feb” will be counted and this condition will be set.
• Enter the COUNTBLANK function.
• Select the range B5:C10 and subtract it from the COUNTIF. The formula is:
`=COUNTIF(B5:C10,"<>Feb")-COUNTBLANK(B5:C10)`

• Press ENTER.

Blank cells are not counted. Non-zero cells are displayed, excluding the cells containing ‘Feb‘.

### Method 5 – Applying the COUNTIF Function to Count Cells Not Equal to Text or Blank

Steps:

• Choose E5.
• Enter the COUNTIF.
• Select the range B5:C10 and provide a condition.
• In the 2nd argument write “ <>* ”.
• Subtract the COUNTBLANK function. For the COUNTBLANK function choose the range B5:C10. This is the formula:
`=COUNTIF(B5:C10,"<>*")-COUNTBLANK(B5:C10)`

• Press ENTER.

This is the output. Only numeric values are counted.

Practice here.

## Related Articles

Get FREE Advanced Excel Exercises with Solutions!
Alok Paul

Alok Paul has completed his B.Sc. in Electronics and Telecommunication Engineering from East West University. He has been working on the ExcelDemy project for more than 2 years. He has written 220+ articles and replied to numerous comments. He is experienced in Microsoft Office, especially in Excel. He also led some teams on Excel and VBA content development. He has a keen interest in Advanced Excel, Data analysis, Excel Pivot Table, Charts, and Dashboard. He loves to research... Read Full Bio

We will be happy to hear your thoughts

Advanced Excel Exercises with Solutions PDF