View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Count Word in long string

Hi,

Am Sat, 23 Mar 2013 10:55:18 +0000 schrieb tamer:

Red , green , red , blue , ,black ,green , red, red,

what i want to do is to count how many times the word red repeted
starting from the right hand side till the fourth coma only not through
the whole sting only till the fourth coma


your string in A1. Then try:
=(LEN(RIGHT(A1,LEN(A1)-FIND("#",SUBSTITUTE(A1,",","#",4))-2))-LEN(SUBSTITUTE(RIGHT(A1,LEN(A1)-FIND("#",SUBSTITUTE(A1,",","#",4))-2),"red",)))/LEN("red")


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2