How to sort a table A–Z in Google Sheets
Sort a table in Google Sheets A to Z or by several columns without scrambling rows. Keep the header in place, or sort with a formula instead.

Quick answer
To sort a table in Google Sheets, select the whole table including the header row, go to Data > Sort range > Advanced range sorting options, tick Data has header row, choose the column and order (A to Z or Z to A), and click Sort. To sort a whole sheet alphabetically in one click, freeze the header row, click a cell in the column, and choose Data > Sort sheet by column A to Z.
Steps at a glance
- Select all cells in your table, including the header row.
- Go to Data > Sort range > Advanced range sorting options.
- Check Data has header row.
- Choose the column to sort by and select A→Z or Z→A.
- Click Sort.
Interactive demo
This interactive demo was created free with Arclet in 3 minutes.
Create your own demo →Compare demo toolsSummary
Google Sheets has two sort commands. Sort sheet reorders every row on the tab by one column and moves the header too, unless the header row is frozen. Sort range reorders only the selected cells and can skip a header row. The usual way to scramble a table is sorting one selected column on its own. Its values move, the other columns stay put, and each row's data no longer lines up. Select every column of the table first, or use Sort sheet.
Step-by-step guide
Step 1
Select the table range
Click and drag to select all cells in your table, including the header row. Make sure the selection covers all columns so rows are sorted as complete units.
Step 2
Open Sort range
Go to Data > Sort range > Advanced range sorting options. A dialog box opens with sorting configuration.
Step 3
Check Data has header row
Tick the Data has header row checkbox. The sort column dropdown now shows your column names instead of letters, and the header row is excluded from sorting.
Step 4
Choose sort column and order
Select the column name you want to sort by from the dropdown. Choose A→Z for ascending or Z→A for descending. Click Add another sort column to add a secondary sort key.
Step 5
Apply the sort
Click Sort. The table rows reorder immediately based on your selections. The header stays in place at the top.
Why this matters
You've got a table of results and you need to see the highest values first, or group rows by a particular column, before you share it with the team or paste it into a report.
Troubleshooting
The header row is being sorted along with the data
In the Sort range dialog, check Data has header row to protect the first row from sorting.
Only part of the table is sorting and some rows are being left behind
The selected range did not include all columns. Press Ctrl+Z (Cmd+Z) straight away to undo, then select the entire table (all rows and columns) before opening Sort range.
Numbers sort as text (10 comes before 2)
The column is stored as text, which is common after a CSV import. Select it, choose Format > Number > Number, then sort again.
Sort sheet moved my header row into the data
Undo, then freeze the header with View > Freeze > 1 row. Sort sheet leaves frozen rows in place.
Sorting changes the order for everyone else in the file
Sorting rearranges the shared data. To sort only your own view, use Data > Filter views > Create new filter view and sort inside it.
Frequently asked questions
Does sorting change the data permanently?
Yes. Sorting rearranges the actual cells. Undo with Ctrl+Z (Cmd+Z), or restore an earlier version from File > Version history. Use the SORT function when you need the original order kept.
How do I sort alphabetically by last name when names are in one column?
Split the names first with Data > Split text to columns (choose Space as the separator), or add a helper column with the last name. Then sort the table by that column.
Can I sort a table by color in Google Sheets?
Yes. Use Data > Create a filter, then click the filter icon in the column header and choose Sort by color to sort rows by cell background or text color.
Does Google Sheets support sorting by a custom list order?
Not natively. For custom order sorting (e.g., sorting months in calendar order rather than alphabetically), you would need to add a helper column with numeric sort keys and sort by that.
Related guides
Continue with more step-by-step guides for getting work done.
How to create a filter view in Google SheetsLearn how to create a filter view in Google Sheets to sort, filter, and analyze data privately without changing what collaborators see in the file.
How to freeze rows in Google SheetsLearn how to freeze rows in Google Sheets so headers stay visible while scrolling, plus how to adjust or remove frozen rows.
How to search in Google SheetsLearn how to search for text, numbers, or formulas in Google Sheets using Ctrl+F to find matches and Ctrl+H to replace them.
How to convert CSV to Google SheetsLearn how to convert a CSV file to Google Sheets format, preserve your column structure, and save it as a native Sheets file.
How to subtract in Google SheetsLearn how to subtract numbers, cells, and dates in Google Sheets using formulas, the MINUS function, and cell references.
How to use Apps Script in Google SheetsLearn how to open, write, and run Apps Script in Google Sheets to automate tasks, build custom functions, and add menus.
Create interactive demos like this one — free, no coding required.
Start for free →