COUNTIFS Not Working (8 Reasons and Solutions)

The Excel COUNTIFS function is used to get the number of cells in a range or ranges that meet a specified set of conditions or criteria.

Sometimes you might experience countifs not working as expected and it returns a #VALUE! error, 0, amessage indicating that there is an error in the formula or some other unexpected value.  

Some of the reasons why the function doesn’t work as expected in Microsoft Excel are:

  1. When a formula refers to a range in a workbook that is closed. 
  2. Using a value from another cell without concatenating it to the logical operator used.
  3. Not inserting textual criteria in double quotes (“ “)
  4. Subsequent ranges do not have the same number of columns and rows as the first criteria range.
  5. Not inserting both numerical criteria and logical operator in double quotes (“ “)
  6. Trying to get a count using the OR logic.
  7. Subsequent changes in dataset.
  8. Mistakes in the formula.

In this tutorial, we explain how these reasons can be resolved so that the function returns the correct count that we are looking for.

1. The formula refers to a range that is in another workbook that is closed

When the COUNTIFS function refers to a range that is in another workbook that is closed, it will return a #VALUE! error instead of the number of cells that we are expecting. 

In the following example, instead of the formula returning the number of red products, a #VALUE! error has been generated because the formula refers to a range in another workbook called Product Colours that is closed.

countifs not working screenshot example

Solution

The solution to countifs not working in this scenario is to open the closed workbook and then press F9 on the keyboard so that the formula recalculates the correct parameters. We will then get the correct count as shown in the following example.

2. Using value from another cell without concatenating the cell reference to the logical operator

In case you use a logical operator and cell reference as criteria for the COUNTIFS function in a formula, and you do not concatenate the cell reference to the logical operator by inserting & before the cell reference, the function will return a 0 instead of the expected count. 

This is shown in the following example where the formula =COUNTIFS(G2:G6,”>M2″) has been used.

Solution

In the following example, we need to type in the correct formula =COUNTIFS(G2:G6,”>” &M2) in cell I3.When we press the ENTER key, we get the correct count of 4.

In the correct formula, only the logical operator of greater than (>) is in double quotes (“ “), and the concatenating operator & is placed before the cell reference M2.

3. Not putting double quotes (“ “) around textual criteria

If textual criteria are not inserted in double quotes, the COUNTIFS function will return a 0 value rather than the correct count that we expect as shown in the example below.

The formula in cell J2 is =COUNTIFS(C2:C6,Red). The formula returns 0 because the criteria Red was not put in double quotes (“ “).

Solution to countifs not working

We need to put the textual criteria in the formula in double quotes as shown in the following example and we will then get the correct count of 2.

4. The subsequent criteria range does not have the same shape as the first criteria range

When we use multiple criteria in the COUNTIFS function, and the additional optional criteria ranges do not match the first criteria range, the #VALUE error will be generated.

In the following example, the formula =COUNTIFS(B2:B13,”Red”,C2:C10,”Microsoft”) has been entered in cell G3 in an attempt to get the number of red products supplied by Microsoft.

When we press enter we get the #VALUE! error as shown below.

This is because the second criteria range of C2:C10 does not have the same number of cells as the first criteria range of B2:B13.

Solution

To correct this problem, we have to ensure that the second criteria range is the same size as the first criteria range as shown below:

When we now press the ENTER key, we will get the correct count of 2 as shown below:

5. Not inserting both numerical criteria and logical operator in double quotes (“ “)

When we use logical operators such as equals to (=), greater than (>), Less than (<), and not equals to (<>) in a formula and fail to include both the numerical criteria and the logical operator in the same double quotes, Excel will give us a message that there is an error with the formula.

In the following example, we did not include both the logical operator and the numerical criteria in the same double quotes. Only the logical operator is inside double quotes.

When we press ENTER key, we get the following message:

Solution

We need to ensure that we include both the logical operator and the numerical criteria inside the same double quotes as shown below:

When we now press ENTER key we will get the correct count of 5 as shown below:

6. Trying to get a count using the OR logic

Although the COUNTIFS function can generate correct counts using the AND logic, it only generates a 0 value when we try to use it to compute using the OR logic. 

In the following example, we are trying to get the number of red and blue product categories using the OR logic.

When we press the ENTER key, we get the unexpected value of 0 as shown below. This is because the COUNTIFS function cannot calculate using the OR logic.

Solution

We can get around this OR logic problem by using the COUNTIFS and SUM functions together.

In the following example, we have entered the formula =SUM(COUNTIFS(B2:B13,{“Red”,”Blue”})) in cell G3.

When we press the ENTER key, we get the correct value of 6 as shown below. This is because the COUNTIFS function returned 3 counts of Red and 3 counts of Blue from the criteria range B2:B13, and the SUM function summed up the values to get 6.

7. Subsequent changes in the dataset 

Changes in a dataset can make the COUNTIFS function not generate expected values. For example, in the following dataset, the COUNTIF function is working properly returning the correct count of Blue products.

But if there are any changes in the data, for example in this case we add the word colour to Blue, the COUNTIFS function now shows the incorrect value of 0.

Solution

This situation can be remedied by using wildcard characters with the COUNTIF function. 

In the following example, we have used the asterisk (*) character in the criteria, and now we can get the correct count of 4 products. This is because the COUNTIF function can now look for partial matches in the criteria range.

8. Mistakes in formula

Sometimes the COUNTIF function will not work because there is an error in the formula, for example forgetting to put a comma separator between the criteria range and the logical operator.

In the following example, there is no comma between the criteria range D2:D13 and the logical operator greater than (>). 

When we press the ENTER key, we get the message box informing us that there is an error in the formula.

Solution

We need to be extra careful when writing formulas to ensure that the syntax is correct. In the following example, inserting a comma between the criteria range and the greater than (>) operator solves the problem and we get the correct count of 5.

Conclusion

COUNTIFS is such a powerful function for generating the number of cells in data ranges that meet specified conditions.

In this tutorial, we have looked at different reasons why this function sometimes does not work as expected and ways of resolving them.

9 thoughts on “COUNTIFS Not Working (8 Reasons and Solutions)”

  1. this did not help….I have used a concatenate and then the countif still does not work..

    example..=CONCATENATE(E64,H64,M64) produced 449271720110338128372 and
    =CONCATENATE(E65,H65,M65) produced 4492717201103381377060.

    the countif in the column prior is =COUNTIF($B$2:$B$34421,B64) and =COUNTIF($B$2:$B$34421,B65) respectively. The countif returns a 2.

    Originally the H64/H65 cell had hypens, which I took out with the substitute formula, then copied and pasted value over the top and converted to a number. 8 lines on my 250 line spreadsheet show duplicates but are really a different item on the same PO number cut on the same date. All others converted identically have no issue. Why do these?

  2. I still cannot get mine to work!! I am trying to figure out how many times a word shows up in Column D. I have tried 5 different COUNTIF formulas but none of them calculate. If I double click the COUNTIF cell it pulls up the formula with the ability to click on range or criteria etc, so I would assume I have it typed in correctly. It doesn’t give me #VALUE or any errors.

  3. Douglas Saferite

    =COUNTIF(J1:J190,”>0″) (this is in cell F9)
    (Data to be counted if > 0 is in J1 through J190)

    That is my statement and it is returning a value of zero

    I can’t seem to find any logical reason that it won’t work

  4. When I type
    =COUNTIF(Sheet1!A$1:A$200,”GE*”)
    in a cell, I obtain the correct answer.
    When I type
    =COUNTIF(Sheet1!A$1:A$200, “Siemens*”)
    in a cell, I obtain 0, which is incorrect. Why? What is wrong with the COUNTIF logic?

  5. After much trial and error I realized Excel was not returning a correct count was the cells it’s looking at are formulas and not real numbers.

  6. Thanks for this post, it helped me understand a problem I was having even though the specific problem was not one of the eight above. I was comparing a table of table with references to cells rather then specific hardcoded values/strings. However, the cell in some cases contained a string that represented a range of percentages e.g. “>10% <=25%". Excel evaluated this instead of just treating it as a string to match. To fix this I concatenated an "=" to the cell reference (e.g. , "=" & A1)

  7. hi
    i have problem with countifs :
    when i type this formul
    =countifs(Database!D2:D100;A5;Database!D2:D100;”=”&A2)
    It gives me the correct answer
    But when type this formul
    =countifs(Database!D2:D100;A5;Database!D2:D100;”<="&A2)
    it give me 0
    That is the wrong answer.
    How should I modify the formula?

  8. I type names of all the Goalscorers into a single cell, over 38 rows in one column. When trying to count how many goals each individual has scored, COUNTIF(S) does not count all the times a player has scored if he scores more than once in the same game

  9. I enter the names of Goalscorers into one cell over 38 rows, in one column. I then use COUNTIFS to count the total number of goals scored by each player. However, the count does not produce the correct total if a player scores more than one goal in the same game.

Leave a Comment

Your email address will not be published. Required fields are marked *