In this article:

SORT Function Google Sheets: Everything You Need to Know!

December 5, 2024

The SORT function in Google Sheets is an extremely useful feature, it helps organise data making it easier to understand. In this article we will cover this feature in detail, the various methods to apply, and look at some examples that can help bring your data to new heights.

Google Sheets Sort Function Syntax

The syntax for the SORT function is as follows:

=SORT(Range, Column1, is_ascending, Column2, is_ascending2)

Syntax Breakdown:

=SORT: Here we are calling the feature used for sorting information

Range: This is where we reference our initial data range, this tells the program where to look in relation to our follow up logic

Column1: This will be the column specified to be sorted first, within the defined range the column reference will move from left to right starting at the number 1.

Is_ascending: This is inputted as either a TRUE or False value as follows:

TRUE-Data will be sorted in ascending order. This would also be referred to as A-Z

FALSE-Data will be sorted in descending order. This would also be referred to as Z-A

Column2, is_ascending2: These are optional and are only applied when sorting multiple columns

SORT Syntax Uses

Single Column in Ascending Order (A-Z)

=SORT(RANGE,Column,TRUE)

=SORT(RANGE)

Single Column in Descending Order (Z-A)

=SORT(RANGE,Column,FALSE)

Multiple Columns

2 Columns:

=SORT(RANGE,Column1,is_ascending, Column2,is_ascending2)

3 Columns:

=SORT(RANGE,Column1,is_ascending, Column2,is_ascending2,Column2,is_ascending3

Sort Using a Different Tab

=SORT(TABNAME!,RANGE,Column,is_ascending)

Google Sheets Sort Function  Examples

Example 1 - Basic A-Z using the SORT Function

To demonstrate the basic SORT function an example data set has been created, the data shows an unsorted list of staff names. By using this function we will order the names in ascending order. Click here to view the dataset and follow along.

Step 1 - Select an empty cell adjacent to the data

Please ensure there is enough space for the new list to populate

Step 2 - Enter the SORT function

In the empty cell enter the sort function formula:

=SORT(RANGE,Column,is_ascending)

Formula Breakdown:

=SORT: The SORT function 

RANGE: This is the data range, in our example this is B3:B22

Column: The column number, columns are numbered from left to right in the stated range. As there is one column we will enter the number 1

Is_ascending: This is the true or false value that decides the ascending order of the sorted results. As we need the results to be in an ascending order we need to input TRUE

Google Sheets sort - Basic A-Z sorting

Step 3 - Press enter to see results

The sorted list will be populated and displayed in an ascending order (A-Z).

Google Sheets sort - Basic sort using column number

Example 2 - Sort a data range using the SORT Function

Instead of applying The SORT function to a column of data by column number, we can apply this powerful function to a data range. This can be achieved by replacing the column number in our formula to a data range.

Step 1 - Select an empty cell next to the data

Please ensure there is enough space for the new list to populate

Step 2 - Input the SORT formula

We will now input the SORT formula:

=SORT(RANGE,Sort Cell Range,is_ascending)

See how we have replaced the column number from the previous example to a cell range instead, this will now order the data in the range of B3 to B22.

Google Sheets sort - Using a data range

Important Note: When comparing data ranges the row and column count must match the initial data range, if this count is different you will receive a “mismatch” error:

Sort function Google Sheets - Using a data range: Mismatch error

This can be corrected by changing the sort range row count to meet the initial range. In this example replacing B3:B12 with B3:B22 will resolve this error as the row count will match.

Step 3 - Press enter to see the results displayed

The results are now populated and the data range is sorted in an ascending order.

Google Sheets sort - Using a data range: Results


If you enjoyed this article, you might also like our article on how to sort by date in Google Sheets or how to sort in Google Sheets.

If you want to learn how to create an email list from Google Sheets, we also suggest checking out our detailed guide. 

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->