COUNTIF is not working

Excel_VBA

New Member
Joined
Dec 19, 2009
Messages
42
I've got a very simple formula. It is =COUNTIF(A8,"dog") and it is returning a 0. Cell A8 contains "The dog is blue"

The COUNTIF cell and cell A8 are in general format. I tried changing the way the formula calculates from Automatic to Manual and back to Automatic again. Not working.

I'm using Excel 2007. Any ideas what is wrong?
 
I think use of UPPER is the problem if "dog" is lower case it appears that UPPER("The blue dog") is evaluated as NOT containing the word "dog" so there is no substitution.
SUBSTITUTE is case sensitive.

A1 = This dog is real big

When in doubt use this syntax:

SUBSTITUTE(UPPER(A1),UPPER("DOG"),...

You can use LOWER( ) in place of UPPER. The point is to make the case of the source and the old text the same.
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Well, I learned something - didn't realize that SUBSTITUTE function is case sensitive. Thanks.
 
Upvote 0
It worked. I see the problem now. Thank you for your suggestion. Thank you to the others who also replied. You solutions may come in handy in the future. Now I'll be able to sleep better tonight.
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0
SUBSTITUTE is case sensitive.

A1 = This dog is real big

When in doubt use this syntax:

SUBSTITUTE(UPPER(A1),UPPER("DOG"),...

You can use LOWER( ) in place of UPPER. The point is to make the case of the source and the old text the same.

Why the second one?
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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