Comment Sort in Google Sheets [2 Easy Methods]

Video sort a google sheet

Sorting data in a certain order makes it easier to work with organized data. That’s why the sorting function in Google Sheets is so useful. But sorting is not limited to just one method. Follow this guide to learn how to sort in Google Sheets using different methods.

How to Sort in Google Sheets

  1. Select a cell in the column you want to sort.
  2. Highlight the entire range by clicking and dragging from the initial cell.
  3. Go to “Data” > “Sort range” and choose the desired sorting order.

What is the Sorting Function in Google Sheets Used For?

As the name suggests, the sorting function in Google Sheets helps us sort data within a range of cells and returns the sorted result in a new range of cells.

This function enables us to sort data in ascending or descending order. It also allows us to sort data based on one or multiple column criteria.

The Difference Between the Sort Menu and the SORT Function

Google Sheets offers two ways to sort data:

  1. Use the “Sort” menu (found under the “Data” menu).
  2. Use the SORT function in Google Sheets.

While the “Sort” menu is easily accessible, the SORT function allows you to enter the formula in the formula bar, giving you more control over the sorting process in Google Sheets.

The main difference between the above two methods is that the “Sort” menu operates on the original data range and modifies it.

On the other hand, the SORT function displays the sorted data in a new data range, while preserving the original data.

Sorted Range using the Sort Menu

In contrast, the SORT function displays the sorted data in a new data range, while preserving the original data.

Sorted Range using the SORT function

You can sort in alphabetical order or in any ascending or descending order. For example, you can use these methods to sort by date.

How to Sort an Entire Google Sheet

Now that you know how to sort a column in Google Sheets, let’s see how to sort an entire sheet. You can use the “Sort” menu to do this. Here’s how to sort data in Google Sheets using the “Sort” menu:

  1. Select the column header of the column by which you want to sort the sheet.
  2. Go to “Data” > “Sort sheet”.
  3. Choose how you want to sort the sheet.

Syntax of the SORT Function in Google Sheets

The syntax of a SORT formula in Google Sheets is as follows:

SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, …])

  • range: This is the group of cells on which you want to apply the SORT function (the cells you want to sort).
  • sort_column: This is the main column by which you want to sort the data in the range.
  • is_ascending: This specifies whether the range should be sorted in ascending or descending order of sort_column. It can be TRUE or FALSE, with FALSE representing “descending” order.

The above three parameters are mandatory in a SORT formula, but you can also add additional parameters if you want to sort the range based on other column criteria. In that case:

  • sort_column2: Represents the secondary column by which you can sort the data in the range.
  • is_ascending2: This specifies if we want to sort the range in ascending or descending order of sort_column2. This parameter can also be a TRUE or FALSE value.

You can add more [sort_columnX, is_ascendingX] pairs in this manner depending on the number of column criteria you need to sort your data in the range.

Note: sort_column can be specified either as a column index (a number representing the position of the column in the range) or as a reference (the range of cells of the column, e.g., A2:A5). The number of cells in sort_column must be equal to the number of rows in the range. Otherwise, the SORT formula will return an error.

How to Sort Cells in Google Sheets Using the SORT Function (Examples)

Once you understand the syntax of the SORT function in Google Sheets, its application is quite straightforward.

We will look at two ways to use the SORT function in Google Sheets:

  1. When you want to sort by a single column.
  2. When you want to sort by multiple columns.

You can also sort by rows.

To explain the two sorting methods in Google Sheets, we will use the following example data. We will use the SORT function to sort the following data:

Data set for the SORT function in Google Sheets

To help you see the differences between the original data and the sorted data, we will sort the above data and display it in the same sheet (in a neighboring range of cells).

You can also enter the SORT formula in a new sheet and display the sorted data there.

Sorting in Ascending Order by a Single Column in Google Sheets

When you want to sort by a single column, only the first three parameters of the SORT function syntax are sufficient to achieve the desired result.

For example, from our example data, we want to sort all rows by company name (column A). Here’s how to display the sorted data range from cell F2:

  1. Copy the data column headers and paste them on the first row (cells F1 to I1 in our example).
  2. In cell F2, enter the following formula:
=SORT(A2:D8, A2:A8, TRUE) or =SORT(A2:D8, 1, TRUE)
  1. Press “Enter”.

You should now see the entire sorted data occupying the range from cell F2 to I8. Note that the result of the SORT function is dynamic.

The Google Sheets sort column in our formula is A2:A8, the company name. The rest of the columns will be sorted based on this column.

Any changes you make to the original data will also be reflected in the sorted result. If you want to learn how to sort numbers in Google Sheets from highest to lowest, you need to use FALSE instead of TRUE in the formula.

Also, note that you cannot make any modifications to the sorted result. Attempting to do so will result in a #REF error.

Using the Google Sheets SORT Function with Multiple Columns

If you look at the sorted data now, you will notice that some company names are repeated.

Furthermore, if you want to ensure that the rows are sorted in descending order of the delivery date whenever a company name is repeated, the SORT function simplifies this process as well.

In this case, you can introduce additional parameters in the SORT function. Here’s how to do a custom sort in Google Sheets with multiple parameters:

We can sort our data by company name and then sort by date using the formula:

=SORT(A2:D8, 1, TRUE, C2:C8, FALSE)

In the above formula, we added two new parameters:

  • We set sort_column2 to column C2:C8 (the Delivery Date column).
  • We set is_ascending2 to FALSE because we want to sort in descending order of the delivery date.

This gives the following result:

Result of sorting with multiple columns in Google Sheets

You will notice in the above figure that the data is first sorted alphabetically by company name.

Whenever there is a repetition of a company name, the rows containing repeated company names are then sorted in descending order of the delivery date.

For example, the company name Krajcik-Lowe appears in three lines. These lines are then sorted with the most recent dates appearing first and the oldest dates appearing last.

You can further refine this search if you wish by adding more parameters, such as:

[sort_columnX, is_ascendingX]

How Many Columns Can I Sort?

You can add as many parameters and arguments to your columns as you want. In the above example, we used two SORT arguments to sort the data. You could use 3 or more with TRUE or FALSE parameters to further sort the data.

How to Sort a Range (How to Sort by Multiple Columns)

You can also use the “Sort” menu to sort a range by multiple columns. Here’s how:

  1. Highlight the data range you want to sort.
  2. In the toolbar, go to “Data”.
  3. Choose “Sort range” > “Sort range options”.

Choose "Sort range" > "Sort range options".

  1. Choose the first column by which you want to sort from the “Sort by” dropdown list.

Choose the first column by which you want to sort from the "Sort by" dropdown list.

  1. Click “Add another sort column” to choose the second column. You can continue to add sort levels and click on this option.

Click "Add another sort column" to choose the second column.

  1. Click the “Sort” button to apply the sorting to the selected data.

Click the "Sort" button to apply the sorting to the selected data.

How to Sort in Google Sheets Using the Filter

Google Sheets also has a powerful feature called Filter, which allows you to sort and view data based on specific criteria. You can filter data to focus on specific subsets of data that meet certain conditions, allowing you to better identify patterns, trends, and relevant information.

Here’s how to use the filter to sort in Google Sheets:

  1. Select the data range.
  2. Go to “Data” > “Create a filter”.

Go to "Data" > "Create a filter".

  1. Suppose we want to sort by product. Click on the filter icon in the product column.

Click on the filter icon in the product column.

  1. Choose the “Sort A-Z” option.

Choose the "Sort A-Z" option.

The data range will then be sorted according to the product column, as shown below:

Related posts