+ Reply to Thread
Results 1 to 14 of 14

Extract Words with Delimiters from a String where more than one occurs in the string

  1. #1
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Extract Words with Delimiters from a String where more than one occurs in the string

    Hi Forum,

    I have many rows of text where there are values delimited by '[' , ']', '(' , ')' , & also by ' and '.

    Example;

    Please Login or Register  to view this content.
    I've got this example data in Excel in Column 'A' and wanted to copy the values (with Delimiters) to Column B, then C, then D etc, until there are no more occurrences of the Delimiters for that row.

    So the desired output for this example going from Column 'B' would be as below;

    Col B-----Col C-----Col D-----Col E------Col F--------Col G-----------Col H
    [Calc]---'ABC123'--[Acct]--- 'Rev'--- [Desc]---'05 - Central'---([Amt]/0.1)

    The values could also go beyond Column 'H'

    I've had a look at some examples but they have been extracting all text between the first & the last '[' where there's more than one value in '['.

    I've also investigated going step by step through each string and apply an If Statement to show the position number inside the string where it equals '[' but there's got to be a better way.

    Thanks Pete
    Remember you are unique, like everyone else

  2. #2
    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
    44,036

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    This is probably achievable with a formula, too. However, we need more than ONE sample. We need about 10-20 rows of FULLY representative data.

    The separators are ELSEIF AND THEN =, <> and perhaps others.... but what others????

    Confirm that you are ONLY interested in a VBA solution, that you are using a PC (at least Excel 2013... and not a Mac) and provide a sample sheet.
    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

  3. #3
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Hi
    For this particular example you summitted
    And for PC Not Mac
    you might try this code
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Thanks Glenn,

    I appreciate your response, but I think mohadin has the answer I need.

    Pete

  5. #5
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Hi mohadin,

    I think this code is missing the first string with '[' and ']' delimiters.

    Can your code add this in?

    Thanks

  6. #6
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Thank you
    Do you mean This

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Hi mohadin,

    This still misses the first string inside the first '[ ] ' brackets?
    Are these regular expressions in a certain order as they could be in any order?

    Thanks

  8. #8
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Are these regular expressions in a certain order as they could be in any order?
    Not necessarily as you can see in this
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Thanks but this still misses the first string inside the first '[ ] ' brackets?

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

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Try
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Thanks jindon,
    Perfect!

  13. #13
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    Thanks again mohadin

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

    Re: Extract Words with Delimiters from a String where more than one occurs in the string

    You are welcome and thanks for the rep.

+ 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. Extract string between delimiters
    By luisj in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-19-2021, 03:22 PM
  2. Extract string of text in the middle of 2 delimiters
    By MoldyBread in forum Excel General
    Replies: 3
    Last Post: 05-07-2018, 07:21 AM
  3. Replies: 4
    Last Post: 10-25-2016, 04:45 PM
  4. [SOLVED] Extract 5th string onwards but exclude 6th string onwards if found a specificlist of words
    By suchetherrah in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-07-2016, 03:48 AM
  5. [SOLVED] Extract string between delimiters
    By Apexeon in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-27-2015, 06:23 PM
  6. [SOLVED] Extract all the words from a string for processing, while leaving string intact.
    By staggers47 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-10-2014, 02:02 PM
  7. Replies: 9
    Last Post: 10-17-2011, 04:33 PM

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