+ Reply to Thread
Results 1 to 11 of 11

Complex splitting a cell into various columns

  1. #1
    Registered User
    Join Date
    03-02-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    29

    Complex splitting a cell into various columns

    Hi All

    I have a column which has 11,12,13,14 and 15 character reference numbers which I need to seperate it into several columns. This would have been easy if the lenghts of characters were the same using LEFT, MID and RIGHT functions but I am struggling.

    Here is a sample data and what I want to achieve.

    CS1314LONDW002

    I want to seperate the above into following

    A B C D E F (Column headers)
    CS 1314 LON DW 00 2

    Ideally I want to seperate it like above but becasue having different lenghts its making it beyond my expertise.
    The good thing is that the data is uniformed so the each reference number is identical so we can count from left for columns A and B, count from right for columsn F, E and D. C is the column that makes the difference in the character length so the difference should go in to column C.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Complex splitting a cell into various columns

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Complex splitting a cell into various columns

    We need more samples of your data to see why you can't use a simple MID() formula.
    Gary's Student

  4. #4
    Registered User
    Join Date
    03-02-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Complex splitting a cell into various columns

    Attached is a sample data.

    Thank you
    Attached Files Attached Files

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Complex splitting a cell into various columns

    Hi,

    The third entry in your list (CS1314LONDW023) does not match the format of the others as it does not contain the "00" string, only a single "0" - is this an error on your part?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Complex splitting a cell into various columns

    Also,

    Your desired splits for the first three entries (CS1314LONDW002, CS1314LONDW003 and CS1314LONDW023) repeat the "D" in the 3rd and 4th split, i.e. "LOND" & "DW". Can you exlain why this is the case?

    Regards

  7. #7
    Registered User
    Join Date
    03-02-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Complex splitting a cell into various columns

    you are right, thats an error, the last column should be a single digit and one next to last 02.

    Quote Originally Posted by XOR LX View Post
    Hi,

    The third entry in your list (CS1314LONDW023) does not match the format of the others as it does not contain the "00" string, only a single "0" - is this an error on your part?

    Regards

  8. #8
    Registered User
    Join Date
    03-02-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Complex splitting a cell into various columns

    "LOND" Stands for Londond and "DW" stands for a work order.

    I have over 10k with 100 different denominations. this was just a sample. data is unique except the region.


    Quote Originally Posted by XOR LX View Post
    Also,


    Your desired splits for the first three entries (CS1314LONDW002, CS1314LONDW003 and CS1314LONDW023) repeat the "D" in the 3rd and 4th split, i.e. "LOND" & "DW". Can you exlain why this is the case?

    Regards

  9. #9
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Complex splitting a cell into various columns

    Ok, but both "LOND" and "DW" are not present in those examples, unless you use the "D" 'twice'.

    Regards

  10. #10
    Registered User
    Join Date
    03-02-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Complex splitting a cell into various columns

    DOH!, Sorry I am loosing the plot.

    That is my mistake, it is LON and DW.

  11. #11
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Complex splitting a cell into various columns

    Hi,

    Cell B2 and copy down: =LEFT(A2,2)

    Cell C2 and copy down: =--MID(A2,3,4) [if you want numerical entries to be returned; if not, =MID(A2,3,4)]

    Cell D2 and copy down: =MID(A2,FIND(C2,A2)+4,FIND(E2,A2)-(FIND(C2,A2)+4))

    Cell E2 and copy down: =MID(A2,FIND(F2,A2)-2,2)

    Cell F2 and copy down: =LEFT(RIGHT(A2,3),2)

    Cell G2 and copy down: =--RIGHT(A2,1) [again, =RIGHT(A2,1) if you would prefer the result to be text]

    Note that some of these formulas depend on entries in subsequent columns being calculated, so don't expect to necessarily see all the correct results until you have all formulas in up to and including column G.

    Regards
    Last edited by XOR LX; 08-01-2013 at 11:50 AM.

+ 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. Splitting multiple entries in single cell into multiple columns
    By David_Mitchell in forum Excel General
    Replies: 12
    Last Post: 01-24-2013, 06:57 AM
  2. splitting multile lines in one cell into columns
    By m4rty5miff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2012, 08:53 AM
  3. splitting multiple lines in one cell into columns
    By m4rty5miff in forum Excel General
    Replies: 1
    Last Post: 02-10-2012, 12:15 PM
  4. Splitting columns
    By atomic_kitty in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-17-2007, 01:31 PM
  5. Splitting columns
    By BBB in forum Excel General
    Replies: 1
    Last Post: 08-10-2006, 11:20 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