Sorting Results

After you've entered numbers or done calculations in a spreadsheet, you may want to sort the results from highest to lowest or lowest to highest.

With the spreadsheet on types of weapons used in homicides, for example, you could more easily see which weapons are most frequently used by ranking them from the highest number to the lowest number for any given year.

To do this, you first need to highlight the area of the spreadsheet that you want to sort.

Don't just highlight a single column of numbers to sort because the spreadsheet then will sort only the cells in that column and not change the order of the corresponding cells in other columns (such as the headings that tell you which type of weapon corresponds with the numbers of homicides).

To keep the headings and other data in order in our spreadsheet, in the gray area to the far left that lists the row numbers in the spreadsheet, click on the number for row:


Which is the row with the totals for all homicides in each year.

Now hold down the shift key on your keyboard and in gray area below click on the number for row:


Which is the row with the totals for homicides by other weapons or where the weapon wasn't stated.

You should see everything on the spreadsheet between rows 5 and 22 highlighted.

selecting cells to sort

The highlighted area now includes the headings for the types of weapons used and then the numbers for each type of weapon for each year.

 To sort the data, in the menu at the top, click on Tools...Sort...

tools menu item to sort

In the box that appears, you'll see the range of selected cells displayed at the top (in this case, cells A5 to J22).

You now can select the column by which you want to sort the data.

You also can select whether to sort that data in ascending order (A - Z) so the smallest number appears at the top of the sorted data, or descending order (Z - A) so the largest number appears at the top.

sort box with options

In our case, we can select:

Column F

Which will sort the data by the most recent year, 2008.

And select:

Z - A

So the numbers for weapons that are used the most appear at the top of the sorted data.

Then click on Sort to rearrange the data.

sorted data

The spreadsheet now will display the types of weapons most frequently used in homicides in 2008 at the top of the chart (total firearms, then handguns, then knives...), and the least frequently used weapons at the bottom (explosives, poison, drowning).

If you then want to go back to the original form of the spreadsheet, in the menu at the top click on:


Note for Excel: you re-sort columns by clicking in the main menu on Data...Sort or by clicking on the Sort buttons in the toolbar.