![]() |
Find & Count text within a cell
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 |
Find & Count text within a cell
=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) "ernie" wrote in message ... 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 |
Find & Count text within a cell
Hey Bob,
It worked ... thank You "Bob Phillips" wrote: =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) "ernie" wrote in message ... 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 |
All times are GMT +1. The time now is 12:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com