Forum

How to Dynamically ...
 
Notifications
Clear all

How to Dynamically Rearrange Column Order in Excel using Powerquery

3 Posts
2 Users
0 Reactions
282 Views
(@prosperchild)
Posts: 35
Trusted Member
Topic starter
 

Hello All,

How can one dynamically rearrange column order in excel. 

I have a workbook, that contains student details.This student details has columns with column headers that i dont want the  column headers to changed in arrangement.Unfortunately, anytime i get a dataset about the students information, the column headers are dissarranged. It  always a problem, because the column headers could be upto 20 or more.Ordering and alignment has always be a challenge.

Now, how do one dynamically rearrange this column order such that anytime i get data about the student details, it will align automatically to my desire pattern.

Here is the workbook ,i sumitted as an attachment.It has 3 sheets.  First sheet is named " First_order" Second sheet "Second Order" the Third sheet is "Proper_order", this is my desired pattern.

Thank you.

 
Posted : 11/12/2022 4:14 am
Riny van Eekelen
(@riny)
Posts: 1186
Member Moderator
 

Create a small table with the column names in the correct order. Connect to it with PQ and create a list of it. Then you can replace the entire part between the curly brackets in a regular Reorder step with the name of the list. Demonstrated in the attached file, where both First and Second have been reordered based on the sorted list.

 
Posted : 11/12/2022 8:08 am
(@prosperchild)
Posts: 35
Trusted Member
Topic starter
 

Thank you

 
Posted : 11/12/2022 11:39 am
Share: