LESSONS 1. Intro 2. Cell Referencing 3. Data Types 4. Operators 5. Functions 6. Intro To Logic 7. Simple Math 8. Math & Logic 9. Changing Text 10. Replacing Text 11. Splitting Text 12. Joining Text 13. Sorting Data 14. Rearranging Data 15. Looking Up Data

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:

 A B 1 Name Age 2 Jane 32 3 James 56 4 John 24 5 Julia 33

Let’s sort the data by name:

=SORT(A2:B5,1,TRUE)
 C D 1 Name Age 2 James 56 3 Jane 32 4 John 24 5 Julia 33

By age:

=SORT(A2:B5,2,TRUE)
 C D 1 Name Age 2 John 24 3 Jane 32 4 Julia 33 5 James 56

Or just the names, but descending by age:

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

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).
 A B C 1 First Last Sales 2 Dwight Schrute 10,000 3 Jim Halpert 8,000 4 Stanley Hudson 7,000 5 Phyllis Vance 6,000 6 Andy Bernard 4,000 7 8 First Last Sales 9 10 11 12 13 14
Next Lesson

FREE RESOURCE