In this article we will show you how to sort rows in Google Sheets by using the built in sort feature.
For the purpose of these examples a data set has been created. Click here to access the sheet and follow along at home.
To gain the most versatility when sorting rows we can use the advanced sort range feature in Google Sheets. This allows us to include header rows and include multiple conditions when sorting.
In your data set highlight the cells you wish to sort. This can be achieved by clicking and dragging over the cells.
In our example we wish to sort the rows in the Age column in ascending order, we must ensure this data is included in the selection.
For our demonstration we will select all data in the table including the header rows.
The advanced range sorting options can be accessed by clicking on Data from the top toolbar followed by selecting Sort range. From the side menu that appears click on Advanced range sorting options.
Alternatively the Advance range sorting options can be accessed by right clicking on the highlighted data. From the displayed menu click on View more cell actions followed by Sort range.
A pop up menu will now appear with a variety of range sorting options:
Data has header row: When this option is checked Google Sheets will use the data contained in the header row as an identifier for the sort selection.
Sort by: Clicking this option will display all the columns in the selection. If the data has a header row has been checked the header data will be displayed.
A → Z / Z → A: These select buttons represent the order of the sorted data. A to Z will sort the data in an ascending order. Selecting Z to A will sort the data in a descending order.
Add another sort column: This option allows you to add a secondary sort column.
In our example we have included the header row and we want to sort by the age column in an ascending order. To achieve this we first check the box next to Data has header row, then we will select age from the Sort by dropdown menu. Finally we will ensure the button next to A → Z is selected.
Click on the Sort button in the advanced sorting options window. This will sort your rows to your specified conditions.
In our example we can now see that all the age data has been sorted in an ascending order whilst retaining the header column.
There is a more basic method to sorting rows in Google Sheets. This method is efficient but has limitations over the advanced sort method. It cannot distinguish the header row and only a basic sort of A-Z or Z-A can be performed.
Select only the data you want to sort.
Note: if you have a header row do not include this as it will be sorted as standard data.
In our example we will now order the name data in a descending order. As our data set contains a header we will not include this in the selection.
From the top toolbar select Data followed by Sort range. A side menu will appear with the following options:
Sort range by Column (A to Z): Sorts the selected rows in an ascending order.
Sort range by Column (Z to A): Sorts the selected rows in a descending order.
In our example we have selected data from Column B which displays in our sort range options. As we want to order our data in a descending order we will click Sort range by Column B (Z to A).
After clicking on the relevant sort option the selected data is sorted.
In our example we can see the selected rows under the Name header have been sorted by descending order.
If you enjoyed this article, you might also like our article on how to use the Google Sheets sort range function or our article on how to auto sort in Google Sheets.
If you want to learn how to mail merge labels from Google Sheets or how to sort Google Sheets by last name, we also suggest checking out our detailed guide.