+ Reply to Thread
Results 1 to 11 of 11

Extracting multiple text within brackets

  1. #1
    Registered User
    Join Date
    02-12-2011
    Location
    London
    MS-Off Ver
    Excel MAC 2011
    Posts
    12

    Extracting multiple text within brackets

    Hi
    I have a problem getting past this.

    I have a single excel cell with the following example in it;

    <1234> hsjudfg <3456> cdhjkd <765432>

    I wish to extract it into a single cell as follows;
    <1234><3456><765432>

    Only extracting the brackets and information within.
    I tried building a formula as follows but cannot seem to get past extracting only the first <1234> and similarly only mutliple instances of this eg. <1234><1234>

    =MID(A1,FIND(CHAR(60),A1),FIND(CHAR(62),A1))&MID(A1,FIND(CHAR(60),A1),FIND(CHAR(62),A1))

    Any help truly appreciated
    Many Thanks
    Guapo

  2. #2
    Registered User
    Join Date
    02-12-2011
    Location
    London
    MS-Off Ver
    Excel MAC 2011
    Posts
    12

    Re: Extracting multiple text within brackets

    Forgot to mention there maybe any number of <1234> within a cell - probably no more than 30 I guess
    And the sizes amount of text can also vary significantly from <1> to <1234567890> etc

    Thanks

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Extracting multiple text within brackets

    assuming your data is in A!, try this...
    =LEFT(A1,SEARCH(">",A1,1))&MID(A1,SEARCH("<",A1,SEARCH(">",A1,1)),SEARCH(">",A1,SEARCH(">",A1,1)))&RIGHT(A1,LEN(A1)-SEARCH("<",A1,SEARCH(">",A1,SEARCH(">",A1,1)+1))+1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    02-12-2011
    Location
    London
    MS-Off Ver
    Excel MAC 2011
    Posts
    12

    Re: Extracting multiple text within brackets

    Hi,

    Many thanks for this.
    I have tried it and unfortunately it does not work - stays on "VALUE"!
    I tried it purely on the test data as I posted here.

    I will look at your formula and try to figure it out, any further advice greatly received.
    Many Thanks
    Guapo

  5. #5
    Registered User
    Join Date
    02-12-2011
    Location
    London
    MS-Off Ver
    Excel MAC 2011
    Posts
    12

    Re: Extracting multiple text within brackets

    Ok got it to work.

    It was my mistake, it works for 3 x <1234> in a cell.

    However a cell could have only 1 x <1234> or 30 x <1234> in a cell.

    If it is less or more than 3 of these, <1234> then it will not function, I probably was not so clear in my original explanation.

    Will continue to look to see if I can figure it out

    Thanks

  6. #6
    Registered User
    Join Date
    02-12-2011
    Location
    London
    MS-Off Ver
    Excel MAC 2011
    Posts
    12

    Re: Extracting multiple text within brackets

    These are some cell examples that it needs to work for;

    ggggg <test> lkjlkhlk <9090> jkjkjjk<88888>kjkjj<9090>

    Result needed: <test><9090><88888><9090>

    ggggg <test> lkjlkhlk <9090> jkjkjjk<88888>kjkjj<9090> ggggg <test> lkjlkhlk <9090> jkjkjjk<88888>kjkjj<9090>

    Result needed: <test><9090><88888><9090><test><9090><88888><9090>

    I have tried but unable to figure it out :-(

    Any help welcomed

    Thanks

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Extracting multiple text within brackets

    Probably the most versitile way to do this is with a UDF.

    This will clear any amount of characters outwith delimiters < and >

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


    See this workbook
    Attached Files Attached Files
    Last edited by Marcol; 12-14-2012 at 06:58 AM. Reason: corrected wrong description
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,592

    Re: Extracting multiple text within brackets

    UDF

    =Guapo(A1)

    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Extracting multiple text within brackets

    I'm afraid your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Cross posted on excelkey.com with different user name
    Last edited by Pepe Le Mokko; 12-14-2012 at 06:01 AM.

  10. #10
    Registered User
    Join Date
    02-12-2011
    Location
    London
    MS-Off Ver
    Excel MAC 2011
    Posts
    12

    Re: Extracting multiple text within brackets

    Understood
    Apologies for this.
    Won't happen again.

    I have not tried the fix yet. But a big thanks for the information.
    Best
    Guano

  11. #11
    Registered User
    Join Date
    02-12-2011
    Location
    London
    MS-Off Ver
    Excel MAC 2011
    Posts
    12

    Re: Extracting multiple text within brackets

    Thanks to everyone for your help on this, working well. !!

+ 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