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.
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
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)
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.
Please ensure there is enough space for the new list to populate
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
The sorted list will be populated and displayed in an ascending order (A-Z).
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.
Please ensure there is enough space for the new list to populate
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.
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:
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.
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.