+ Reply to Thread
Results 1 to 6 of 6

Dynamic reorder of columns in PowerQuery

  1. #1
    Forum Contributor
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    365
    Posts
    204

    Dynamic reorder of columns in PowerQuery

    hi,

    I would like to reorder my PQ columns in Excel with no hard coding of all names. I have 3 columns which I would like to move to 3 first positions in the table. I can hard code the names of those, but all the other columns are dynamic and I cannot hard code those. Any idea of how to fix that problem?

    1.png

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,247

    Re: Dynamic reorder of columns in PowerQuery

    In PQ, select those columns and then right-click - move to start (or similar wording).

    If you want more specific help, attach a workbook, not an image.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    365
    Posts
    204

    Re: Dynamic reorder of columns in PowerQuery

    Quote Originally Posted by AliGW View Post
    In PQ, select those columns and then right-click - move to start (or similar wording).

    If you want more specific help, attach a workbook, not an image.
    hi,

    when you make this step, then you hard code all the column names and this is what I want to avoid. I can keep only 3 column names in the code, the rest has to be dynamic.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    365
    Posts
    204

    Re: Dynamic reorder of columns in PowerQuery

    hi,

    and the file attached
    Attached Files Attached Files

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: Dynamic reorder of columns in PowerQuery

    Please try

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    365
    Posts
    204

    Re: Dynamic reorder of columns in PowerQuery

    works like a charm thanks
    Last edited by AliGW; 12-29-2020 at 03:07 AM. Reason: Please don’t quote unnecessarily.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hi I am trying to reorder the columns headers using vba
    By A9kurs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2020, 09:20 PM
  2. PowerQuery custom columns with formulas
    By lordneeko in forum Excel General
    Replies: 7
    Last Post: 05-17-2019, 03:51 PM
  3. Replies: 3
    Last Post: 09-21-2018, 04:59 PM
  4. PowerQuery: Expand all columns after table join
    By Barslund in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2018, 04:59 AM
  5. Avoid PowerQuery refresh from deleting empty columns
    By Barslund in forum Excel General
    Replies: 10
    Last Post: 01-10-2018, 04:19 AM
  6. [SOLVED] Reorder columns from shortest to longest
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-06-2015, 08:22 AM
  7. Help - VBA to automatically reorder columns
    By jsabo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2013, 05:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1