+ Reply to Thread
Results 1 to 5 of 5

Split column into multiple rows

Hybrid View

  1. #1
    Registered User
    Join Date
    11-21-2019
    Location
    USA
    MS-Off Ver
    365
    Posts
    2

    Question Split column into multiple rows

    Hello,

    I am using Excel for O365 and I have a spreadsheet with multiple rows/columns like this:

    orig dest
    IA 37029, 37030, 37031, 37032, 37033
    IL 37029, 37030, 37031, 37032, 37034
    IN 37029, 37030, 37031, 37032, 37035

    I like to split the 'dest' column into multiple rows keeping 'orig' as is, by selectin the number of desired characters.

    Desire results when setting 'dest' size to 10 characters:

    orig dest
    IA 37029, 370
    IA 30, 37031,
    IA 37032, 37
    IA 033
    IL 37029, 370
    IL 30, 37031,
    IL 37032, 37
    IL 034
    IN 37029, 370
    IN 30, 37031,
    IL 37032, 37
    IN 37032, 37
    IN 035

    Thank you!

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,981

    Re: Split column into multiple rows

    This is a quick Unpivot using Power Query or in 365 as Get and Transform.


    Here is the Mcode. If you are not familiar with PQ, then click on the links in my signature.

    let
        Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"Column1"}, "Attribute", "Value"),
        #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"})
    in
        #"Removed Columns"
    EDIT: Just relooked at your request. It appears that all values are in two columns. Is that correct. Second column is separated by commas. I misinterpreted the data to be in several columns. Please confirm your layout of data and I will look at a new solution.
    Attached Files Attached Files
    Last edited by alansidman; 11-21-2019 at 07:00 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,981

    Re: Split column into multiple rows

    I think I figured out what you want. Try this Mcode instead

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1_2"]}[Content],
        #"Split Column by Position" = Table.SplitColumn(Source, "Column1.2", Splitter.SplitTextByRepeatedLengths(10), {"Column1.2.1", "Column1.2.2", "Column1.2.3", "Column1.2.4"}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Split Column by Position", {"Column1.1"}, "Attribute", "Value"),
        #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"})
    in
        #"Removed Columns"
    My results look like the following:

    v A B
    1 Column1.1 Value
    2 IA 37029, 370
    3 IA 30, 37031,
    4 IA 37032, 37
    5 IA 033
    6 IL 37029, 370
    7 IL 30, 37031,
    8 IL 37032, 37
    9 IL 034
    10 IN 37029, 370
    11 IN 30, 37031,
    12 IN 37032, 37
    13 IN 035
    Last edited by alansidman; 11-21-2019 at 07:09 PM.

  4. #4
    Registered User
    Join Date
    11-21-2019
    Location
    USA
    MS-Off Ver
    365
    Posts
    2

    Re: Split column into multiple rows

    This worked perfectly!!! Thank you very much.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,981

    Re: Split column into multiple rows

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

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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] Split 1 long column into multiple columns with dynamic number of rows
    By Bax in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-12-2018, 06:46 AM
  2. Split Single Row into multiple rows based on column data
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-29-2017, 01:57 PM
  3. [SOLVED] Multiple values in single cell (known column) split into rows with duplicate information
    By bwashbourne in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-06-2015, 05:00 PM
  4. [SOLVED] Split column into multiple columns at predetermined rows
    By nukeemaway in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-30-2012, 09:32 AM
  5. Replies: 10
    Last Post: 07-22-2012, 07:32 PM
  6. Split cell data into multiple new rows and copy other column values
    By jooga in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-01-2010, 02:30 AM
  7. Replies: 2
    Last Post: 03-07-2006, 04:46 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