If you work with data in Google Sheets, sorting is a feature you would need quite often.

In this tutorial, you’ll learn how to sort data in Google Sheets.

## Sort Data in Google Sheets

Suppose you have students marks data in a Google Sheet as shown below:

Now you can sort this data with names in an alphabetical order or marks in an ascending order.

### Sorting Names in an Alphabetical Order

Here are the steps to sort the names in an alphabetical order:

- Select the entire data set (A1:B11).
- Right click anywhere in the selection and click on Sort Range.
- In the Sort Range dialog box:
- Check the box for ‘Data has header row’.
- Select the column for which you want to sort. In this case, it’s the Names column.
- Click on Sort button.

This will sort the names in an alphabetical order (along with the numbers).

The same way, you can also sort based on the marks. In that case, you need to select marks as the column to be used for sorting.

### Multilevel Sorting

Suppose you have a similar data set, but now, you have the marks for each student for three tests (Test 1, Test 2, Test 3).

Now you can do a multi-level sorting with this data set. In this case, you can first sort the data by name and then by Test.

That will group all the three test scores for each student.

To do this:

- Select the entire data set (A1:C31).
- Right-click anywhere in the selection and click on Sort Range.
- In the Sort Range dialog box:
- Check the box for ‘Data has header row’.
- Select the column for which you want to sort first. In this case, it’s the Names column.
- Click on ‘Add another sort column’.
- In the ‘then by’ drop down, select Test.
- Click on Sort.

This will sort the data first by the names and then by the test name.

*Note: If you want to keep the original data intact, make a copy and then perform the sorting on the copied data.*

### Sort Data in Google Sheets using the SORT Function

Google Sheet has a wonderful function that makes the sorting easy as pie – the SORT function.

Suppose you have the data set as shown below:

To sort this data using the SORT function, in cell C2, enter the formula: =SORT(A2:B11,1,TRUE)

As soon as you enter this formula and hit enter, it would automatically give you a sorted data range (as shown below):

Here is how it works:

SORT function takes three arguments in the formula:

- The range (A2:B11) which is to be sorted
- The column based on which the sorting is to be done. In this case, it is column 1.
- The order (ascending or descending). If this argument is TRUE, it sorts in the ascending order.

Note that you can sort multiple columns as well. In that case, you need to supply the column number and the sorting order.

Here are a few things you need to know before you use the SORT function in Google Sheets:

- You can not delete a part of the result. If you have to delete it, you need to delete the entire result of the SORT function.
- If there are any filled cells in the range that would be taken up by the SORT function, it would return an error.

**You May Find the following Google Sheets Tutorials:**

## 1 thought on “How to Sort Data in Google Sheets”

How do you sort columns by row?