问题
I am using a table that I need to convert in a pivot table
However I have some fields from the pivot table are in the columns and some others are in the rows (Dates). which returns then the following pivot table:
Is there a way to let the Pivot table read it? (I m also open for VBA Ideas to start)
回答1:
Your data is currently "Crosstabulated" aka in a crosstab, which Pivots can't handle. You need to "Unpivot" your data using either PowerQuery or VBA.
- Use PowerQuery aka "Get and Transform" if you have Excel 2013 or later. Google PowerQuery Unpivot and you will turn up hundreds of tutorials, such as this one from my good pal Chandoo https://chandoo.org/wp/2015/09/29/unpivot-data-with-power-query/
- Use VBA. Google Unpivot VBA and turn up hundreds of results, including this blazingly fast code I posted some time back: http://dailydoseofexcel.com/archives/2013/11/21/unpivot-shootout/ (Look for the code under the —Update 26 November 2013— heading.)
来源:https://stackoverflow.com/questions/48337054/how-to-create-a-pivot-table-when-fields-are-on-horizontal-and-vertical-axes