Applies ToExcel for Microsoft 365 Excel 2024 Excel 2021 Excel 2019 Excel 2016 Excel 2013

You can sort data to arrange in:

  • Ascending order (text is A-Z, number is smallest to largest, and date is oldest to newest).

  • Descending order (text is Z-A, number is highest to lowest, and date is newest to oldest).

  1. To open a query, locate one previously loaded from the Power Query Editor, select a cell in the data, and then select Query > Edit. For more information see Create, load, or edit a query in Excel.

  2. Select the down arrow (Filter arrow) next to the column you want to sort.

  3. In the drop-down menu, select Sort Ascending or Sort Descending.

Select sort order

When you sort based upon multiple columns, the order or hierarchy of the sorting is based on the order that the columns were selected.

  1. To open a query, locate one previously loaded from the Power Query Editor, select a cell in the data, and then select Query > Edit. For more information see Create, load, or edit a query in Excel.

  2. Select the down arrow (Filter arrow) next to the column you want to sort.

  3. In the drop-down menu, select Sort Ascending or Sort Descending.

  4. Repeat steps 2 and 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. 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.

Sort example

See Also

Power Query for Excel Help

Sort columns (docs.com)

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.