Find & Count text within a cell

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
=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)
 
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)
 
Back
Top