View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Count consecutive characters within a cell

How about just True or False

=LEN(A1)<LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
SUBSTITUTE(UPPER(A1),"GGGG",""),"AAAA",""),"TTTT", ""),"CCCC",""))

Or

=TRIM(
IF(LEN(A1)=LEN(SUBSTITUTE(UPPER(A1),"GGGG",""))," ","Consecutive G's ")
&IF(LEN(A1)=LEN(SUBSTITUTE(UPPER(A1),"AAAA","") )," ","Consecutive A's ")
&IF(LEN(A1)=LEN(SUBSTITUTE(UPPER(A1),"TTTT","") )," ","Consecutive T's ")
&IF(LEN(A1)=LEN(SUBSTITUTE(UPPER(A1),"CCCC","") )," ","Consecutive C's "))





Jshendel wrote:

I have a genetic sequence such as:
AATTCAGTTACTTTTGCA

I need a formula that will tell me if this cell has a run of 4 or more
consecutive letters. The run can consist of 4 or more A, T, C, or G.

The above example can return simply as "yes" or can be as complex as "this
cell has 4 consecutive T's"

Thanks,
Josh


--

Dave Peterson