+ Reply to Thread
Results 1 to 5 of 5

Need to capture a specific string of characters

  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    Oakland, CA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Need to capture a specific string of characters

    I need some help in capturing a specific string of characters within a larger string. Following is an example cell:

    Glutathione [ C10 H17 N3 O6 S, tgt=93.62, overall=93.62, CAS ID=70-18-8, KEGG ID=C00051 ]

    All I want to retain is C10H17N3O6S. Having removed the extra spaces. It looks like LEFT, MID and RIGHT functions will not work because the start of the string is variable, additional examples:

    L-Aspartate [ C4 H7 N O4, tgt=81.15, overall=81.15, CAS ID=56-84-8, KEGG ID=C00049 ]
    Dodecanoic acid [ C12 H24 O2, tgt=98.79, overall=98.79, CAS ID=143-07-7, KEGG ID=C02679 ]


    I need a formula that will capture all text between the characters "[" and ",". Once that is complete I need to use a TRIM function to remove all spaces. A solution here will save me 6-8hrs prior to a Monday morning deadline. Thank you in advance for any input.

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Need to capture a specific string of characters

    try this one.
    assuming the values are starts in A1

    Please Login or Register  to view this content.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Need to capture a specific string of characters

    HI Saccer,

    Welcome to the forum.

    Use the below formula:-

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    capture specific string.xlsx

    Regards
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Need to capture a specific string of characters

    Use..

    =SUBSTITUTE(MID(A1,2,FIND(",",A1)-2)," ","")
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  5. #5
    Registered User
    Join Date
    08-23-2012
    Location
    Oakland, CA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Need to capture a specific string of characters

    Thank you very much! Those formulas work and you have saved me a ton of time!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1