Countif equals and not equals not working correctly

sunrise06

Active Member
Joined
Oct 27, 2006
Messages
264
Office Version
  1. 365
Platform
  1. Windows
I have a column of text values that appear to be numeric and need to remain as text values. When I use this formula =COUNTIF($BH$5:$BH$16,"00") I get the correct result, but if I use the following formula I do no, =COUNTIF($BH$5:$BH$18"<>00").

However, if the values are changed to alpha characters, it works fine - e.g., =COUNTIF($BG$5:$BG$16,"F") or =COUNTIF($BG$5:$BG$16,"<>F")

Any ideas why that is?
 
Fluff, thank you, very interesting. Can you please explain how this works? I don't understand why SUMPRODUCT works in this situation and what the -- does.

THANKS!
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
This appears to work (note the asterisk)...

=COUNTIF(A1:A7,"<>00*")

While I do not know why it doesn't happen for the equal condition, I think for the not equal condition, the 00 is being converted to the number 0 for the comparison (you can see this by making one of the values a true 0 value... is will not be counted)... adding the asterisk seem to confirm to Excel that the 00 is really a text string.
 
Upvote 0
This appears to work (note the asterisk)...

=COUNTIF(A1:A7,"<>00*")

While I do not know why it doesn't happen for the equal condition, I think for the not equal condition, the 00 is being converted to the number 0 for the comparison (you can see this by making one of the values a true 0 value... is will not be counted)... adding the asterisk seem to confirm to Excel that the 00 is really a text string.
I should point out (not that it would matter for the OP's data), that beside not counting 00, my formula would also not count any text string that started with 00, so it is not a universal solution to this particular COUNTIF problem, only a solution for the OP's data possibilities.
 
Upvote 0
Apparently, I did, sorry. Are you able to explain the formula?

Yes I can, but seeing that you didn't like my formula, you probably wouldn't like my explanation neither. ;)
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,632
Members
452,661
Latest member
Nonhle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top