+ Reply to Thread
Results 1 to 5 of 5

[SOLVED] Insert Rows and Transpose Data

  1. #1
    Registered User
    Join Date
    07-09-2012
    Location
    Columbia, MO
    MS-Off Ver
    Excel 2010
    Posts
    3

    [SOLVED] Insert Rows and Transpose Data

    Hi Guys,

    I am new to the forum and to the world of excel Macros programming and would appreciate if some one can help me on a particular problem that I have. I have a excel sheet which has multiple rows as each row corresponds to a unique ID. Each unique ID has 5 values associated with it and are displayed on corresponding columns. I need to do the following. For each unique ID I need to insert two rows after it and transpose the 2nd value below 1st and 4th and 5th value below 3rd value in the sheet. I have also attached a sheet for what I need help on so that it is easier to understand the problem. Although I have only represented 3 rows for simplicity, but I have to to this for a worksheet which has more than 5000 Unique ID's. So it would be awsome if the macro can recognize the next unique ID and keep repeating this task

    I appreciate the effort and time spent to do this

    Many thanks
    sks262
    Attached Files Attached Files
    Last edited by sks262; 07-10-2012 at 01:36 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Insert Rows and Transpose Data

    Hi sks262 and welcome to the forum,

    Find the attached where I've turned you Crosstab table into a normal Excel Table and did a Pivot Table on it. I have also included the code to automate this task. Let me know if the Pivot Table answer will work for you.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Insert Rows and Transpose Data

    Hello sks262,

    Welcome to the Forum!

    In addition to Marvin's solution, this one use VBA. It will add the new lines, transposed data, and formatting to all the cells. The macro starts on row 4 as does your example. If you actual data starts on a different row, you will need to make this change to the macro code. It is bold below. A button has been added to run the macro in the attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    07-09-2012
    Location
    Columbia, MO
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Insert Rows and Transpose Data

    Thanks MarvinP. It worked. Appreciate your quick help

  5. #5
    Registered User
    Join Date
    07-09-2012
    Location
    Columbia, MO
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Insert Rows and Transpose Data

    Ross, Thank you so much for taking the pain to write the code for me. Truly appreciate your help and Yes the code works. I am amazed by the selfless help demonstrated by the forum members.

    Best Regards
    Sunil

+ 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