Sorting data allows you to organize and analyze your data more effectively. You can sort in ascending or descending order, alphabetically, or by arranging numbers. Google Sheets also allows you to sort the dates in chronological order. There are five main ways to sort data in Google Sheets:
Method #1: Sort data using the Sort sheet option
This option sorts one column on your sheet but will change the other columns to correspond to the new order.
- Before sorting your data set, freeze the header row. You can do this by grabbing and dragging the thick grey horizontal bar at the top-left corner of the sheet.
Click and drag the grey bar. - Select any cell in the column you want to sort. In this example, we are sorting column B in ascending order.
Select a cell in the column you want to sort. - From the “Data” menu, select Sort sheet. From the sub-menu, choose A to Z to sort the data in ascending order or choose Z to A to sort the data in descending order. This applies to both characters and numbers.
Select Data > Short sheet > A to Z or Z to A. - The selected column has been sorted in ascending order. As you can see, Column A will also be sorted accordingly.
Columns in the sheet are sorted.
Method #2: Sort data using the Sort range option
This option will only affect the column you select.
- Select the column you want to sort. In this example, we are sorting column A.
Select your column range. - From the “Data” menu, select the Sort range option. From the sub-menu, choose A to Z to sort the data in ascending order or choose Z to A to sort the data in descending order.
Select Data > Short range > A to Z or Z to A. - The selected range has been sorted in ascending order.
Selected range sorted in ascending order.
This option allows you to sort data according to a specified range of column data.
- Select the range of column data you want to sort. We are sorting the entire column B in descending order in this example.
Select your column range. - Right-click on the data. Select View more cell actions > Sort range.
Right-click > View more cell actions > Sort range. - When prompted with the Sort tool, choose A → Z for ascending sort or Z → A for descending sort. Check the Data has header row option if your data set has a header row. Then, click on the Sort button.
Choose the order of sort. - The selected range has been sorted in descending order.
Selected range sorted in descending order.
Method #4: Sort data using the column header
In Google Sheets, the column headers are named A, B, C, D, and so on. If you want to sort the entire column, you can use the column header’s sort feature. Follow these steps:
- Before sorting your data set, freeze the header row. You can do this by grabbing and dragging the grey horizontal bar at the top-left corner of the sheet.
Click and drag the grey bar. - Select the column you want to sort by clicking on the column header. In this example, we’re sorting column A.
Select your column header. - Right-click on the data. Then, choose the Sort sheet A to Z for ascending sort or Sort sheet Z to A for descending sort.
Right-click > Sort sheet A to Z or Sort sheet Z to A. Column A is now sorted in descending order. Column B remains unaffected.
Column A sorted in descending order.
Method #5: Sort data using the SORT function
The SORT function allows you to sort the selected range of data by a specified column. It returns a new set of sorted data while the original remains intact. Like the Short sheet feature, the Sort function keeps the corresponding data across the row intact.
Syntax
=SORT(range, sort_column, is_ascending)
Arguments
- range = the range of data where you want the sort to be applied.
- sort_column = The index of the column in the selected range. It is the column that the data will be sorted by.
- is_ascending = TRUE for ascending order or FALSE for descending order.
Example
- Select a cell where you want to return the sorted data. Then, start typing the below formula followed by an opening parenthesis:
=SORT
Insert the SORT function. - Select the range of data you want to sort, followed by a comma. In our example, select the range B2:B22.
Select the range of columns. - Next, enter the index of the column you want to sort, followed by a comma. In our example, we are sorting column 2 in ascending order.
Insert the column index. - Type FALSE for descending sort or TRUE for ascending sort.
TRUE for ascending or FALSE for descending. - Insert the closing parentheses and hit Enter. Your data will now be sorted.
Selected range sorted in ascending order.