Exceljet

Quick, clean, and to the point

Count cells that do not contain

Excel formula: Count cells that do not contain
Generic formula 
=COUNTIF(rng,"<>*txt*")
Explanation 

To count the number of cells that do not contain certain text, you can use the COUNTIF function. In the generic form of the formula (above), rng is a range of cells, txt represents the text that cells should not contain, and "*" is a wildcard matching any number of characters.

In the example, the active cell contains this formula:

=COUNTIF(B4:B11,"<>*a*")

How this formula works

COUNTIF counts the number of cells in the range that do not contain "a" by matching the content of each cell against the pattern "<>*a*", which is supplied as the criteria. The "*" symbol (the asterisk) is a wildcard in Excel that means "match any number of characters" and "<>" means "does not equal", so this pattern will count any cell that does not contain "a" in any position. The count of cells that match this pattern is returned as a number.

With a cell reference

You can easily adjust this formula to use the contents of another cell that contains the text you do not want to count. The generic form of the formula looks like this:

=COUNTIF(rng,"<>*"&a1&"*")

Exclude blanks

To also exclude blank cells, you can switch to COUNTIFS and add another criteria like this:

=COUNTIFS(range,"<>*a*",range,"?*") // requires some text
Author 
Dave Bruns

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.