+ Reply to Thread
Results 1 to 8 of 8

Macro Help for transpose

  1. #1
    Registered User
    Join Date
    11-10-2014
    Location
    MUSCAT
    MS-Off Ver
    2007
    Posts
    4

    Macro Help for transpose

    Hi,

    I have a data which looks like this with headers where the columns variable.

    423115000001 TYPE -- -- MATERIAL COTTON COTN WEIGHT 100 GM 100GM DIMENSION -- -- ADDITIONAL INFORMATION -- --


    I am trying to get the output like below

    423115000001 TYPE -- --
    423115000001 MATERIAL COTTON COTN
    423115000001 WEIGHT 100 GM 100GM
    423115000001 DIMENSION -- --
    423115000001 ADDITIONAL INFORMATION -- --


    any help would be great i have more than 30000 rows to be converted in this pattern.

  2. #2
    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: Macro Help for transpose

    Hello sonkar,

    To expedite a solution, you should post a copy of your workbook. This will allow all code to be tested against the actual data and layout.

    If your workbook contains sensistive information, please redact it before posting.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.
    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!)

  3. #3
    Registered User
    Join Date
    11-10-2014
    Location
    MUSCAT
    MS-Off Ver
    2007
    Posts
    4

    Re: Macro Help for transpose

    Hi,

    Sorry for the late reply,I am attaching excel file where the input and outputs are in different sheets.

    Hope that helps you to understand my problem.

    Thanks

    Sachin
    Attached Files Attached Files

  4. #4
    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: Macro Help for transpose

    Hello sonkar,

    Thanks for posting the workbook. After looking at the data, I have a couple of questions.

    On the "Input Data" sheet, are all the grey cells to the right of column "N" to be considered "Additional Information" ?

    Will the number of columns vary only after column "N" ?

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

    Re: Macro Help for transpose

    Hi..

    Try this..

    You had 2 'hidden' columns (B and C) on your Output sheet..

    While i can see how you would get your second and third values .. example (Material and Weight).. it is not clear how you get the "ABSORBENT" value (first value)..

    For this reason.. I have included only the 4 visible columns you showed in your output sheet..

    You can either insert the other 2 columns and use a formula or vba to get the values..

    You could also include those values in the building of the 'y' array.. I didn't for the above reason..

    Click the button.. result shown on sheet1.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-10-2014
    Location
    MUSCAT
    MS-Off Ver
    2007
    Posts
    4

    Re: Macro Help for transpose

    Hi,
    the columns are in the rage as long as header data till "AK"

    I got the solution by using the formula
    =INDIRECT("'Sheet1'!A"&TRUNC(ROW()/12)+1)
    =INDIRECT("'Sheet1'!R"&TRUNC(ROW()/12)+1&"C"&(COUNTIF($A1:$A12,$A12)-1)*3+COLUMN(),FALSE)

    Thanks a lot

    will also try the macro and post if it works for me

    Sachin

  7. #7
    Registered User
    Join Date
    11-10-2014
    Location
    MUSCAT
    MS-Off Ver
    2007
    Posts
    4

    Re: Macro Help for transpose

    Hi APO,

    The code works great

    Thanks

    Sachin

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

    Re: Macro Help for transpose

    You're 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] Transpose: How can I copy a list and transpose it but leaving 3 cells in between each item
    By cocolete in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-11-2012, 10:01 AM
  2. Transpose Macro
    By dsavage in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2011, 03:46 PM
  3. Macro for a Transpose
    By AJJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2011, 05:16 PM
  4. Replies: 2
    Last Post: 02-19-2007, 04:53 PM
  5. Transpose Macro
    By Spil in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM

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