• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

Pivot table transpose|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Pivot table transpose|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosPivot table transpose
sp_PrintTopic sp_TopicIcon
Pivot table transpose
Avatar
David_Ng
Member
Members
Level 0
Forum Posts: 306
Member Since:
December 5, 2016
sp_UserOfflineSmall Offline
1
November 16, 2021 - 3:15 pm
sp_Permalink sp_Print

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

Avatar
David_Ng
Member
Members
Level 0
Forum Posts: 306
Member Since:
December 5, 2016
sp_UserOfflineSmall Offline
2
November 16, 2021 - 3:44 pm
sp_Permalink sp_Print

File uploaded, pls help 

Avatar
Jessica Stewart
Northern USA
Member
Members


Trusted Members
Level 0
Forum Posts: 219
Member Since:
February 13, 2021
sp_UserOfflineSmall Offline
3
November 17, 2021 - 1:03 am
sp_Permalink sp_Print

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

Avatar
David_Ng
Member
Members
Level 0
Forum Posts: 306
Member Since:
December 5, 2016
sp_UserOfflineSmall Offline
4
November 17, 2021 - 10:52 am
sp_Permalink sp_Print

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
Avatar
David_Ng
Member
Members
Level 0
Forum Posts: 306
Member Since:
December 5, 2016
sp_UserOfflineSmall Offline
5
November 17, 2021 - 1:36 pm
sp_Permalink sp_Print

or how to use a correct formula to extract 

Avatar
Alan Sidman
Steamboat Springs, CO
Member
Members


Trusted Members
Level 0
Forum Posts: 174
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
6
November 17, 2021 - 10:54 pm
sp_Permalink sp_Print

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.

Avatar
David_Ng
Member
Members
Level 0
Forum Posts: 306
Member Since:
December 5, 2016
sp_UserOfflineSmall Offline
7
November 18, 2021 - 9:29 am
sp_Permalink sp_Print

Thanks Alan source data attached 

Avatar
David_Ng
Member
Members
Level 0
Forum Posts: 306
Member Since:
December 5, 2016
sp_UserOfflineSmall Offline
8
November 18, 2021 - 6:14 pm
sp_Permalink sp_Print

How's the status?

Avatar
Alan Sidman
Steamboat Springs, CO
Member
Members


Trusted Members
Level 0
Forum Posts: 174
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
9
November 19, 2021 - 12:17 am
sp_Permalink sp_Print

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"

Avatar
David_Ng
Member
Members
Level 0
Forum Posts: 306
Member Since:
December 5, 2016
sp_UserOfflineSmall Offline
10
November 19, 2021 - 7:15 pm
sp_Permalink sp_Print

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

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Edson Lima
Guest(s) 7
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
Hans Hallebeek: 185
Newest Members:
thong nguyen
Appiagyei Kofi Frimpong
Hilary Burchfield
Richie Wright
Adel Kock
Barbara Murray
Doug Milne
Siobhan Stringer
Rob Rooth
Tom Lewis
Forum Stats:
Groups: 3
Forums: 24
Topics: 6542
Posts: 28646

 

Member Stats:
Guest Posters: 49
Members: 32830
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.