In this post, we’re going to learn how to sort in Google Sheets. We’re going to see how we can sort data in one or more columns, and look at the different options that are available.
How to sort data by one column
Here we have a list of students’ exam results, which is a bit mixed up and first I want to sort it by exam mark, going from highest to the lowest.
Select the range including the headers.
Then either go Data > Sort range > Advanced range sorting options.
Or right-click on the range and select “View more cell actions” > “Sort range”. Personally, I find this second option quicker.
This will open the Sort range dialogue box. By default, it will sort column A in alphabetical order from A to Z.
Instead of remembering what column includes what data, tick “Data has header row” to include the header row and show the names of each column, which makes it much easier to work with. As you can see it’s changed column A to “Class”.
We want to sort it by the exam marks, so select “Exam” from the list.
Then select “Z to A” as we want to sort the data going from the highest to the lowest, whereas “A to Z” sorts it from the lowest to the highest, i.e. to alphabetise the data. Then click “Sort”.
As you can see it’s sorted the data by the exam mark in column D.
How to sort data by multiple columns
This time, I want to sort the data by class and then by exam mark, so that I can see the highest to lowest marks in each class. To do so, select the same data and open the sort range as before. We can see our sorting criteria from before.
We need to add a second sorting criteria. So, click on “Add another sort column”.
This adds another sorting option, then we select the column we want to sort by and whether it’s ascending (A to Z) or descending (Z to A). Then click “Sort”.
As you can see, it’s sorted the class column, and then sorted the exam mark column, so we can clearly see the highest to lowest marks in each class.
How to quickly sort a column
Sometimes we just want to quickly sort a column of data. We can do that by selecting the range. note, the column it sorts depends on the column which you selected first when selecting the range, which is usually the left one, (although you could select the range from column D to column A, so that it sorts column D).
Next go to Data > Sort range > Sort range by column A (A to Z) or (Z to A).
As you can see it’s sorted column A but it’s also included the header in the sorting, which I certainly don’t want!
So, you normally only use this if your data doesn’t have a header row, like you can see below.
How to sort all the data on the sheet by a specific column
If you have a sheet which only contains data that you want to include in the sorting, you can use the sort sheet option. Click on a cell in the column you want to sort.
Then select Data > Sort sheet > Sort sheet by column…
In this example, this will sort column D in descending order.
Personally, I always use the right-click option and sort range from there, as I’m used to quickly sorting ranges like that, but it’s good to have the different options.
Find out how to do the opposite to sorting by randomising a list of values in this post.
Check out my short Workspace tip videos on YouTube.
Want to learn more about Google Workspace and Apps Script? The books below are available on Amazon. Just click on a book! (Affiliate links).
a