+ Reply to Thread
Results 1 to 13 of 13

Transposing column into multiple rows

  1. #1
    Registered User
    Join Date
    02-16-2010
    Location
    RTP, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Exclamation Transposing column into multiple rows

    Hi all,

    I've got an issue where I'm trying to transpose data from one column into several rows. I've been looking for a macro to help me out but can't seem to find a way to do this. Does anyone have any idea how I can do this?

    Ideally, the macro would be written so it would find the data in the column and move it to a new sheet and then it would repeat the process throughout the document. The macro would know that the data is grouped b/c of the blanks found between the data set. So as the macro is running, once it hits a blank, it would then copy and transpose the data and continue. Does this make sense?

    I've posted a sample of the info I'm working with.
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Transposing column into multiple rows

    Hi,

    Enter in C1 the following and copy across to P1

    Please Login or Register  to view this content.
    Now copy C1:P1 and paset it down to row 2417.

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-16-2010
    Location
    RTP, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Transposing column into multiple rows

    Hi Richard,

    Thanks for the quick response. I really appreciate you helping out with this. I tried it but it appears that once it's copied down, it doesn't reflect the same data, as I think (guessing here) that the formula is set to read 15 rows and then transpose?

    The data in the column differs as some may only have 13 rows and others have 15 or even 16. Does that make sense?

    Thanks!
    Jason

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Transposing column into multiple rows

    Hi Jason,

    Yes that would tend to screw it up

    Before I give some thought as to how to automatically add rows where necessary so that each block consist of 16 rows (if that's the maximum), so that the formulae will work, is it possible to extract the data from your source system so that it automatically includes blank rows.

    The other question is, apart form missing descriptors are all the records consistent in that the same descriptor always follows the previous descriptor in each block?

    Regards

  5. #5
    Registered User
    Join Date
    02-16-2010
    Location
    RTP, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Cool Macro for transposing column into multiple rows?

    Hi all,

    I've got an issue where I'm trying to transpose data from one column into several rows. I've been looking for a macro to help me out but can't seem to find a way to do this. Does anyone have any idea how I can do this?

    Ideally, the macro would be written so it would find the data in the column and move it to a new sheet and then it would repeat the process throughout the document. The macro would know that the data is grouped b/c of the blanks found between the data set. So as the macro is running, once it hits a blank, it would then copy and transpose the data and continue. Does this make sense?

    I've posted a sample of the info I'm working with and what i'm looking to do.

    Many thanks!
    Attached Files Attached Files

  6. #6
    Forum Contributor marc5354's Avatar
    Join Date
    11-10-2009
    Location
    India
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    217

    Re: Macro for transposing column into multiple rows?

    In C2 and copy down and across, =INDEX($A:$A, 5 * ROW() + COLUMN() - 12)

  7. #7
    Forum Contributor marc5354's Avatar
    Join Date
    11-10-2009
    Location
    India
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    217

    Re: Macro for transposing column into multiple rows?

    Adjust this number: =INDEX($A:$A, 5 * ROW() + COLUMN() - 12)

  8. #8
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Macro for transposing column into multiple rows?

    Hi, If you have data in column "A" seperated by blank rows then this code will copy the Seperate sub sets to sheet (2) and transpose it to rows.
    Please Login or Register  to view this content.
    Regards Mick

  9. #9
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129

    Re: Transposing column into multiple rows

    There may be another way faster, but this code would work:
    PHP Code: 
    Sub Trans()
    Dim Rng As String
        RowCount 
    Sheets("info").[b100000].End(xlUp).Row 1
        FirstR 
    1CountR 0TmpHeight 0
        
    Do
            
    CountR CountR 1
            TmpHeight 
    TmpHeight 1
            
    If Sheets("info").Cells(CountR2) = "" Then
                Rng 
    Range(Cells(FirstR2), Cells(CountR2)).Address
                Sheets
    ("result").Cells(1000001).End(xlUp).Offset(10).Resize(, TmpHeight) = _
                WorksheetFunction
    .Transpose(Sheets("info").Range(Rng))
                
    FirstR CountR 1
                TmpHeight 
    0
            End 
    If
        
    Loop Until CountR >= RowCount
    Sheets
    ("result").Select
    EndR 
    Sheets("result").[a100000].End(xlUp).Row
    Range
    ("A1:A" EndR).Select
    Selection
    .AutoFilter field:=1Criteria1:=0
    Selection
    .Offset(1).EntireRow.Delete
    Selection
    .AutoFilter

    End Sub 
    The last 6 command lines are writen because I have seen that there are somewhere 2 blank rows.
    Attached Files Attached Files
    Last edited by ptm0412; 02-16-2010 at 02:24 PM.
    Oldman Chatting: [email protected] Mailing: [email protected]

  10. #10
    Registered User
    Join Date
    02-16-2010
    Location
    RTP, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro for transposing column into multiple rows?

    That did it! thank you all for taking a look at this! i really appreciate it!!

  11. #11
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Transposing column into multiple rows

    Jdubbie, you've started two threads about the same topic. This is duplicate posting and not allowed in this forum.

    Since both of your threads have received several responses, I will not lock them, as I normally would.

    Please take a moment to read the forum rules before you post again.

  12. #12
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Transposing column into multiple rows

    Doesn't appear to have anything to do with 2008 though...
    Remember what the dormouse said
    Feed your head

  13. #13
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Transposing column into multiple rows

    jdubbie, I've merged the two threads into one and left it in the Programming Forum, where it is more appropriately located. Please take care in the future to select the correct forum and post only one thread about one topic.

    thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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