Sort a table (Power Query)
Note: Power Query is known as Get & Transform in Excel 2016. Information provided here applies to both. To learn more, see Get & Transform in Excel 2016.
I want to
Sort a table in Query Editor based on a single column
-
In Query Editor, select the column you want to sort on.
-
Click the down arrow ( ).
-
From the drop-down menu, click Sort Ascending (from low to high) or Sort Descending (from high to low).
Sort a table in Query Editor based on multiple columns
When you sort based upon multiple columns, the order or hierarchy of the sorting is based on the order that the columns were selected.
To sort a table based on multiple columns
-
In Query Editor, select the primary column for the sort.
-
Click the down arrow ( ).
-
From the drop-down menu, click Sort Ascending or Sort Descending.
-
Repeat steps 1-3 for each subsequent column you want to use for sorting.
For example, when you sort by State then Population, the final result is a table ordered by state with the cities in each state ordered by population. Alphabetically Arizona comes before California and within Arizona Phoenix has more people than Tucson. The formula lists each sort column in sort priority and the type of sort to apply to it.
Note: The Query Editor only appears when you load, edit, or create a new query using Power Query. The following video shows the Query Editor window appearing after editing a query from an Excel workbook. To view the Query Editor without loading or editing an existing workbook query, from the Get External Data section in the Power Query ribbon tab, select From Other Sources > Blank Query. The following video shows one way to display the Query Editor.
No comments:
Post a Comment