Find & Count text within a cell


G

Guest

Hi All

I need code to count text within cells, example below:

A | B | C | D
1

2 tr,tr | tt,tr | rt,tr | tt,ty

3


i want to be able to count the amount of times "tr" is found within this
range of cells "A2:D2". obviously the codes has to read within the cells.
"tr" is there four times.


Thanks
Ernie
 
Ad

Advertisements

B

Bob Phillips

=SUMPRODUCT(--(LEN(A2:D2)-LEN(SUBSTITUTE(A2:D2,"tr",""))))/2

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Ad

Advertisements

G

Guest

Hey Bob,

It worked ... thank You

Bob Phillips said:
=SUMPRODUCT(--(LEN(A2:D2)-LEN(SUBSTITUTE(A2:D2,"tr",""))))/2

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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