+ Reply to Thread
Results 1 to 8 of 8

split cell data into multiple rows and keep associated data

  1. #1
    Registered User
    Join Date
    02-23-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    4

    split cell data into multiple rows and keep associated data

    I have an sheet that contains a list of groups and group members. Each row contains one group name in A1 and group members in B1. The members are delimited by carriage return and I know how to use text2columns with CRLF as a delimiter, but I need the data in rows.

    My end result is to have each group member listed on a separate row with the group name and I'm hoping this can be done with a macro.

    Added a sample sheet
    Attached Files Attached Files
    Last edited by aeb430; 02-24-2015 at 08:29 AM. Reason: added sample sheet

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: split cell data into multiple rows and keep associated data

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

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

    View Pic

  3. #3
    Registered User
    Join Date
    02-23-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    4

    Re: split cell data into multiple rows and keep associated data

    Thanks for the help. I have attached a sample sheet

  4. #4
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: split cell data into multiple rows and keep associated data

    Hi..

    I don't know how many rows you're going to have.. but in any case..this does it nice and fast...

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

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: split cell data into multiple rows and keep associated data

    Please Login or Register  to view this content.
    Last edited by snb; 02-25-2015 at 04:42 PM.



  6. #6
    Registered User
    Join Date
    02-23-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    4

    Re: split cell data into multiple rows and keep associated data

    Thanks for the help on this. One thing I should have mentioned is that while my sample data contains only three values in cells I need to split, the actual data file contains many values (over 900 in one of the cells). Is there any way to have the code split all the values regardless of how many exist in each cell?

    Thanks,
    aeb430

  7. #7
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: split cell data into multiple rows and keep associated data

    Hi..

    I am pretty sure the problem with mine was this line:
    Please Login or Register  to view this content.
    With so many values in 1 cell.. I was exceeding the 256 character limit that Transpose could handle for 1 element of an array.. I think that's how to put it.. if I am wrong.. someone please let me know..

    Replacing that with:
    Please Login or Register  to view this content.
    And then Redimming the Upper Bound of the 1st Dimension of the y array to the value of b got me around that.

    Replace y with b in a couple of places (upper bound of "i" loop and "If k>" test) and it works.

    Please Login or Register  to view this content.
    I must point out that snb's code doesn't have this same issue.. and works for me as it is.. although i didn't test it on cells with over 900 values.. (maybe 150+).. but it shouldn't make a difference..

    I have attached a Workbook showing snb's and my code working.. check B2 on Sheet1(thats where i added more values)..
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-23-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    4

    Re: split cell data into multiple rows and keep associated data

    awesome, thanks guys!

+ 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. Split one row with data sets into multiple rows with one data set
    By coopbeer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-26-2014, 11:05 AM
  2. [SOLVED] Split a cell of data into multiple rows
    By otterandrews in forum Excel General
    Replies: 4
    Last Post: 03-24-2013, 11:59 PM
  3. Split a row of data into multiple rows
    By chuckyfang in forum Excel General
    Replies: 2
    Last Post: 03-19-2013, 06:13 PM
  4. Row split in to multiple rows based on cell data
    By bosuck in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-08-2011, 05:30 PM
  5. 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

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