+ Reply to Thread
Results 1 to 7 of 7

Is there way to split data into multiple rows?

  1. #1
    Registered User
    Join Date
    07-22-2015
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Is there way to split data into multiple rows?

    What I have looks like this:

    1 a b c
    2 d e
    3 f g h

    and I want it to end up like this:

    1 a
    1 b
    1 c
    2 d
    2 e
    3 f
    3 g
    3 h

    There is not a constant number of entries in each row at the moment. Does anyone have any ideas?

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Is there way to split data into multiple rows?

    I'm just about to go out, but take a look at this thread that I've just responded to:

    http://www.excelforum.com/excel-form...to-colums.html

    That is similar to yours, but has a fixed number of columns to transpose. For yours, you will need to count the number of entries in each row and then use a table of cumulative entries to determine which row to get the data from.

    I'll take a further look when I get back in this afternoon.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    07-22-2015
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Re: Is there way to split data into multiple rows?

    Thanks for this. I haven't been able to do anything clever to deal with the non fixed number of columns but the formula for a fixed number just returns a zero if the cell is blank so at the end of the process I just filtered those out and deleted them. A brute force approach, but it works and didn't take much time at all. Thanks again.

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Is there way to split data into multiple rows?

    If the data is in separate columns this will work:

    Please Login or Register  to view this content.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Is there way to split data into multiple rows?

    Hi Squibfish,

    I've set this up in the attached file, along the lines that I outlined before. I've set up some test data in columns A to K, allowing up to 10 columns of data. I've used this formula in M2:

    =COUNTA(B2:K2)

    and this one in N2:

    =IF(M2=0,"",M2+N1)

    and I have copied these down to row 10 to set up the table that I mentioned. It is important to put zero in cell N1.

    Then I have this formula in P1:

    =IF(ROWS($1:1)>MAX(N:N),"",INDEX($A$2:$A$5,MATCH(ROWS($1:1)-1,N:N)))

    which gets the data from column A, and this one in Q1:

    =IF(ROWS($1:1)>MAX(N:N),"",INDEX($B$2:$K$5,MATCH(ROWS($1:1)-1,N:N),ROWS($1:1)-INDEX(N:N,MATCH(ROWS($1:1)-1,N:N))))

    which brings the appropriate data from columns B to K. These two formulae are then copied down as far as you need them (I've copied to row 25, although they only need to go to row 18 - you just get blanks if there is no more data).

    All the data is in consecutive rows, so there is no need to filter and remove blanks.

    Hope this helps.

    Pete
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-22-2015
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Re: Is there way to split data into multiple rows?

    That's great. Thanks Pete

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Is there way to split data into multiple rows?

    Glad to help.

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

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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 cell data into multiple rows and keep associated data
    By aeb430 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-04-2015, 06:49 PM
  2. 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
  3. Split Row Into Multiple Rows based on Count of Data
    By bchilme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2014, 05:58 PM
  4. I want to split row data to multiple rows
    By SumitM in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2013, 05:37 AM
  5. [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
  6. Split a row of data into multiple rows
    By chuckyfang in forum Excel General
    Replies: 2
    Last Post: 03-19-2013, 06:13 PM
  7. 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

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