How to count the occurences of a text string within a cell...

H

Healingbear

I'm trying to count the number of text-strings, in this case commas,
within a cell.

For instance:

A1(text)=AB,BC,CD,DE,EF

If I could count 4 commas, I'd know there were (4)+1 objects in the
cell...

Thanks in advance. I always research as much as possible before asking
the forum. The forum has ALWAYS come through with the answer!
 
D

Dave Peterson

Something like:

=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))

or more generic:

=LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),"SOMETEXTHERE",""))/LEN("SOMETEXTHERE")
 

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