## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# 3.9. Sorting Data

## Problem

You have unsorted data in your spreadsheet and you'd like it sorted.

## Solution

Select the data you want to sort, then choose Data → Sort ... from the main menu bar to open the Sort dialog box. The Sort dialog box will allow you to specify how to sort the data, as discussed below.

## Discussion

Figure 3-16 shows a sample spreadsheet containing hypothetical student grades. The student names are not in alphabetical order, so I'll use Excel's sort feature to sort them from A to Z. Moreover, when I sort the names, the grades associated with each student will remain so; that is, we're not just going to sort the first column, but will also keep grade associations intact for each student name.

To sort the data keeping everything intact, you must select the entire data range. Click the first name in the list and drag the selection to the lower-right of the range. Now select Data → Sort ... from the main menu bar. You should see the Sort dialog shown in Figure 3-17.

In this example, let's sort by student names in ascending order. Select Student Name in the "Sort by" drop-down listbox, and select Ascending next to it. In the event two names are identical, let's use the associated final exam grade as the tiebreaker, with the name of the student who has the lower final exam grade appearing first. To do this, select Final Exam from the "Then by" ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required