Forum

Pivot table transpo...
 
Notifications
Clear all

Pivot table transpose

10 Posts
3 Users
0 Reactions
106 Views
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Pls help a macro to transpose pivot table row lables to column layout 

 
Posted : 17/11/2021 1:15 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

File uploaded, pls help 

 
Posted : 17/11/2021 1:44 am
(@jstewart)
Posts: 216
Estimable Member
 

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. 🙂

 
Posted : 17/11/2021 11:03 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

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
 
Posted : 17/11/2021 8:52 pm
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

or how to use a correct formula to extract 

 
Posted : 17/11/2021 11:36 pm
Alan Sidman
(@alansidman)
Posts: 223
Member Moderator
 

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.

 
Posted : 18/11/2021 8:54 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Thanks Alan source data attached 

 
Posted : 18/11/2021 7:29 pm
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

How's the status?

 
Posted : 19/11/2021 4:14 am
Alan Sidman
(@alansidman)
Posts: 223
Member Moderator
 

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"

 
Posted : 19/11/2021 10:17 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Thanks Alan , the codes set in PQ [power query], it ok now the layout

 
Posted : 20/11/2021 5:15 am
Share: