Google Sheets Function: SORT

The SORT function sorts the rows of a range based on the values of one or more columns.

Usage:

=SORT(range, sort_column, is_ascending)

or

=SORT(range, sort_column_1, is_ascending_1,
 sort_column_2, is_ascending_2, etc)


Example of use

The SORT function will return in the green table all the rows from the blue table sorted by name:

google sheets function sort png

Enter in the SORT function:

The formula here is:

=SORT(A2:C21,1,1)

google sheets function sort sorted table png

Sorting based on multiple columns

To perform sorting based on multiple columns, add sort_column and is_ascending values for each additional column.

For example, to sort by name and then by first name, enter:

=SORT(A2:C21,1,1,2,1)

google sheets sort sorted table columns png

If needed, you can copy the Google Sheets document (or view the document) with this example.