# Using the sort function in Excel spreadsheets

Sorting is the process of arranging objects in a particular order or order. order according to certain rules. Spreadsheet programs like Excel and Google Sheets have different sorting orders, depending on the type of data you’re sorting.

Contents
1. Ascending and Descending
2. Sort by color and sort
3. Default sorting
4. Hidden rows and columns and sorting

### Ascending and Descending

There are two sort orders for text or numeric values: Ascending And descending † Depending on the type of data in the selected range, these sorts sort the data in the following ways:

To sort in ascending order:

• Sort A to Z – for text data

• Sort from smallest to largest – for numerical data

• Sort from oldest to newest – by date or time

To sort in descending order:

• Sort from Z to A – for text data

• Sort from largest to smallest – for numerical data

• Sort from newest to oldest – by date or time

### Sort by color and sort

In addition to sorting by value, such as text or numbers, Excel has custom sort options that let you sort by color for text/font color, cell color, and conditional formatting icons.

Since there is no ascending or descending order for colors, the user defines the sort order for colors in the Sort dialog box.

### Default sorting

Most spreadsheet programs, such as Microsoft Excel and Google Sheets, use the following default sort order for different types of data, but the options may vary depending on the version of the application:

empty cells † In ascending and descending sort order, empty cells are always placed last.

Numbers † Negative numbers are considered the smallest values, so the largest negative number always comes first in ascending sort order and last in descending order, for example:

• Ascending : -3, -2, -1,0,1,2,3
• Descending : 3.2,1.0, -1, -2, -3

dates : the oldest date is considered to have less value or less than the latest or newest date, for example:

• Ascending (from old to recent) : May 5, 2000, May 5, 2000, January 5, 2010, January 5, 2012.
• Descending (last to oldest) : 01/05/2012, 01/05/2010, 05/05/2000, 1/5/2000

Alphanumeric data † A combination of letters and numbers, alphanumeric data is treated as text data and each character is sorted from left to right character by character.

Boolean or Boolean data : TRUE or FALSE only, and FALSE is considered less than TRUE.

### Hidden rows and columns and sorting

Hidden rows and columns of data don’t move during sorting, so they must be hidden before sorting can take place.

For example, if row 7 is hidden in your spreadsheet and part of the range of data being sorted, it will remain as it is, rather than being moved to the correct location as a result of the sorting.

Hiding rows and columns can significantly reduce the accuracy of data sorting. Don’t forget to list any rows or columns to sort with your data.

The same idea follows for hidden data columns. When sorting by columns, if column B is hidden before sorting, this column will remain B and will not be reordered with other columns in the sorted range.