Counting occurences of a specific letter in a string

SDM

New Member
Joined
May 30, 2003
Messages
2
I use Excel 2000 as a database for DNA sequences. The sequences are each entered as a string of letters (ex: ACGTCGCTGCGTACGT). I have been trying to find a way to count the occurences of each letter in the string so I can have Excel automatically calculate molecular weights (# of A's, # of C's, etc.).
Do any of you have any suggestions?
Thanks!
-Scott
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Thank you!
For anyone who is interested, here is the result:

=IF(A1="","",((LEN(A1)-LEN(SUBSTITUTE(A1,"A","") ))*313.2114)+((LEN(A1)-LEN(SUBSTITUTE(A1,"C","") ))*289.1863)+((LEN(A1)-LEN(SUBSTITUTE(A1,"G","") ))*329.2108)+((LEN(A1)-LEN(SUBSTITUTE(A1,"T","") ))*304.1981)-61.9646)

where A1 contains the sequence (ex: ACGTCGATCGAC)

-Scott
 
Upvote 0
Scott, try the following formula:

=IF(A1="","",SUM((LEN(A1)-LEN(SUBSTITUTE(A1,{"A","C","G","T"},"")))*{313.2114,289.1863,329.2108,304.1981})-61.9646)

You get the same results, and the formula's a little easier on the eyes.

--Tom
 
Upvote 0

Forum statistics

Threads
1,221,631
Messages
6,160,942
Members
451,679
Latest member
BlueH1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top