Excel / Sort in Ascending or Descending Order and by Multiple Columns

Use the ascending or descending command on Excel’s Data tab to sort by one column. To sort by multiple columns, open Data → Sort, add levels, and set their priority from top to bottom. Check the range first so that the cells in each record move together.

The menu paths and shortcut are for desktop Excel on Windows. Button labels may differ slightly in newer versions.

Sort one column in ascending or descending order

  1. Select a data cell in the column to use as the sort key. If a blank row or column breaks the list or a separate list sits next to it, select the intended range yourself, including every column that should move together.
  2. In Data → Sort & Filter, choose ascending or descending. Ascending puts numbers from smallest to largest, dates from oldest to newest, and text from A to Z under the current regional rules. Descending reverses that order.

In a contiguous list, Excel can infer the surrounding range from a single cell. Check that the headings stayed above the data and that related values such as names and scores moved together.

Sort by multiple columns

Enter the following data in cells A1:C5. First group the rows by team from A to Z, then put the highest score first within each team.

Sample data before sorting
Team Employee ID Score
B E01 84
A E02 76
B E03 92
A E04 90
  1. Select A1:C5 and open Data → Sort. Since the first row contains column names, select My data has headers. Set the first key to Team, Sort On to Cell Values, and the order to ascending.
  2. Click Add Level and choose Score for the next level. Sort on cell values and set the order to descending.
  3. Make sure Team is above Score, then click OK. Moving Score to the top would sort primarily by score across both teams.

The expected order is team A with E04 (90) and E02 (76), followed by team B with E03 (92) and E01 (84). Team B’s 92 correctly comes after team A’s 76 because Team has higher priority.

Know when to expand the selection

  1. Before selecting the Score column alone, make sure it is an independent list. If each score belongs to an employee, include the employee ID and other columns from that record.
  2. If the sort warning appears and the neighboring columns belong to your data, choose Expand the selection. If the intended boundary is unclear, cancel and select the whole range yourself. Continue with the current selection only for a stand-alone list.

If you sort the scores alone in descending order, E01 can stay in the first row while its score changes from 84 to 92. The numeric order looks right, but the records are wrong.

Check the result and restore the original order

After sorting, check the headers, row count, and matching IDs and scores. If numbers sort unexpectedly, look for values stored as text and convert them to numbers. Check for leading spaces in text and hidden rows as well.

Press Ctrl+Z immediately if the sort went wrong. If you will need the original order later, enter fixed sequence numbers such as 1, 2, and 3 in a separate column before sorting and include it in the range. Sorting by that sequence in ascending order restores the starting order.

Microsoft’s guide to sorting data in Excel

Sort columns from left to right using a row as the sort key