+ Reply to Thread
Results 1 to 12 of 12

Moving sets of rows into a single row

  1. #1
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Frederick, MD, USA
    MS-Off Ver
    Excel 2007
    Posts
    125

    Moving sets of rows into a single row

    Let's say I have a table with, say, three columns and thirty rows. The majority of these rows will be empty, but three of four of these rows will have data in them.

    Is there a way to pull only those rows that have data in them into a new sheet, and put them all on the same row?

    Example: Table 1 has a lot of blank rows, but row 3 has values A, B, C in its three columns, and row 6 has values F G H in its rows. I'd like Table2 to pull those into a single row, with values A B C F G H across six columns.

    Table1
    (blank row)
    (blank row)
    A B C
    (blank row)
    (blank row)
    F G H
    (blank row)
    (blank row)

    Table 2:
    A B C F G H


    (This needs to be done formulaically, not with VBA)
    Last edited by Gunther Maplethorpe; 09-21-2015 at 03:09 PM.

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Moving sets of rows into a single row

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

    Regards

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

    Re: Moving sets of rows into a single row

    Pls ignore, VBA solution suggested
    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.

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

    Re: Moving sets of rows into a single row

    Quote Originally Posted by José Augusto View Post
    Try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Regards
    I'm getting the result on more than one row.

  5. #5
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Moving sets of rows into a single row

    Sorry for post #2
    Try this
    =OFFSET($A$1,2+3*QUOTIENT((COLUMN(A1)-1),3),MOD(COLUMN(A1)-1,3))
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Regards

  6. #6
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Frederick, MD, USA
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Moving sets of rows into a single row

    Maybe I should have been more clear with my example. The blank rows aren't always evenly spaced - that is, it's not always two blanks rows, then a row of info, then two blank rows, etc. The non-empty rows are varied throughout the initial table. Could be the first and 74th rows that are non-empty...or conceivably ti could be up to a dozen full rows within that thirty-row table.

    Attached is better example of what I have and need...

    ManyRows to OneRow.xlsx
    Last edited by Gunther Maplethorpe; 09-21-2015 at 02:01 PM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,215

    Re: Moving sets of rows into a single row

    Edited by JT
    Last edited by JohnTopley; 09-21-2015 at 02:06 PM.

  8. #8
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Frederick, MD, USA
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Moving sets of rows into a single row

    Quote Originally Posted by JohnTopley View Post
    Is the result a single row?
    I'd like all the results in a single row, yes...that's kind of the whole thing, is moving sections of several rows into a single row, while eliminating the empty cells. Like concatenating, but instead of combining cells into one, just added cells onto a growing row.

  9. #9
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Moving sets of rows into a single row

    Hi
    Solution 1: Use the F column (Sheet1!F2:F30)
    with this array formula in F2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy it to Sheet1!F3:F30
    Place the following formula in Sheet2!A4 and copy it to Sheet2!B4:T4
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Solution 2: Place the following array formula in Sheet2!A6 and copy it to Sheet2!B6:T6
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note: 5 is the same as COLUMNS(Sheet1!$A$2:$E$30)
    See the file ManyRows to OneRow.xlsx
    Best regards

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Moving sets of rows into a single row

    And another way. Array-entered and filled across
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Attached Files Attached Files
    Dave

  11. #11
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Frederick, MD, USA
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Moving sets of rows into a single row

    Thanks, guys. I was able to modify both of your solutions to work for what I need.

    To help me learn (and because I can see this being useful in the future), is there a simple modification to do a similar process, where a table of 6 columns with many empty rows is returned to a new table of 6 columns, but not returning the empty rows? I feel like either one of these should be easily changed to accomplish just that, but I'm not able to make it work.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,215

    Re: Moving sets of rows into a single row

    try

    enter in A2 of Sheet2 of the file you posted


    =IFERROR(INDEX(Sheet1!A$2:A$100,SMALL(IF(ISTEXT(Sheet1!$A$2:$A$100),ROW($A$2:$A$100)-ROW($A$2)+1,""),ROWS($A$2:A2))),"")

    Enter with Ctrl + Shift + Enter

    Copy across as many columns as needed and the copy down

+ 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. Moving data from multiple rows to a single one
    By martinez_pedro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2014, 01:03 AM
  2. moving multiple rows to a single row using macros
    By meloneis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-15-2013, 03:26 PM
  3. Need help moving multiple lines of data in single cell to unique subsequent rows
    By brettmburns in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-21-2012, 03:04 PM
  4. Converting Multiple sets of rows to a single row
    By JuJuBe in forum Excel General
    Replies: 4
    Last Post: 05-11-2012, 10:56 AM
  5. Replies: 8
    Last Post: 11-20-2011, 09:48 AM
  6. Combining duplicates into single rows and moving to a new sheet
    By matty ice in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-09-2011, 12:41 PM
  7. Moving sets of rows to the next page
    By cenotediver896 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2010, 02: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