Excel help

Solved/Closed
ceejaydee - Jul 23, 2010 at 02:47 PM
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
- Jul 27, 2010 at 07:56 AM
Hello,

I have an excel worksheet with cells filled with strings of text like this...

CAS [354-24-5], 99%

I'd like to search a vertical column of these types of entries and pull out the number in the brackets and paste into a new cell. The number in brackets will have varying lengths. Here are a few more examples...

CAS [3812236-07-7], 97%
CAS [27639-98-1], 97%
CAS [3110-03-0]

Any help would be most appreciated.

Thanks,
Chris

1 reply

rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Jul 23, 2010 at 05:47 PM
Chris, try this

=IF(A1="","",MID(LEFT(A1,IF(ISERROR(FIND("]",A1)),LEN(A1),FIND("]",A1))-1),IF(ISERROR(FIND("[",A1)),1,FIND("[",A1)+1),LEN(A1)))
1
Hello rizvisa,

Works like a charm. Thank you very much. If you should ever need help with chemistry, look me up. I'm sure ill post again soon.
0
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Jul 27, 2010 at 07:56 AM
Sure thing. next time I am into fluid mechanics or therodynamics, I would sure to look for you :)
0