The Excel sort function is useful for rearranging data. When working in Excel sorting data can quickly reorganize content too.
Video: Sorting DataWatch the video (5:50).
As you add more content to a worksheet, organizing this information becomes especially important. You can quickly reorganize a worksheet by sorting your data. For example, you could organize a list of contact information by last name. Content can be sorted alphabetically, numerically, and in many other ways.
Optional: Download our practice workbook.
Types of sorting
When sorting data, it's important to first decide if you want the sort to apply to the entire worksheet or just a cell range.
- Sort sheet organizes all of the data in your worksheet by one column. Related information across each row is kept together when the sort is applied. In the example below, the Contact Name column (column A) has been sorted to display the names in alphabetical order.
Sorting a sheet
- Sort range sorts the data in a range of cells, which can be helpful when working with a sheet that contains several tables. Sorting a range will not affect other content on the worksheet.
Sorting a cell range
To sort a sheet:
In our example, we'll sort a T-shirt order form alphabetically by Last Name (column C).
- Select a cell in the column you want to sort by. In our example, we'll select cell C2.
Selecting cell C2
- Select the Data tab on the Ribbon, then click the Ascending command to Sort A to Z, or the Descending command to Sort Z to A. In our example, we'll click the Ascending command.
Clicking the Ascending command
- The worksheet will be sorted by the selected column. In our example, the worksheet is now sorted by last name.
The sorted worksheet
To sort a range:
In our example, we'll select a separate table in our T-shirt order form to sort the number of shirts that were ordered on different dates.
- Select the cell range you want to sort. In our example, we'll select cell range A13:B17.
Selecting cell range A13:B17
- Select the Data tab on the Ribbon, then click the Sort command.
Clicking the Sort command
- The Sort dialog box will appear. Choose the column you want to sort by. In our example, we want to sort the data by the number of T-shirt orders, so we'll select Orders.
Selecting a column to sort by
- Decide the sorting order (either ascending or descending). In our example, we'll use Smallest to Largest.
- Once you're satisfied with your selection, click OK.
- The cell range will be sorted by the selected column. In our example, the Orders column will be sorted from lowest to highest. Notice that the other content in the worksheet was not affected by the sort.
The sorted cell range
If your data isn't sorting properly, double-check your cell values to make sure they are entered into the worksheet correctly. Even a small typo could cause problems when sorting a large worksheet. In the example below, we forgot to include a hyphen in cell A18, causing our sort to be slightly inaccurate.
A small typo in cell A18 causing an incorrect sort