+ Reply to Thread
Results 1 to 10 of 10

Extract text from second set of brackets

  1. #1
    Registered User
    Join Date
    12-04-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    9

    Extract text from second set of brackets

    Hi Excel masters,

    I have a string of text in one cell that's broken up by multiple brackets. The brackets include a date stamp and the name of the person who changed the record. It looks like this:
    [MMM-DD-YY fname lname] desired text 1

    [MMM-DD-YY fname lname] desired text 2

    [MMM-DD-YY fname lname] desired text 3[

    (The end bracket "[" after "desired text 3" is intentional--it's been concatenated onto the text string.)

    What I'm trying to do is find a formula to extract "desired text 2" into one cell and then "desired text 3" into a separate cell, but I don't understand how to find the second and third set of brackets. Does anyone know of a formula that would work?

    Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: Extract text from second set of brackets

    It's hard to point you on a good track without seeing actual example and their results (a small spreadsheet would be great). I would look into DATA, Text To Columns - in my example, I used DELIMITED, and for the delimiters, I had TAB, SPACE and OTHER selected. In the OTHER, i placed the right bracket "]" (don't enter the quotes)....this separated/ parsed my data into the separate fields. Do some experimenting and you'll probably get it. PS this will put the items you are separating into the columns next to them, so be sure to have room OR copy them to another location.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,976

    Re: Extract text from second set of brackets

    With your data in A1, use this in B1, copied across and down:

    =TRIM(MID(SUBSTITUTE("¦"&SUBSTITUTE(SUBSTITUTE($A1,"[","¦"),"]","¦"),"¦",REPT(" ",150)),450+300*COLUMNS($A:A),150))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    12-04-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    9

    Re: Extract text from second set of brackets

    Thank you both! @queuesef, I can't add any additional columns, unfortunately, because it would mess with the integrity of the spreadsheet.

    @Glenn: your did work, but the returned text was cut off at 11 characters. The text I want pulled isn't uniform in terms of the number of characters, so is there a formula that will return everything up until the next "["?

  5. #5
    Registered User
    Join Date
    12-04-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    9

    Re: Extract text from second set of brackets

    I misspoke--it doesn't cut off the characters at 11, but for some reason part of the output text has been cut off for several of the cells. The others are working perfectly and returning the entire text up until the next open bracket. It doesn't seem like the length of the text string matters, since some longer ones are returning just fine and some shorter ones are being cut off. Do you know what's going on?

    I can upload a spreadsheet of what I'm seeing, but I don't know if I could replicate what's happening after anonymizing the data.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,976

    Re: Extract text from second set of brackets

    Not sure that I agree with you... How long are the text strings? This will break down eventually.... Try the modified file, with longer strings. In your real data =LEN(a1) returns what?? Typically/maximum
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    11-02-2016
    Location
    NY
    MS-Off Ver
    2010
    Posts
    459

    Re: Extract text from second set of brackets

    try pasting them into another tab or worksheet....see if it gets you desired results.

  8. #8
    Registered User
    Join Date
    12-04-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    9

    Re: Extract text from second set of brackets

    The vast majority (~90%) only have one character. The longest number of characters is 1607. This field is is all of the notes on a sales record combined together, so there's a lot of variety.

    I was able to create a formula that pulls the text starting at "desired text 2", but I'm not able to cut off the rest of the string. Here it is:

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

  9. #9
    Registered User
    Join Date
    12-04-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    9

    Re: Extract text from second set of brackets

    Ah!! I figured out the issue! My data was in AY, not A, so the "column" part of your formula was off.

    Thank you!!! This is perfect now!
    Last edited by km3033; 02-01-2018 at 03:44 PM.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,976

    Re: Extract text from second set of brackets

    You will need to post a sample. Without seeing what you're seeing...this is a guessing game.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to extract text between brackets/parentheses in Excel?
    By chief_abound in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-19-2015, 05:12 AM
  2. Replies: 13
    Last Post: 08-28-2014, 08:00 PM
  3. Replies: 1
    Last Post: 07-17-2014, 04:54 AM
  4. [SOLVED] extract data from within brackets
    By L.LEE in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-16-2014, 11:36 PM
  5. [SOLVED] How to extract data from brackets, [xx] and amend them?
    By eldarchen in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-03-2014, 09:56 AM
  6. find and extract the numbers in between brackets
    By kwfine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2011, 04:20 PM
  7. How to extract a string within brackets repeatedly
    By wussupbuddy in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-11-2008, 10:38 AM

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