View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
PCLIVE PCLIVE is offline
external usenet poster
 
Posts: 1,311
Default Count consecutive characters within a cell

Here's one way:

=IF(OR(LEN(SUBSTITUTE($A1,REPT(E1,4),""))<LEN(A1), (LEN(SUBSTITUTE($A1,REPT(F1,4),""))<LEN(A1)),(LEN( SUBSTITUTE($A1,REPT(G1,4),""))<LEN(A1)),(LEN(SUBST ITUTE($A1,REPT(H1,4),""))<LEN(A1))),"Yes","No")

Cells E1,F1,G1 and H1 represent the letters that you want to test against 4
consecutive.
E1= A
F1=T
G1=C
H1=G

HTH,
Paul


--

"Jshendel" wrote in message
...
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