+ Reply to Thread
Results 1 to 6 of 6

Transpose Columns into Rows based on Unique Identifier for n columns

  1. #1
    Registered User
    Join Date
    03-01-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    3

    Transpose Columns into Rows based on Unique Identifier for n columns

    Hi,

    I'm new to VBA and am struggling to find any solutions for this problem - I have a spreadsheet which contains about 10k rows and 21 columns. The data has identifiers in Column C and I'm trying to write some kind of VBA Code to transpose the data into a new sheet based on the identifier in Column C.

    Below is how the data is set out for column C
    C
    1111111
    1111111
    1111111
    1111111
    1111111
    1111112
    1111113
    1111113
    1111113
    1111113
    1111113
    1111113
    1111113
    1111113
    1111114
    1111114
    1111115

    The code I am trying to get is to copy and paste values into "Sheet 2" which goes down the columns and transposes until the ID in column C is different from the next one. The number of Ids in column C that will be the same ranges from 1 to 10. so it will look like the below (obviously with lots of columns added):
    C
    1111111
    1111112
    1111113
    1111114
    1111115

    I have attached a copy of a sample of the spreadsheet that should make it clearer. I have only included 16 columns but there will be 21 but if there is a way of making this work for n-columns that would be amazing! I'm happy with having loads and loads of columns to work with...

    Thanks!!
    Attached Files Attached Files

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

    Re: Transpose Columns into Rows based on Unique Identifier for n columns

    HI..

    Can you reattach the sample workbook but this time include the desired result for that sample set on sheet2

  3. #3
    Registered User
    Join Date
    03-01-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    3

    Re: Transpose Columns into Rows based on Unique Identifier for n columns

    Hi,

    Thanks for coming back so quickly and apologies - that would have made things clearer! I've attached a file with the output in Sheet2.

    Thank you very much!
    Attached Files Attached Files

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Transpose Columns into Rows based on Unique Identifier for n columns

    This will work for your example worksheet.

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  5. #5
    Registered User
    Join Date
    03-01-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    3

    Re: Transpose Columns into Rows based on Unique Identifier for n columns

    Wow - that worked perfectly! Thanks so much!

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Transpose Columns into Rows based on Unique Identifier for n columns

    Your welcome.

+ 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] Identify difference in value between two columns based on matching of unique identifier
    By rn_ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2017, 07:38 PM
  2. Replies: 0
    Last Post: 02-09-2017, 01:20 PM
  3. Replies: 0
    Last Post: 02-09-2017, 01:10 PM
  4. Replies: 0
    Last Post: 02-09-2017, 01:03 PM
  5. Merging Rows & Columns on Unique Identifier
    By oxv in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-20-2012, 06:52 PM
  6. Transpose Multiple Columns to one Row with Unique Identifier
    By PleaseHelp! in forum Excel General
    Replies: 4
    Last Post: 05-07-2012, 07:43 PM
  7. Replies: 1
    Last Post: 12-07-2009, 07:02 PM

Tags for this Thread

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