Sorting records in a data list - MS-Excel Tutorial
Sorting records in a data list
To sort the records in your data list with the Sort feature, follow these steps:
- Position the cell pointer somewhere in one of the cells in the data list.
As long as the cell pointer is in any cell in the data list, Excel automatically selects all the records in the list when you perform the next step. Note that you can manually adjust this range if you want to sort less than all the records in the list. - Choose Data Sort to open the Sort dialog box.
Excel selects all the rows (records) in the list (excluding the row of field names at the top) and opens the Sort dialog box. If the list of data you're sorting doesn't have a row of headings in the top row and you want to include the top row's data in the sort, you need to select the No Header Row option button near the bottom of the Sort dialog box. - In the Sort By drop-down list, select the name of the field you want used as the primary key in sorting the records.
- If you want to sort the records in descending order (rather than the default ascending order) using the primary key, click the Descending option button.
- If the primary key field contains duplicates and you want to specify how these records are to be sorted, select the name of the field to sort by in the first Then By drop-down list.
- If you want to sort the records in descending order using the secondary key, click the Descending option button to the right of the first Then By drop-down list box.
- If the secondary key field contains duplicates and you want to specify how these records are to be sorted, select the name of the field to sort by in the second Then By drop-down list.
- If you want to sort the records in descending order using the tertiary key, click the Descending option button to the right of the second Then By drop-down list.
- When you finish defining all the keys you need to use in sorting the records in your data list, click OK or press Enter to perform the sort.
If, when Excel finishes rearranging the records, you find that you sorted the data list using the wrong key fields, choose Edit Undo or press Ctrl+Z to restore the data list records to their previous unsorted order.
Note that the Sort dialog box contains an Options button that, when clicked, opens the Sort Options dialog box. This dialog box contains options for doing a case-sensitive sort on fields that contain text and options for changing the orientation of the sort from the normal top-tobottom order to left-to-right order when you want to sort columns in a list.
To quickly sort records in the data list by using any single field in the list as the sorting key, use the Sort Ascending button (the one with A above Z) or the Sort Descending button (the one with Z above A) on the Standard toolbar. To sort the data list using these buttons, position the cell pointer somewhere in the field on which the records are to be sorted and then click the Sort Ascending button or Sort Descending button (depending upon which order you want to use).