+ Reply to Thread
Results 1 to 12 of 12

[SOLVED]need help to extract specific string within text

  1. #1
    Registered User
    Join Date
    09-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    4

    [SOLVED]need help to extract specific string within text

    Hi i cant seem to find a way to get below solution

    lets say i have a list of text

    Intel Xeon Processor E7-4807 6C (1.86GHz 18MB L3 95w 4S) (A123)
    Intel Xeon Processor E7-4820 8C (2.00GHz 18MB L3 105w 4S) (B123)
    Intel Xeon Processor E7-4830 8C (2.13GHz 24MB L3 105w 4S) (C456)
    Intel Xeon Processor E7-4850 10C (2.00GHz 24MB L3 130w 4S) (D789)
    Intel Xeon Processor E7-4860 10C (2.26GHz 24MB L3 130w 4S) (EFG456)
    Intel Xeon Processor E7-4870 10C (2.40GHz 30MB L3 130w 4S) (ABC123)


    i want to find a way to extract the codes in the brackets at the end of the text

    expected output:

    Intel Xeon Processor E7-4807 6C (1.86GHz 18MB L3 95w 4S) (A123) >> A123 << 4digit
    Intel Xeon Processor E7-4820 8C (2.00GHz 18MB L3 105w 4S) (B123) >> B123
    Intel Xeon Processor E7-4830 8C (2.13GHz 24MB L3 105w 4S) (C456) >> C456
    Intel Xeon Processor E7-4850 10C (2.00GHz 24MB L3 130w 4S) (D789) >> D789
    Intel Xeon Processor E7-4860 10C (2.26GHz 24MB L3 130w 4S) (EFG456) >> EFG456 << 6digit
    Intel Xeon Processor E7-4870 10C (2.40GHz 30MB L3 130w 4S) (ABC123) >> ABC123

    my concern is
    1) i cant use =right(xxxx) function because it has inconsistent number of text within the bracket sometimes
    2) i cant use search for "(" to extract the text there are other brackets within the text : for eg. (1.86GHz 18MB L3 95w 4S)
    Last edited by yulia33; 09-29-2011 at 04:42 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: need help to extract specific string within text

    I have a question regarding the data that you need to be extracted. Does it always begin with alphabets?

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,054

    Re: need help to extract specific string within text

    Here, try this:

    =TRIM(SUBSTITUTE(RIGHT(SUBSTITUTE(A1,"(",REPT(" ",255)),100),")",""))
    Never use Merged Cells in Excel

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: need help to extract specific string within text

    Zbor,

    Can you please explain this formula? Its a learning for all of us.

    Thanks.

  5. #5
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: need help to extract specific string within text

    Nice. Took me a minute to figure it out, but correct me if I'm wrong but this will only work if the string needed is found after the last "(".

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,054

    Re: need help to extract specific string within text

    Let sa you have string xxxx0000(xx00)(xx00)(xx0000)
    And you want to extract last word.
    Reasons why you can do that with RIGHT function yulia33 said in first post.

    So... Idea is to substitute ( with long string of spaces -> I will show here 10 underscores _

    Form string: xxxx0000(xx00)(xx00)(xx0000)
    with part: SUBSTITUTE(A1,"(",REPT(" ",10))

    You get: xxxx0000_________xx00)_________xx00)_________xx0000)

    Now you get RIGHT 15 characters from that string:

    You'll get: ________xx0000)

    Since _ are actually spaces you can remove them with TRIM function:

    Remain: xx0000)

    And last thing to get rid of ) which you can do with SUBSTITUTE like I did, or LEFT function.

    Hope it's clear enough.. if not tell me for further explanation.

    Edit: abousetta you are right. But that's what user asked to.

  7. #7
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: need help to extract specific string within text

    Hi zbor,

    I agree and here's my 5 cents:

    Please Login or Register  to view this content.
    abousetta

  8. #8
    Registered User
    Join Date
    09-29-2011
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: need help to extract specific string within text

    Hi abousetta,

    That was nice. Could you please explain the function?

    Thanks

  9. #9
    Registered User
    Join Date
    09-29-2011
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: need help to extract specific string within text

    Quote Originally Posted by johnrichie View Post
    Hi abousetta,

    That was nice. Could you please explain the function?

    Thanks
    Took sometime to figure it out... that was neat.. Thanks

  10. #10
    Registered User
    Join Date
    09-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: need help to extract specific string within text

    thanks!

    took some time to understand those.

    now i have another issue. what if there are texts behind the last ")"

    Intel Xeon Processor E7-4807 6C (1.86GHz 18MB L3 95w 4S) (A123)
    Intel Xeon Processor E7-4820 8C (2.00GHz 18MB L3 105w 4S) (B123)
    Intel Xeon Processor E7-4830 8C (2.13GHz 24MB L3 105w 4S) (C456)
    Intel Xeon Processor E7-4850 10C (2.00GHz 24MB L3 130w 4S) (D789)
    Intel Xeon Processor E7-4860 10C (2.26GHz 24MB L3 130w 4S) (EFG456) - text
    Intel Xeon Processor E7-4870 10C (2.40GHz 30MB L3 130w 4S) (ABC123) [etc etc]

    my output was:

    A123
    B123
    C456
    D789
    EFG456 - text
    ABC123 [etc etc]

    any formula to count the length of strings before it has a space from the left function.
    so i can extract the exact string regardless of its length there.

  11. #11
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,054

    Re: need help to extract specific string within text

    You want to extract without words after last ) ?

    try this:

    =TRIM(LEFT(SUBSTITUTE(RIGHT(SUBSTITUTE(A1,"(",REPT(" ",255)),100),")",REPT(" ",255)),100))

  12. #12
    Registered User
    Join Date
    09-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: need help to extract specific string within text

    brilliant!
    you made it looked so easy. i didn't think of that.

+ 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