How to create a Pivot table when fields are on horizontal and vertical axes

跟風遠走 提交于 2020-01-06 07:59:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!