Microsoft Office Tutorials and References
In Depth Information
Using Header Rows
Figure 6–5. The grades, post-sort
Meaning all the data in all the other adjacent columns remain lined up; nothing is out of whack. We
see Dorothy is still the owner of that 93. Gordon is still jealous. Pretty easy, no? Just click in the desired
column (field), and click A-Z or Z-A.
Using Header Rows
Now there is, however, another big question we need to address. If we sort the above data, why won’t the
very first row be sorted? That is, why isn’t the 3—the number of the test being sorted—treated as just
another test score (a rather low one, too), and thrown to the bottom of the sorted list?
The answer is that sometimes that’s exactly what will happen. But Excel really wants your data to
have a header row—so if it sees a discrepancy between the kind of data in the first row of any field and
the other data in that field, it assumes the first row is a header. And because the last field—Average—is
topped by a text entry, even as the data beneath it are numbers, Excel interprets that data disconnect as
an indicator of a header row; and as a result, it leaves the header row alone. That’s how it works; and it
means in turn that if the Average field had originally been called 6, the first row would have been sorted,
had you clicked in that or any other column.
And the Sort capability also allows you to sort the data by more than one field. Why would you want
to do such a thing? Consider this case: you have a long database of university students, and you want to
sort the records by the Last Name field. Because it’s highly likely that some students will share the same
last name, you would probably want to sort the names further by the First Name field, so that Wilson
Henry is sorted before Wilson Nancy. (If you don’t sort by two fields in cases such as this, the last names
will obviously be sorted together—but the first names will simply remain in their current order). On the
other hand, there’s no reason to sort by a second field if no duplicate data exists in the first. And it also
then follows that if two or more students share the same first and last name, you could sort by a third
field–say, middle initial, or major.
To demonstrate, enter this small database in cells J11:L17 (it should go without saying allthis works
with much larger databases, too) (Figure 6–6):