+ Reply to Thread
Results 1 to 16 of 16

Split Text with Varying Delimiter

  1. #1
    Forum Contributor
    Join Date
    01-15-2015
    Location
    philippines
    MS-Off Ver
    Excel 365
    Posts
    116

    Split Text with Varying Delimiter

    Hi Guys,

    I need help with splitting text that has multiple delimiters.

    Name 1 2 3 4 5 6 7 8 9
    Jim (1) Brown (2) Matt (3) Jim 1 Brown 2 Matt 3

    The table shown has 10 columns and 2 rows and originates at cell A1.
    The entry in cell A2 is manually added and would continue down depending on the X number of entries.
    The expected results are as shown on the table.

    Cell B2 is where I would put my first formula, to be dragged down and to the side.
    I used this formula:
    =TRIM(MID(SUBSTITUTE($A2,"(1)",REPT(" ",LEN($A2))),(B1-1)*LEN($A2)+1,LEN($A2)))

    It is with the part that is colored red that I am having a problem. It only works if it can find "(1)", and if the value inside the parenthesis changes, it no longer works.
    I dont know how to incorporate wildcards. I tried, but it did not work.
    Hoping you can help me out.
    Thanks as always.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,717

    Re: Split Text with Varying Delimiter

    As always, will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    01-15-2015
    Location
    philippines
    MS-Off Ver
    Excel 365
    Posts
    116

    Re: Split Text with Varying Delimiter

    Hi AliGW,

    Apologies for that. Attached is the workbook.
    Attached Files Attached Files

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,717

    Re: Split Text with Varying Delimiter

    Try this:

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A2,"(","|"),")","|"),"|",REPT(" ",LEN($A2))),(B1-1)*LEN($A2)+1,LEN($A2)))

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,717

    Re: Split Text with Varying Delimiter

    And to get rid of your helper row:

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A2,"(","|"),")","|"),"|",REPT(" ",LEN($A2))),(COLUMNS($A:A)-1)*LEN($A2)+1,LEN($A2)))

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,717

    Re: Split Text with Varying Delimiter

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  7. #7
    Forum Contributor
    Join Date
    01-15-2015
    Location
    philippines
    MS-Off Ver
    Excel 365
    Posts
    116

    Re: Split Text with Varying Delimiter

    Wow! Absolutely wonderful. Worked like a charm.
    Thank you so much. I didn't know you can figure it out that fast.
    Pardon my ignorance, why is there a need for "|"?

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,717

    Re: Split Text with Varying Delimiter

    It could be any delimiter of your choosing. Basically, your formula requires the delimiters to be the same, so you could just as easily do this:

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE($A2,"(",")"),")",REPT(" ",LEN($A2))),(COLUMNS($A:A)-1)*LEN($A2)+1,LEN($A2)))

    I just like the pipe symbol.

  9. #9
    Forum Contributor
    Join Date
    01-15-2015
    Location
    philippines
    MS-Off Ver
    Excel 365
    Posts
    116

    Re: Split Text with Varying Delimiter

    Wow thank you.
    This is one of the fastest solutions I have gotten so far.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,717

    Re: Split Text with Varying Delimiter

    You're welcome!

    You got lucky - I happened to be here and I happened to know the answer.
    Last edited by AliGW; 08-06-2018 at 05:35 AM.

  11. #11
    Forum Contributor
    Join Date
    01-15-2015
    Location
    philippines
    MS-Off Ver
    Excel 365
    Posts
    116

    Re: Split Text with Varying Delimiter

    True to that!

  12. #12
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: Split Text with Varying Delimiter

    try this start at B2
    =IF(ISEVEN(COLUMN(A:A)),FLOOR(COLUMN(A:A)/2,1),SUBSTITUTE(MID(SUBSTITUTE($A3,")",REPT(" ",LEN($A3))),TRUNC((COLUMN(A:A)-1)/2)*LEN($A3)+1,LEN($A3)),"("&TRUNC((COLUMN(A:A)-1)/2)+1,""))

    copy right

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,717

    Re: Split Text with Varying Delimiter

    Why so complicated a formula? In what way does it improve on the suggestions made earlier in the thread? I'm all for alternative options, but this one is far more complicated than it needs to be, in my view.

  14. #14
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: Split Text with Varying Delimiter

    try this start at B2
    =IF(ISEVEN(COLUMN(A:A)),FLOOR(COLUMN(A:A)/2,1),SUBSTITUTE(MID(SUBSTITUTE($A3,")",REPT(" ",LEN($A3))),TRUNC((COLUMN(A:A)-1)/2)*LEN($A3)+1,LEN($A3)),"("&TRUNC((COLUMN(A:A)-1)/2)+1,""))

    copy right

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,717

    Re: Split Text with Varying Delimiter

    But WHY? What is the benefit of such a complicated formula over the much simpler one I offered? Please answer the question.

  16. #16
    Valued Forum Contributor jtakw's Avatar
    Join Date
    05-05-2018
    Location
    CA, USA
    MS-Off Ver
    2016
    Posts
    668

    Re: Split Text with Varying Delimiter

    Hi,

    How about this one, in B2 copied across.

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A2,"(",""),")","")," ",REPT(" ",100)),COLUMNS($B2:B2)*100-99,100))

+ 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. Separating alpha and numeric characters, no delimiter, varying lengths
    By Trevor K in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-21-2016, 01:46 AM
  2. How to split a column at first delimiter only
    By Jonathan78 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-07-2016, 08:32 AM
  3. [SOLVED] Separating alpha and numeric characters, no delimiter, varying lengths
    By Trevor K in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-21-2015, 09:40 PM
  4. [SOLVED] Split text and number field with no delimiter
    By lasario in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-14-2014, 07:06 PM
  5. Split Text using numbers as Delimiter.
    By ksalsaadi in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-26-2012, 12:42 AM
  6. Replies: 3
    Last Post: 10-27-2010, 03:11 AM
  7. Split Cell by Delimiter, Move to New Row...
    By jpfulton in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-16-2008, 03:43 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