Go Back

How to Count Cells Not Equal to Many Things

We can count cells not equal to many things with a combined formula that utilizes the COUNTIF, SUMPRODUCT, and COUNTA functions. This is useful to decipher cells that do not belong to the same category. The steps below will guide all levels of excel users to count cells not equal to many things.

Figure 1: Result for Cells not Containing PETER and JUDE

General formula

=COUNTA(range)-SUMPRODUCT(COUNTIF(range, things))

Formula

=COUNTA(B4:B11)-SUMPRODUCT(COUNTIF(B4:B11,Names))

Setting up the Data

  • We will set up the data by inputting the commission for different marketers in Column A and the names of the marketers in Column B
  • Cell D6 is where we want the formula to return the result for cells that are not equal to PETER and JUDE
  • It should be noted that we must name Cell D9 and Cell 10 as “Names.” We do this by highlighting both cells and click on where we see D15 in figure 2. We will type Names and press the enter key

Figure 2: Setting up the Data

Count Cells That Are Not Equal To PETER And JUDE

  • We will click on Cell D6 and insert the formula below
    =COUNTA(B4:B11)-SUMPRODUCT(COUNTIF(B4:B11,Names))
  • We will press the enter key

Figure 3: Result for Cells not Containing PETER and JUDE

Explanation

=COUNTA(B4:B11)-SUMPRODUCT(COUNTIF(B4:B11,Names))

The COUNTIF function checks the range B4:B11 for cells that contain PETER and JUDE. It then returns the results as TRUE or FALSE like this:

{TRUE;TRUE;TRUE;TRUE;TRUE;FALSE;FALSE;FALSE}

The SUMPRODUCT function reads any TRUE VALUE as 1 and FALSE as 0 in the array form below. It sums up the numbers and the result is 5

{1;1;1;1;1;0;0;0}

The COUNTA function counts all the cells in the range B4:B11. The total number of cells in the range is 8.

Hence, 8-5=3.

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

I need a formula to count when numbers are not equal. I have 2 columns of cells, 20 rows high, I need to count how ,many times the rows don't match. Ex. row 1 If c4<>b4, count 1, if c5<>b5, count 1, if c6<>b6, count 1......So if in the 20 rows I have 5 rows that don't match, count 5.
Solved by G. E. in 23 mins
I have list of strings, I am trying to count how many cells have Text and Howmany do not
Solved by K. F. in 16 mins
i want to count no of cells which have numbers not the empty cell, could you please help me with that. many thanks. Raj
Solved by E. S. in 27 mins

Leave a Comment

avatar