Sorting Data


This section covers

  What is Sorting

  Sorting Order (Ascending and Descending)

  How to sort rows based on the contents of columns

 

What is sorting


Often, the user may want to arrange the rows of a selection of cells in a worksheet according to a particular order.

When a user sorts this selection (list), Excel rearranges the rows according to the contents of a column (or even multiple columns) chosen by the user.

Excel can rearrange data in a list numerically, alphanumerically, logically or chronologically. Data, in a list, can be sorted either in an ascending order or in a descending order.

Sorting Order 


Ascending Sort

If data are sorted in  ascending order, the following rules apply 

 

Numbers: Numbers are sorted from the smallest to the largest.


Alphanumeric (Text) Data:
Text data (which may include numerals) are sorted in alphabetical order (numerals preceding letters), as in a telephone book.


Dates: Dates are sorted from the earliest to the latest.


Logical values: For logical values, FALSE is placed before TRUE. 


Blanks: Blanks are always placed last. 

 

 

Descending Sort

 

In the descending sort, the order is reversed, except for blank cells, which are always placed last.

 

Sorting rows based on the contents of columns


Please follow these steps:

 

Step 1.  Select the cells you want to sort.
   
Step 2.  Choose the "Data" menu from the menu bar and then click on "Sort".

The Sort dialog box appears in either of the following formats.

               No header row                       Header row  

 

Please note the following:
a. You must select a “Sort by" column; this serves as the Primary Key by which the rows will be sorted.
b. You may also choose one or two more columns  as Secondary sort keys (“Then by" columns) that will decide sort order if there are multiple records with the same primary key value.

Example: For our sample data, you may want to order the rows on "City Mileage". You may find that two or more cars in this ordered list have the same value for "City Mileage". If you want these car names to be ordered alphabetically in the list, you should choose the "Car" column in the "Then by" option.

c. For each column, you may choose to sort either in  ascending order or in descending order.
d. If your data columns have header labels, you should click the button that says "Header row". If you do this, the top row (the header row) will not participate in the sorting process and will remain at the top.

 

Step 3.  Choose your options from the dialog box and click the "OK" button to execute the sort.

 

Click here to view the animation