Microsoft Office Tutorials and References
In Depth Information
Sorting by Two Fields: The Hows and Whys
Sorting by Two Fields: The Hows and Whys
Consider this scenario: you’re the instructor of a large, lecture-hall-sized class, and
you’ve entered the names of all your students on a worksheet. You want to sort them in
the standard last-name alphabetical order, but a quick scan of the data turns up several
students with identical last names. You’d then probably want to sort the first names as
well, so that Edna Arnold will appear in the sort before Gary Arnold.
And that introduces a classic sorting issue. Sorting by a second field is something you
may want to do when, and only when, you have duplicate data in the first field—that is,
when you discover at least two entries in that field with the same contents. There’s
simply no point in sorting by a second field unless you have duplicate data in the first.
And as it turns out, our own database exemplifies this point. Suppose we want to sort
our records by department. The Department field exhibits numerous duplicates, so we
could sort by a second field as well—say, salary. In other words, we want to wind up
with the results shown in Figure 7–6.
Figure 7–6 Tilling two fields: Sorting by Department and Salary .
Note that Department is sorted in A-to-Z sequence but Salary is sorted largest to
smallest—kind of the opposite direction—because we wanted to see who were the
highest earners in each department. And how do we do all this? Here’s how:
First click in the first field by which you want to sort. You need to decide
which field gets sorted first. In our case, we want to sort the Last Name
field first, and then Salary, so click in the Last Name field.
Search JabSto ::

Custom Search