+ Reply to Thread
Results 1 to 22 of 22

Split columns at the fourth ''/'', repeat after '';''

  1. #1
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Split columns at the fourth ''/'', repeat after '';''

    Hi!

    I need to split a column of cells into two columns. The data in the cell of the column looks like this:

    UK/H/1228/001/R/001;
    UK/H/1228/002/R/001;
    UK/H/1228/004/R/001;
    UK/H/1228/005/R/001

    I need it to split this cell into two cells, the delimiter being the fourth ''/'', but this should be repeated after the '';''. so the data should look like this:

    column a:
    UK/H/1228/001
    UK/H/1228/002
    UK/H/1228/004
    UK/H/1228/005

    Column b:
    /R/001;
    /R/001;
    /R/001;
    /R/001

    Additionaly, if there is an instance of the data beginning with ''emea'', the delimiter must be the fifth ''/''.

    Is this possible?

    Thank you very much for your help.

  2. #2
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Split columns at the fourth ''/'', repeat after '';''

    Hi -In your orignial data is UK/H/1228/005 is part constant across all records?
    If solved kindly remember to mark Thread as solved.
    Click the small star icon at the bottom left of my post if this was useful.

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

    Re: Split columns at the fourth ''/'', repeat after '';''

    Here, try this:

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

  4. #4
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Split columns at the fourth ''/'', repeat after '';''

    Assuming data is in starts from A1,

    use this in B1

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


    and this in C1

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by kbkumar; 11-07-2012 at 10:43 AM.

  5. #5
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Re: Split columns at the fourth ''/'', repeat after '';''

    This would be it but all the data is in one cell.

    Can it still be done? Hvala

  6. #6
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Re: Split columns at the fourth ''/'', repeat after '';''

    I'm not sure I understod your question, but this is a form in which all the data is written, but it's different in every cell.

  7. #7
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Re: Split columns at the fourth ''/'', repeat after '';''

    Just a 'lil bump

    So, zbor's function is a good start but all the data is in one cell...

    Thanks again!

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,614

    Re: Split columns at the fourth ''/'', repeat after '';''

    And solution need to be in one cell or in multiple rows?
    It's hard to see from what you write above what is one cell and what not.
    Why don't you upload example workbook with your input and desired output???

  9. #9
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Re: Split columns at the fourth ''/'', repeat after '';''

    Zvezek1.xlsx

    This is the actual worksheet. The blue cell is the original cell, the orange cells are the desired outcome.

    Thanks!

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

    Re: Split columns at the fourth ''/'', repeat after '';''

    Where would "emea" appear for 5th delimiter?

  11. #11
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Re: Split columns at the fourth ''/'', repeat after '';''

    In a different cell. There can't be a case where there are both types of values in the same cell.

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,614

    Re: Split columns at the fourth ''/'', repeat after '';''

    In what cell? Can you add into your example such case too?
    Made few examples that you might have (where to expect that word, what if different number of / etc etc) and add into your worksheet...

  13. #13
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Re: Split columns at the fourth ''/'', repeat after '';''

    example.xlsx

    This is it. Worksheet 1 is the current outline, worksheet 2 is the desired outcome.

    thanks again...

  14. #14
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,614

    Re: Split columns at the fourth ''/'', repeat after '';''

    Looks for me that in EMEA (EMEA/H/C/1059/II/021) is still same reulst after 4th /, not 5th:
    EMEA/H/C/1059
    /II/021

    right?

  15. #15
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Re: Split columns at the fourth ''/'', repeat after '';''

    Normally no (just realized this about that one), but still, these cases come up about once per 200 entries so I could sort it out manually...

    The real problem is splitting the other cells

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

    Re: Split columns at the fourth ''/'', repeat after '';''

    Here, try this code:

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

  17. #17
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,614

    Re: Split columns at the fourth ''/'', repeat after '';''

    Need to watch out if there are some blank cells in I column.
    use this to fix it:

    Please Login or Register  to view this content.

  18. #18
    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: Split columns at the fourth ''/'', repeat after '';''

    I might be tempted to go for two UDFs here

    Put Both Functions in a standard VBa module
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Use like this in Excel
    In J1
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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


    Drag/Fill both down.
    Attached Files Attached Files
    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.

  19. #19
    Registered User
    Join Date
    02-20-2008
    Posts
    12

    Re: Split columns at the fourth ''/'', repeat after '';''

    I had a few problems with blank cells, yes. But That did it perfectly.

    This really helped, thanks!

  20. #20
    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: Split columns at the fourth ''/'', repeat after '';''

    What "did it perfectly"?

    With the UDFs there is no problem with blank cells!

  21. #21
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,614

    Re: Split columns at the fourth ''/'', repeat after '';''

    Quote Originally Posted by Marcol View Post
    What "did it perfectly"?
    He's refering probably to mine On Error Resume Next part in post #17.
    I would strongly suggest him to test your functions too.

  22. #22
    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: Split columns at the fourth ''/'', repeat after '';''

    At a guess this might be where the OP is finding "blanks" i.e. space between delimiters.
    NP/H/0512/002/P/003; ; NP/H/0512/004/P/003; NP/H/0512/001/P/003; NP/H/0512/005/P/003

    If so change the UDF code to this
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ 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