The ability to quickly and easily sort large amounts of data is one of the most useful things about spreadsheets.

There are a number of ways to do this. Here you’ll learn about the SORT function.

SORT

This function takes in data and sorts it by one or more of the columns present. You can also sort data by referencing an external column.

Syntax

=SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...])
  • range = the data you want to sort, it can be an array of data or a range reference
  • sort_column = the index of the column by which you want your data sorted (e.g. 2) or a range reference to a column outside the range that has the same number of rows as the range
  • is_ascending = TRUE or FALSE setting that determines if the data is sorted in ascending order (TRUE = 1➜9 or A➜Z) or descending order (FALSE = 9➜1 or Z➜A)
  • [sort_column2, is_ascending2, ...]= option to add multiple additional sort_column indexes or ranges and corresponding is_ascending choices, with preference given left to right

By default the SORT function assumes sort_column = 1 and is_ascending = TRUE. If that’s the case for your data you can leave these arguments out of the function.

Example

Here’s some data:

AB
1NameAge
2Jane32
3James56
4John24
5Julia33

Let’s sort the data by name:

=SORT(A2:B5,1,TRUE)
CD
1NameAge
2James56
3Jane32
4John24
5Julia33

By age:

=SORT(A2:B5,2,TRUE)
CD
1NameAge
2John24
3Jane32
4Julia33
5James56

Or just the names, but descending by age:

=SORT(A2:A5,B2:B5,FALSE)
E
1Name
2James
3Julia
4Jane
5John

It’s a powerful function with a lot of options.

Sorting Data Exercises
Enter a formula for each question in the formula bar for the spreadsheet below to access the next lesson.
1. Alphabetical
In cell A9, enter a formula that sorts both the first and last names alphabetically (A-Z) by only the first names.
2. Order
In cell C9, enter a formula that sorts the sales numbers by the first names alphabetically (A-Z).
ABC
1FirstLastSales
2DwightSchrute10,000
3JimHalpert8,000
4StanleyHudson7,000
5PhyllisVance6,000
6AndyBernard4,000
7
8FirstLastSales
9
10
11
12
13
14
Next Lesson
hand pointing emoji hand pointing emoji

FREE RESOURCE

Google Sheets Cheat Sheet

12 exclusive tips to make user-friendly sheets from today:

Google Sheets Cheat Sheet

You'll get updates from me with an easy-to-find "unsubscribe" link.

Want Better-Looking Google Sheets?

Google Sheets Cheat Sheet

Get my 12-tip cheat sheet that will make your spreadsheets more user-friendly.

You'll get updates from me with an easy-to-find "unsubscribe" link.

🗙