The SORT function lets you sort a range (or array) of data. The function creates a new range of data with the new, sorted output from the function. SORT is often used with or instead of the FILTER function when widdling down large amounts of data. FILTER is for reducing data and SORT is for, well, sorting it.

The SORT function is typically accessed from the user menu, but it can also be typed into a cell just like any other function. Excel, the most popular spreadsheet program, only has it as a menu function so learning to use SORT as a function can be a new experience even to long-time spreadsheet users.

Video Explanation

Purpose

Returns sorted data from your specified source.

Syntax

=SORT(range,sort_column,is_ascending,[sort_column2, is_acending2,...])

  • range - The entire range of data that is to be sorted
  • sort_column - The column of data that contains the criteria that you are sorting. Can only be one column at a time.
  • is_ascending - Two possible answers - TRUE for ascending (1,2,3), FALSE for descending (3,2,1)

Tip: When using SORT, start your formula in a cell that should be the upper left most cell for the output. This function writes the output in, below, and to the right of your starting point. The formula text will remain in the upper left cell and can be changed.

Examples

Example 1

Using a simple SORT function with one column of data to be sorted in ascending order. The first rows are your raw data, then the rows below the SORT formula are the output.

Shows the starting data and the formula typed into the last cell.
A
12
25
33
4=SORT(A1:A3,1,TRUE)
5
6
The first three rows are the original data and the last three rows are the dynamic results of the function. The function is still in cell A4 and you can see it if you select that cell.
A
12
25
33
42
53
65

Example 2

Let's look at an example now of sorting a table with two columns of data and sorting in descending order with the second column as the value to sort by.

AB
12b
25t
33r
4=SORT(A1:B3,2,FALSE)
5
6
The first three rows are the original data and the last three rows are the dynamic results of the function. The function is still in cell A4 and you can see it if you select that cell.
AB
12b
25t
33r
45t
53r
62b

Example 3

Two column SORT, sorted by only column 2 in ascending order.

Shows the starting data and the formula typed into row 7.
AB
1HueyDuck
2DeweyDuck
3LouieDuck
4DuckworthButler
5BubbaCaveduck
6TootsieTriceratops
7=SORT(A1:B6,2,TRUE)
8
9
10
11
12
The first six rows are the original data and the last six rows are the dynamic results of the function. The function is still in cell A7 and you can see it if you select that cell.
AB
1HueyDuck
2DeweyDuck
3LouieDuck
4DuckworthButler
5BubbaCaveduck
6TootsieTriceratops
7DuckworthButler
8BubbaCaveduck
9HueyDuck
10DeweyDuck
11LouieDuck
12TootsieTriceratops

Example 4

Two column SORT, sorted by column 2 in ascending order then by column 1 in ascending order. Now Dewey comes before Louie.

Shows the starting data and the formula typed into row 7.
AB
1HueyDuck
2DeweyDuck
3LouieDuck
4DuckworthButler
5BubbaCaveduck
6TootsieTriceratops
7=SORT(A1:B6,2,TRUE,1,TRUE)
8
9
10
11
12
The first six rows are the original data and the last six rows are the dynamic results of the function. The function is still in cell A7 and you can see it if you select that cell.
AB
1HueyDuck
2DeweyDuck
3LouieDuck
4DuckworthButler
5BubbaCaveduck
6TootsieTriceratops
7DuckworthButler
8BubbaCaveduck
9DeweyDuck
10HueyDuck
11LouieDuck
12TootsieTriceratops

 Live examples in Sheets 

Go to this spreadsheeet for several examples of the SORT function that you can study and use anywhere you would like.