Sorting: Basic how-to

Sooner or later, if you have a list of things in a spreadsheet, you’re probably going to find yourself wanting to sort it. In its simplest form, sorting a spreadsheet is like organizing a bookshelf or closet. Sure, if you’ve only got a few things there’s no real need for it. But if you have a lot of things and actually want to be able to find any particular item, then sorting is essential.

In the book inventory example, maybe you found a stray Bujold book halfway through entering the McCaffery ones, and you’d kind of like it to be with the others by the same author. Or, heavens forbid, you actually buy more books! You could find the “proper” place for each book in the inventory, insert a row, and enter it there… or you could just enter them at the bottom and sort the whole thing. Maybe it’s currently organized by author, but you want to re-organize it by genre. The list of possible reasons could go on and on.

Regardless of the reason, the details of how to do it depend, as always, on the program you’re using.

General Instructions
For any program you’ll want to select a single cell within the list to be sorted. You can also select the entire list if you want — it won’t hurt anything. However, if you select just a portion of the list then the program will either assume you know what you’re talking about and only sort that portion, or it will ask you whether you want to sort the whole thing or just that part.

Most programs can recognize column headers, and leave them where they are when sorting. In fact, I highly recommend that you have column headers if you plan to do any sorting because it is much easier to know what you’re sorting by when you’re sorting by “Title” than when you’re sorting by “(Column B)”.

When sorting by multiple columns, it matters which order you specify for the sort! For example, if you want your books grouped by author and series, you’d probably like a like that looked like “Adams, Hitchiker’s Guide”, then “Cherryh, Chanur Saga”, then “Cherryh, Morgaine Saga”. That’s sorted with author as the primary, or most important column, and series as the secondary column. If series was the primary column then the list would look like “Cherryh, Chanur Saga”, then “Adams, Hitchiker’s Guide”, then “Cherryh, Morgaine Saga”.

Whether you sort the primary column first or last, however, depends on whether you’re sorting multiple columns at once, or doing multiple sorts of single columns. If you’re sorting by multiple columns at the same time, always specify the most important column first. If you’re doing multiple sorts of single columns, do the most important column last.

In Excel 97:

  1. Click on the Data header (or type Alt-D)
  2. In the menu that appears click on Sort (or type S)
  3. In the dialog box that appears, first look at the bottom, just above the buttons. If your list has headers (which it should), make sure the radio button next to “Header row” is selected. If your list doesn’t have headers, make sure the radio button next to “No header row” is selected.
  4. In the top drop-down menu, pick the column you want everything sorted by. For example, if you want the authors in alphabetical order, sort by Author.
  5. Next to the drop-down menu, choose whether you want it sorted ascending or descending.
  6. You can repeat the previous two steps two more times, but three columns is the most you can sort by in Excel 97.

In Excel 2007:

  1. On the Home tab, look for the “Editing” group. For me it’s the last one on the right.
  2. In the “Editing” group, click on “Sort & Filter”. You’ll get the same result whether you click on the little downward-pointing arrow or not.
  3. In the menu that appears, click on “Custom Sort…” or type “u”.
  4. In the dialog box that appears, first look at the upper right corner, right below the ? and X buttons. If your list has headers (which it should), make sure the check box next to “My data has headers” is selected. If your list doesn’t have headers, make sure that the check box doesn’t have a check mark in it.
  5. Below that, you’ll see a row of drop down menus. In the first one, labeled “Column”, select the column you want to sort by.
  6. In the second one, leave it saying “value”.
  7. In the third one, you can choose between “A to Z” (ascending order), “Z to A” (descending order) or custom lists such as month names or days of the week.
  8. If you want to sort by another column, click on the button in the upper left corner that says “Add Level”, and repeat steps 5-7.
  9. Once you are done adding columns to sort, click on the “OK” button at the bottom.

Note: The keyboard shortcut for Excel 97 (Alt-D-S) still works in Excel 2007.

In Google Spreadsheet:

  1. Switch to list view by clicking on “View”
  2. Over each of the columns you’ll notice a the name of the column, turned into a link. If you click on one, it will sort that column in ascending order, and this is indicated by an upward pointing triangle to the right of the column name (if there’s room — if not, it won’t be visible unless you widen the column.) If you click on the column name again, it will switch to descending order, indicated by a downward pointing triangle.
  3. When you’re done sorting, there’s a link at the top to return you to the normal view.

In OpenOffice Calc:

  1. Click on the Data header (or type Alt-D)
  2. In the menu that appears click on Sort… (or type S)
  3. In the dialog box that appears, first click on the “Options” tab.
  4. If your list has headers (which it should), make sure the check box next to “Range contains column labels” is selected. If your list doesn’t have headers, make sure that the check box doesn’t have a check mark in it. There are also a lot of other interesting options here, but I’ll save that discussion for a more in-depth post.
  5. Click on the “Sort Criteria” tab.
  6. In the top drop-down menu, pick the column you want everything sorted by. For example, if you want the authors in alphabetical order, sort by Author.
  7. Next to the drop-down menu, choose whether you want it sorted ascending or descending.
  8. You can repeat the previous two steps two more times, but three columns is the most you can sort by in this program.
  9. Click the “OK” button at the bottom.

In Microsoft Works Spreadsheet:

  1. Select the entire table you want to sort.
  2. Click on the “Tools” menu header or type Alt-T.
  3. In the menu that appears, click on “Sort…” or type “R”
  4. In the dialog box that appears, first make sure that the radio button next to “The selected cells” is selected. Choosing the other one will try to sort the entire worksheet.
  5. Next, if your list has headers (which it should), make sure the check box has a check mark in it. If your list doesn’t have headers, make sure that the check box doesn’t have a check mark in it.
  6. In the top drop-down menu, pick the column you want everything sorted by. For example, if you want the authors in alphabetical order, sort by Author.
  7. Next to the drop-down menu, choose whether you want it sorted ascending or descending.
  8. You can repeat the previous two steps two more times, but three columns is the most you can sort by in this program.
  9. Click the “Sort” button at the bottom.