Pls help a macro to transpose pivot table row lables to column layout
File uploaded, pls help
Are you looking for something like the file attached? If so, VBA is not required, I simply moved the pivot table fields to columns instead of rows. I put it on a new sheet in your workbook. 🙂
Thanks Jessica you great help !
But what we want the layout from the Pivot table should transpose as below
ie rows wise presentation, to show the Vendor and related customer codes grouping as below from the Pivot table
Vendor Code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code | Customer code |
H3PM | 12349PC | 12349SC | 96099JHO | 96099L | 96099VFB | ||||||||||
HA0D | 12349PC | 96407G | 96946G | 97131G | SOHB | SUN-S | YAGID | ||||||||
HA54 | 12349BL | 12349YB | 12349YBA | 96058G | 96250G | 96440G | 96728G | 96799AVC | 96799G | 96799S | 96883G | 96946G | 97131G | ACE | ANTEX 1 |
HA56 | 96799S | 96900G | 97131G | HFJHK | HFX | ||||||||||
HA66 | 96058G | 96536A | 96728G | 96799G | 96946G | HITH | INFO | ITC | LITE | MDHK | MDHKG | NSECK | SANE | SANEC | TOMHK |
or how to use a correct formula to extract
Where is the source data? This might be possible with Power Pivot, but cannot access the source data of the existing PT. Possible to build a measure or may be possible to format in Power Query but without Source Data, there is nothing that can be done.
Thanks Alan source data attached
How's the status?
Look at the attached. All done with Power Query
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Grouped Rows" = Table.Group(Source, {"Vendor Code"}, {{"Data", each _, type table [Vendor Code=text, Customer Code=text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Data],"Index",1,1)),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
#"Expanded Custom" = Table.ExpandTableColumn(#"Removed Columns", "Custom", {"Customer Code", "Index"}, {"Custom.Customer Code", "Custom.Index"}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Expanded Custom", {{"Custom.Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Expanded Custom", {{"Custom.Index", type text}}, "en-US")[Custom.Index]), "Custom.Index", "Custom.Customer Code")
in
#"Pivoted Column"
Thanks Alan , the codes set in PQ [power query], it ok now the layout