In this article, we will show you how to reorder multiple columns in Power Query by dragging and dropping. Often, when importing data from various sources, columns may not be in the desired order. Reordering columns not only allows you to arrange them in a logical order that suits your analysis or reporting needs, it also improves the readability of your data and speeds up tasks such as filtering, sorting, and performing calculations.
In Excel, there are many ways to rearrange columns. You can simply select the column header and drag it to the desired location. However, this approach can become cumbersome when dealing with large tables with many columns. To rearrange columns more efficiently, you can use the enhanced query editor. With the enhanced query editor, you can easily select multiple columns in the order you need and drag them together to the desired location. This allows you to quickly rearrange columns in large tables without having to constantly drag and scroll. The enhanced query editor provides a more convenient way to manage and adjust the order of columns, making your work more efficient and convenient.
To reorder multiple columns in Power Query via drag and drop, you must perform the following steps:
Suppose we have a sample data source as shown below. So our first step is to open it in the Power Query editor. Select the data source and click the From table/range option in the Get data section under the Data tab.
After opening data in the Enhanced Query Editor, you can customize the display order by holding down the Ctrl key and selecting the desired columns. For example, you can rearrange DepartmentID and EmployeeID to suit your needs. This flexibility allows you to easily adjust the order of data display to suit your specific needs and preferences.
Department ID, employee ID, employee name, joining date, gender, salary code
I will select them in the order shown in the screenshot below:
After selecting the columns, click and hold the left mouse button on any selected column header, then drag the pointer to where you want to place the column. Release the mouse button to drop the column to its new location. They will be rearranged in the desired order.
Finally, click the Close&Load button in the top menu of the Power Query editor to apply the changes and load the reordered data back into the worksheet.
Note:
When you reorder columns in Power Query, a Table.ReorderColumns function is created. You can also reorder multiple columns at once by modifying the formula text in the Table.ReorderColumns function. ReorderColumns function (if you cannot see this function, right-click on any column header and select Move > Left/Right/To Begin/to End from the context menu).
Edit the formula text by placing your cursor on the top formula bar and typing the column headings in the desired order. Titles are enclosed in double quotes and separated by commas. Delete the previous entry for the added column and press Enter to apply the changes.
This is how to quickly reorder multiple columns in Power Query without having to move each column individually. I hope you'll find this useful.
The above is the detailed content of How to reorder multiple columns in Power Query via drag and drop. For more information, please follow other related articles on the PHP Chinese website!