CCNC/CCNC Module 4/Spreadsheets2/Cells/Sorting

From WikiEducator
Jump to: navigation, search

Sorting data

Data as we already know are inputted into cells, and the cells themselves are arranged in rows and columns. There are times when we may wish to organize a range of cells so that the data in these cells are ordered in a particular way, based on some criterion that we decide on. This action is referred to as sorting data. It can be done in ascending or descending order and the data to be sorted may be numeric or alphabetic.

Sorting data involves two main actions:

  1. You identify the column that contains the data to be ordered.
  2. You identify and highlight the range of cells that are associated with the column to be ordered and which must also be reorganised when the specific column data is re-ordered.
  3. You set the criteria by which the data in the main column are to be sorted. You do this in the Sort dialogue which you access through Data-> Sort on the drop down Edit menu.

Now do it

Decide on the criterion

Q. What criterion are you going to use? A. That depends on whether the data in the column you are focusing on is numeric or alphabetic. Q. But what is a criterion? A. That is the measure or yardstick that you will use to order the data. If the data is numeric, the criterion will be a value; if alphabetic, it will obviously be alphabetic.

Do a numeric sort

  • Examine the data in the display above. The range A4:F36 is highlighted
  • Data -> Sort
  • In the Sort By window, select Column F. That Column containe the points obtained by each of the persons whose names appear in Column A. These points are the values that we are going to sort.
  • Check the adjacent Ascendiung radio Button
  • Click OK

The data in Column F are now sorted in ascending order with the lowest points at the top of the column and the highest at the bottom. Columns A to E have also been reordered to match the order of Column F. If you wished to sort the data by points in descending order, you would have checked the Descending radio button.

Do an alphabetic sort

  • Examine range A4:F36 again.
  • Data->Sort
  • Select Column A in the Sort by Window. This is the column containing the name field
  • Check the Ascending radio button.
  • If you wished to sort the names in recverse order from Z to A, you would check the Descending radio button.
  • Click OK

Sort on multiple criteria

Examine the re-ordered data, now sorted alphabetically. You will see that there are two names Andiswa. The first has higher points than the second. You can sort on multiple criteria so that, where there are multiple occurences on the first sort criterion (in this case the alphabetic criterion), there can be a follow-up sort based on a second criterion (in this case numeric).

  • Highlight A4:F36
  • Sort->Data
  • Select Column A in the first Sort by Window.
  • Check the adjacent Ascending radio button
  • Then select Column F in the second Sort By Window
  • Check the adjacent Ascending radio button.
  • Click OK.
Icon present.gif
Tip: It is important that you select an entire range. If you omit any columns, the re-ordered data could become a meaningless jumble. The values in the omitted fields would be associated with the wrong records. If rows are left out, the records would not be sorted.