To sort a range in Google Sheets, select the full table or group of rows you want to rearrange, then choose Data > Sort range > Advanced range sorting options. Choose the column and order, mark Data has header row if the first row contains headings, and click Sort. Selecting all columns in each record keeps related information together.
What sorting a range means
A range is a group of cells, such as A1:C20. Sorting that range changes the order of its rows according to values in a chosen column. For example, a table with names, departments, and start dates can be sorted by start date while each person’s name and department move with that person’s row.
This is different from sorting just one column of a table. If you select only the names in column A and sort them, the names can become detached from the departments and dates in columns B and C. For a table whose columns describe the same records, select the complete table range before sorting. The goal is to reorder records, not to shuffle individual fields independently.
Sorting rearranges the cells in the selected range; it does not create a second, automatically updating copy. If you need to preserve the original order, make a copy of the data first or use a formula-based result in a separate area.
How to sort a range in the browser
In Google Sheets in a web browser, use these steps for a one-time sort:
- Select the full range, including all columns that belong to the records. Include the header row if there is one.
- Choose Data > Sort range > Advanced range sorting options.
- If your selection includes column headings, select Data has header row. This tells Sheets to treat the first row as labels rather than as a record to sort.
- Under Sort by, choose the heading or column to use as the main key. Choose A to Z for ascending order or Z to A for descending order.
- Click Sort and check a few rows to confirm that the records still line up correctly.
For a quick ascending or descending sort, the Data > Sort range menu may also offer a direct command for the selected column. The advanced options are more reliable when you need to confirm the selected range, identify a header row, or add another sorting key.
If the range does not include the entire table, cancel rather than proceeding. Expand the selection to include the other record columns, then open the sort options again. This is especially important when the sheet has notes or totals beside the table: include only the data that belongs to each record, not unrelated cells.
Headers and selecting the right cells
A header row contains labels such as Name, Region, and Revenue. When you include that row in the selection, enable Data has header row in the advanced sort options. Otherwise, Sheets may treat the labels like ordinary values and move them into the body of the table. If you leave the header outside the selected range, do not include it in the header setting; the selection should start at the first data row.
Before sorting, check whether the table has blank rows or columns inside it. A completely empty row can make it less clear which cells form one continuous block. If the table is split into separate blocks, select and sort each block deliberately rather than assuming Sheets will keep unrelated sections together.
It also helps to check for cells that look like part of the table but are not. A title above the headings, a note below the last record, or a total at the bottom may not belong in the sort. Leave those cells out unless they are meant to move along with the data. If a total row is included in a sort, it may move among the records and no longer sit at the bottom.
Sorting by more than one column
Use multiple sort keys when one column alone does not give the grouping or order you want. In the advanced range sorting options, choose the main column first, then use Add another sort column to set a secondary key. The first key determines the broad order; the next key orders records that have the same value in the first column.
For example, to arrange a staff list by department and then by last name, sort first by Department from A to Z and add Last name from A to Z as the second key. The result groups departments alphabetically and sorts the people alphabetically within each department. To sort a sales table by region and then by highest sale, use Region ascending as the first key and Sales descending as the second.
Choose the keys in order of importance. If you make Sales the first key and Region the second, the result prioritizes sales across the entire list rather than grouping records by region. You can reopen the sort options and adjust the sort keys if the first result is not the intended one.
Sort range versus sort sheet
Sort range is for rearranging a selected block of cells. Sort sheet applies a sort to the sheet’s rows using a chosen column. When a sheet contains one table, either approach may seem to give the same result, but they are not interchangeable when a worksheet contains several separate areas of data.
For example, a worksheet might contain a customer list in columns A through D and a separate set of monthly targets in columns F through G. Sorting the customer range should not reorder the targets. A whole-sheet sort could affect rows beyond the customer list, so use the selected range when you need to keep the operation confined to one table.
When working with a filter, a column’s sort command can reorder the visible table while keeping its rows together. Filters are useful for repeatedly sorting or narrowing down a dataset, but confirm that the filter covers the entire table. Avoid sorting a partial set of columns just because those are the cells currently visible or selected.
Using the SORT function for a separate result
The SORT function is an alternative when you want a sorted result in another part of the sheet while leaving the original cells in place. In Google Sheets, the formula returns a sorted array. Put it in a clear area with enough empty cells for the results to expand, and exclude the header row from the input range if you do not want the heading sorted as a record.
For example, with headings in A1:C1 and records in A2:C20, where column B is the second column in the selected range, enter =SORT(A2:C20,2,TRUE) in an empty cell. It returns the records ordered by column B from low to high, while the original range remains unchanged. Use FALSE instead of TRUE for descending order. If the output area is not empty, the result may not be able to expand there.
A formula-based result is useful for a display that should update as source data changes, but it is not the same as sorting the source range. Do not type into the expanded result area as if each result cell were independent; change the source data or the formula instead. For a one-time rearrangement that should change the existing table, use the Data menu.
Filters and repeat sorting
If people need to sort and filter the same table regularly, select the table and choose Data > Create a filter. Filter controls appear in the header row. Use a column’s filter control to sort A to Z or Z to A, or to show only records that meet particular conditions. A filter changes what is displayed; it does not delete records that are hidden by the filter.
For a temporary view of filtered or sorted data, Google Sheets also provides filter views. Choose Data > Filter views to create or manage one. Filter views can be useful when collaborators want different ways to inspect the same data without changing the view for everyone in the same way. They are not a substitute for checking the range and header settings before sorting.
Use a filter when you expect to revisit the table, sort it in different ways, or narrow it by criteria. Use a direct sort when you simply need to change the stored row order once. If the table is shared, communicate before making a permanent sort that could affect how another person expects to find records.
Common sorting problems and fixes
- Rows no longer match. Usually, only one column or part of the table was selected. Undo immediately with Ctrl+Z on Windows or Command+Z on Mac, then select the full record range and sort again. If other edits have happened since, inspect the data before undoing further changes.
- The heading moved into the records. Reopen the advanced sort options and set Data has header row correctly. Check that the heading row is actually included in the selected range.
- Numbers appear in an unexpected order. Some entries may be stored as text rather than numbers. For example, a value pasted with an apostrophe or inconsistent formatting may not behave like a numeric value. Check the cell contents and formatting, and make the values consistent before sorting.
- Dates are out of order. A date that is stored as text may sort differently from a recognized date value. Check whether the cells are genuine dates, not merely date-looking text, and use a consistent date format.
- Names or labels appear in an odd alphabetical order. Extra spaces, punctuation, accents, or inconsistent spelling can affect the apparent sequence. Clean up the values if they are intended to be treated as the same category. Locale settings can also affect conventions for text and numbers.
- Blank cells appear near the top or bottom. Empty values can be part of the selected range. Check for genuinely empty cells and formulas that return an empty string, and decide whether those rows belong in the sorted table.
Sorting itself does not repair inconsistent data. When the ordering seems wrong, inspect the underlying values and the selected range before repeating the operation. Repeating a sort with the same settings will not fix values that are text in one row and numbers in another.
Google Sheets on mobile
The instructions above describe Google Sheets in a web browser, where the Data menu and advanced range options are available. The Sheets mobile apps have a different interface, and the location or availability of sorting controls can vary by device and app version. If you do not see the same range-sorting options on a phone or tablet, open the file in a desktop browser for the steps described here.
Before sorting on any device, make sure you have selected the intended table and that the header is recognized. On a small screen it can be harder to see whether adjacent columns are included, so check the range carefully. Sorting a shared sheet can change the order other collaborators see, regardless of which device performs the operation.
Frequently Asked Questions
How do I sort a range without sorting the whole sheet?
Select the table cells you want to rearrange, then choose Data > Sort range > Advanced range sorting options. Make sure the selection includes every column that belongs to the records and excludes unrelated tables.
How do I keep the header row at the top?
Include the header in the selected range and turn on Data has header row in the advanced sort options. Alternatively, start the selection at the first data row and leave the header out of the sort entirely.
Can I sort Google Sheets by two columns?
Yes. Open Advanced range sorting options, choose the primary column, and click Add another sort column for the secondary key. The second key orders rows that tie on the first key.
Will sorting a range change the original data?
A Data menu sort rearranges the selected cells in place. The SORT function instead returns an ordered result in another area and leaves its source range in place.
Why did sorting one column separate it from the rest of my data?
The selected range likely covered only that column. Undo if possible, then select the complete table before sorting so each row’s related values move together.
Can I undo a sort?
Yes, use Ctrl+Z on Windows or Command+Z on Mac soon after the sort. If later edits have been made, review the change history and the current data carefully rather than assuming that undoing will restore only the sort.
Related
- Insert a Cover Page in Word: Steps and Tips
- Insert a Checked Checkbox in Word: 3 Simple Methods
- Insert a Circle Checkbox in Word: Symbols and Options
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Create CD Labels in WordTo create CD labels in Word, download the template for your exact label sheet, open it in desktop…
- How to Make a Booklet in Microsoft Word 365To make a booklet in Word 365, open the desktop app, go to Layout > Margins > Custom…
- Unable to Block a Sender in Outlook? Try These FixesIf you can’t block a sender in Outlook, add the address to your account’s blocked-senders list in Settings;…
- Freeze Just the Top Two Rows in Excel: A Quick GuideTo keep only the top two rows visible while you scroll in Excel for Microsoft 365 on Windows,…
- How to Schedule an Email in OutlookTo schedule an email in Outlook, write your message, open the menu beside Send, and choose Schedule send…
- How to Make a Booklet in Microsoft Word, Step by StepTo make a booklet in Microsoft Word, set the document’s page layout to Book fold, write and format…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.