Counting Cells that contain Specific text

G

Guest

Greetings Excel Masters!

I am trying to count a range of cells that contain certain text characters. The characters will not always be in order, there will be times when those characters are alone in the cell and other times when there is additional text. I tried using the COUNTIF function which works when the characters are alone in the cell, but not when there are other characters. Details below:

=COUNTIF(H2:DH2,B21) So B21 contains SGT, the range may have instances like SGT, SGT TT, TM SGT, etc. Its counting SGT alone but not the other instances. I can't seem to figure it out. Any help is greatly appreciated. Thank you.
 
J

Jason Morin

=COUNTIF(H2:DH2,"*"&B21&"*")

HTH
Jason
Atlanta, GA

-----Original Message-----
Greetings Excel Masters!

I am trying to count a range of cells that contain
certain text characters. The characters will not always
be in order, there will be times when those characters
are alone in the cell and other times when there is
additional text. I tried using the COUNTIF function
which works when the characters are alone in the cell,
but not when there are other characters. Details below:
=COUNTIF(H2:DH2,B21) So B21 contains SGT, the range
may have instances like SGT, SGT TT, TM SGT, etc. Its
counting SGT alone but not the other instances. I can't
seem to figure it out. Any help is greatly appreciated.
Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top