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 (Using In-built Sorting Functionality)

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

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

### Sorting Names in an Alphabetical Order

Here are the steps to sort the names in 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 the Sort button.

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

In 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 in Google Sheets

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.

## Sort by Column in Google Sheets

In all the examples covered so far, we have seen how to sort the data by rows.

*But what if you need to sort the data by columns?*

Unfortunately, there is no inbuilt functionality or function in Google Sheets that allow sorting by columns.

But here is a workaround that you can use – transpose the data (using the inbuilt functionality or using the transpose function)so that the hey rows become the columns in the columns become the rows.

Once you have transposed the data, sort using any of the methods covered above. once done, transpose it back so that you get the original data (which has now been sorted by columns).

I know it’s not an elegant solution, but it works!

So these are some methods you can use to sort data in Google Sheets.

I hope you found this tutorial useful!

**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?