In this article:

SORT Function Google Sheets: Everything You Need to Know!

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.

Use our capex approval software to easily set up capex approvals from your spreadsheet in just a few clicks. 

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

Automate repetitive tasks with Lido

Save hours on repetitive and tedious work. Lido is a new spreadsheet that connects your spreadsheets, forms, PDFs, and email inbox.

Trigger
Action
Select trigger
When a cell value in Google Sheets changes
Check Google Sheets for today's date
When a new row is added to Google Sheets
On new Google Form submission
Send me a daily reminder
On new Typeform submission
When a cell value in database changes
Check database for today's date
When a new row is added in database
When a new HubSpot customer is created
Select action
ADDCALENDAREVENT
Creates a one- or multiple-day calendar event with optional attendees
ADDHUBSPOT
Adds an object to Hubspot
ADDSLACKCHANNEL
Create a Slack channel, and optionally add a topic or members
CALLURL
Makes any HTTP request
CREATEGOOGLEDOC
Replaces [@column_name] values in a Google Doc with the corresponding table row's values
CREATEPDF
Replaces [@column_name] values in a Google Doc with the corresponding table row's values, then export it as a PDF
FETCH
Makes any HTTP request and returns the response
INSERTROWS
Inserts given array below defined values in given worksheet
SENDGMAIL
Sends an email using your Google account
SENDOUTLOOK
Sends an email using your Microsoft Outlook account
SENDSLACK
Sends a Slack message
SENDSMS
Sends an SMS message using your Twilio account
UPDATECELL
Updates cells with given values
UPDATEHUBSPOT
Updates a property of a Hubspot object
Trigger is required
Action is required
Get started