Home » excel » Excel count if used with data validation gives 0 each time

Excel count if used with data validation gives 0 each time

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am using the countif function to count the number of times the word “yes” occurs in a range. The range only accepts “yes” and “no” values through data validation from a list. The result is always 0 irrespective of what values I give the range. Any help?

How to&Answers:

As I mentioned in comments, it seems that range G7:G13 contains "yes"/"no" with additional leading/trailing spaces. Try next formula:

=SUMPRODUCT(1*(TRIM(G7:G13)="YES"))

Answer:

Try using wildcards

=COUNTIF(G7:G13,"*YES*")