+ Reply to Thread
Results 1 to 12 of 12

Pivot Wizard transform Table to Matrix and rearrangement

  1. #1
    Registered User
    Join Date
    07-14-2015
    Location
    Stuttgart
    MS-Off Ver
    2013
    Posts
    75

    Pivot Wizard transform Table to Matrix and rearrangement

    Hi everybody,

    I have a very bad source file which I need to aggregate. The point is that the source file is a Matrix, and I need a Table style. I used the Pivot Wizard to do so but now I have to re-arrange the output as per file attached.

    The source file has 1 column with the SKU, and 80 columns with 4 KPIs repeating for 20 POS. THis means 81 columns. I did trasnform it to a table with tons of row but it's not over yet. I want to have in my final output only 1 column with the SKU, 1 column with the POS, and then 4 columns with the data for the KPIs. So a total of 6 columns and more or less 300 rows (that's the number of the sku).

    I attached an example which is limited in number. Test.xlsx?

    Anyone knows a fast way to do it without having to copy and paste stuff manually.

    Thanks in advance. You'll save my life.

    Regards,
    Andra

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    I think I read the requirement properly. Try this on for size.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    07-14-2015
    Location
    Stuttgart
    MS-Off Ver
    2013
    Posts
    75

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    Thanks a lot. That's indeed the output I wanted... but how did you manage to sort it that way? There is no formula behind. Hope it was not manual work.

    Thanks
    Andra

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    I run the macro called TransformData. Copy in your source data onto the source file sheet and run the macro. The program clears Table_Data (an Excel Table) on the Desired Output sheet and sorts through the data.

    Here is the complete code. Change the sheet names where indicated if you change the sheet names in the book
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-14-2015
    Location
    Stuttgart
    MS-Off Ver
    2013
    Posts
    75

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    Thanks a lot. I received the folloqing error Compile error: Sub or Function not defined. Any ideas why that happened?

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    I need to see the line of code that is highlighted. That will give me an idea of what is going on. If you are trying to "transfer" this code to a second workbook, then you will need the second module. You can copy / paste this code after the code shown above. You may have to move the Dim tbl as listobject to before both subroutines.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-14-2015
    Location
    Stuttgart
    MS-Off Ver
    2013
    Posts
    75

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    Thanks. I did copy that part in the macro, just underneath the one you posted above.

    Now I get the message Compile error: ByRef argument type mismatch and this part of the macro is highlighted: Public Sub ClearFilter(sh As Worksheet, TableName As String)

    Thanks.

    Andra

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    One more thing to try. The original Desired Output sheet has an Excel table on it.

    Go to this sheet and convert the data to a table and name it Table_Data. Here is more information on Tables. http://www.utteraccess.com/wiki/Tables_in_Excel.

  9. #9
    Registered User
    Join Date
    07-14-2015
    Location
    Stuttgart
    MS-Off Ver
    2013
    Posts
    75

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    Thanks a lot dflak, that worked brilliant! However, it is considering only the first 4 POS (times the 4 KPIs each, so it considers the first 16 columns)... How can I edit the macro in order to make it considering the whole amount of POS I have in my original file?

    Thanks.
    Andra

  10. #10
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    I will get on this. In the sample you have 4 sets of 5 items each. I assume that these 5 items are repeated in the same order for as many KPIs as you have.

  11. #11
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    Here is the new code. The only thing that changed was the TransformData subroutine.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    07-14-2015
    Location
    Stuttgart
    MS-Off Ver
    2013
    Posts
    75

    Re: Pivot Wizard transform Table to Matrix and rearrangement

    The OLD MKTG TS for Place D is not reflected in the Desired Output Table.

+ 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] VBA to open the Pivot Table and Pivot Chart Wizard
    By scottiex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2017, 08:54 PM
  2. Transform a standardized output into structured format for Pivot table
    By concatch in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-02-2016, 02:55 AM
  3. Transform a standardized output into structured format for Pivot table
    By concatch in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2016, 07:41 AM
  4. rearrangement of matrix
    By umble in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-03-2012, 12:48 PM
  5. Replies: 2
    Last Post: 04-16-2012, 05:06 PM
  6. Replies: 0
    Last Post: 07-23-2011, 04:35 PM
  7. Replies: 5
    Last Post: 07-01-2011, 01:36 AM

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