Sorting Data in Worksheets


You can sort data in a worksheet and specify the keys by which the data is sorted.

To sort data:

  1. Select the cells that you want to sort.
  2. Choose Edit > Sort.
  3. The Sort dialog box is displayed as shown in the following illustration:

  4. Select the Rows option button to specify that the selection be sorted by rows. Alternatively, select the Columns option button to specify that the selection be sorted by columns.
  5. To specify the first row or column you want to sort by, select Key 1 from the Keys list.
  6. Select the row or column you want the selection to be sorted by from the Reference list.
  7. Select the Ascending or Descending option button to specify an ascending or Descending sort order.
  8. To specify the second row or column you want to sort by, select Key 2 from the Keys list, then repeat steps 6 and 7.
    You may specify as many sort keys as there are rows or columns in your selection.
  9. Click OK.

Note Worksheets treat each cell as independent data, not as part of individual "records" as a database does. This is true even if your data was imported from a database where data was stored in records. If you have data stored in record form that you import into a worksheet and want to sort by record, be sure to select all of the data in the records before using the sort feature.

Sort Example

The following example shows how to use two sort keys to determine the sort order of multi-column data.