How to Sort in Google Sheets (3 Easy Ways + the SORT Function)

How to Sort in Google Sheets (3 Easy Ways + the SORT Function)

Is your list a mess and you need it in order, fast? Google Sheets can sort your data in two clicks. In this guide you will learn three ways to sort, from the quickest to the smartest:

  • Method 1 – sort the whole sheet by one column (and keep the header on top),
  • Method 2 – sort a range by several columns at once,
  • Method 3 – the SORT function, which creates a sorted copy and leaves your original data untouched.

In the examples we use a small product list with four columns: Product, Category, Price and Units sold. The steps are the same in any browser on Windows, Mac or Chromebook.

Method 1: Sort the whole sheet by one column

This is the fastest way. The only thing to watch out for is the header row – if you do not freeze it, Google Sheets will sort it together with your data.

Step 1. Freeze the header row

Open the View menu at the top of the screen.

View menu in Google Sheets
Open the View menu

Point to Freeze and choose 1 row. A thick grey line appears under row 1 – the header is now locked in place.

View > Freeze > 1 row in Google Sheets
View → Freeze → 1 row

Step 2. Right-click the column letter and sort A to Z

Right-click the letter of the column you want to sort by – for example A (Product). In the menu, choose Sort sheet A to Z.

Sort sheet A to Z in the column menu
Right-click the column letter → Sort sheet A to Z

The products are now in alphabetical order, and the header stayed at the top.

Sheet sorted alphabetically with the header still on top
Sorted A → Z, header stays on top

Step 3. Sort a number column from largest to smallest

Numbers work the same way. Right-click column D (Units sold) and choose Sort sheet Z to A – this means largest to smallest.

Sort sheet Z to A in Google Sheets
Sort sheet Z to A = from largest to smallest

The best sellers are now at the top. Each row moves as a whole, so prices and categories always stay with the right product.

Rows sorted by units sold, the whole row moves together
The whole row moves together

Method 2: Sort a range by several columns

Use this when one column is not enough – for example, to group products by category and then show the most expensive product first inside every group.

Step 1. Select your table including the header

Click the first cell of your table and drag to the last one (here A1:D13), header included.

Table with header selected in Google Sheets
Select the whole table, including the header

Step 2. Open Data → Sort range → Advanced range sorting options

Open the Data menu, point to Sort range and click Advanced range sorting options.

Data > Sort range > Advanced range sorting options
Data → Sort range → Advanced range sorting options

Step 3. Tick “Data has header row”

In the Sort range window, tick Data has header row. Thanks to this, the headers stay out of the sort and you can choose columns by their names.

Data has header row checkbox
Tick “Data has header row”

Step 4. Choose the first sort column

In Sort by, choose Category and leave A to Z.

Sort by Category A to Z
Sort by: Category, A → Z

Step 5. Add a second sort column

Click Add another sort column. In the new then by row, choose Price…

Then by Price in the Sort range dialog
then by: Price

…and set it to Z to A, so the highest price comes first.

Price sorted Z to A
Price: Z → A (highest first)

Step 6. Click Sort

Click the green Sort button.

Sort button in the Sort range dialog
Click Sort

The rows are now grouped by category, and inside every group the most expensive product is first.

Data grouped by category with the most expensive product first
Grouped by category, most expensive first

Method 3: The SORT function (a sorted copy that updates itself)

The SORT function does not touch your original table. It builds a sorted copy next to it – and the copy updates automatically whenever your data changes.

Step 1. Click an empty cell

Click an empty cell where the sorted copy should start, for example F2.

Empty cell F2 selected
Click an empty cell, e.g. F2

Step 2. Type the formula

Type the formula and press Enter:

=SORT(A2:D13, 4, FALSE)
  • A2:D13 – the data to sort (without the header),
  • 4 – the number of the column to sort by (4 = Units sold),
  • FALSE – descending order (largest first); use TRUE for ascending.

Note: in some regions (for example most of Europe) Google Sheets uses semicolons instead of commas: =SORT(A2:D13; 4; FALSE). The file in the screenshots uses semicolons.

SORT formula typed in Google Sheets
=SORT(A2:D13; 4; FALSE)

Step 3. Check the result

The sorted copy appears next to your data, with the best sellers at the top.

Sorted copy created by the SORT function
The sorted copy next to the original table

Now change a value in the original table – here we changed the units sold for Monitor from 42 to 400. Monitor immediately jumps to the top of the copy. You never have to sort again.

SORT result updates automatically after changing data
The copy updates by itself

Tips and troubleshooting

  • Sorted by mistake? Press Ctrl + Z (Cmd + Z on Mac) right away, or restore an older version in File → Version history.
  • Sorting is blocked? Merged cells can stop sorting – unmerge them first (Format → Merge cells → Unmerge).
  • Numbers sort in a strange order (1, 10, 2…)? They are probably stored as text. Select the column and choose Format → Number → Number.
  • Sharing the file? Use Data → Create filter view and sort inside it – others will not see your sort order.

Summary

  1. Whole sheet: View → Freeze → 1 row, then right-click a column letter → Sort sheet A to Z / Z to A.
  2. Several columns: select the table → Data → Sort range → Advanced range sorting options → tick “Data has header row” → add sort columns → Sort.
  3. Sorted copy: =SORT(range, column_number, TRUE/FALSE) – updates automatically.

Frequently Asked Questions

Why did my header row get sorted with the data?

Freeze the first row (View → Freeze → 1 row) or tick “Data has header row” in Data → Sort range → Advanced range sorting options.

Can I undo a sort in Google Sheets?

Yes. Press Ctrl + Z (Cmd + Z on Mac) right after sorting, or restore an earlier version in File → Version history.

How do I sort without changing what my collaborators see?

Create a filter view (Data → Create filter view) and sort inside it. Only you see that sort order.

How do I sort by two columns in Google Sheets?

Select the table, open Data → Sort range → Advanced range sorting options, tick “Data has header row”, choose the first column, click “Add another sort column”, choose the second column and click Sort.

Does the SORT function update automatically?

Yes. The result of =SORT(range, column, TRUE/FALSE) recalculates whenever the source data changes.