To sort multiple columns in Google Sheets, select your entire data range (including headers), then go to Data > Sort range > Advanced range sorting options. Tick the box for "Data has header row," choose your first sort column and order (A–Z or Z–A), click Add another sort column to add secondary sorts, and click Sort. That's the short answer. The rest of this guide covers the exact clicks, how to avoid scrambling rows, and what to do when the sort does not behave as expected.

What You'll Need

  • A Google account and access to Google Sheets (desktop browser or the mobile app).
  • Data arranged in a table where each row is a complete record and each column has a clear header.
  • No blank rows or fully blank columns inside the range you plan to sort.

Step-by-Step

  1. Open your spreadsheet in Google Sheets. The steps below use the desktop browser version; mobile steps are noted where they differ. Menu labels can differ slightly by version, device or region.
  2. Select the full data range you want to sort. Click the first cell of your table (for example A1, the top-left header) and drag to the bottom-right cell of the last column. Alternatively, click any cell inside the table and press Ctrl+A (Windows/ChromeOS) or Cmd+A (Mac) to select the contiguous block. Confirm the selection includes every column you want to keep aligned with each row.
  3. Open the sort dialog. Go to Data > Sort range > Advanced range sorting options. Do not use the simple A–Z or Z–A icons in the toolbar for multi-column sorts; those sort by a single column and can produce unexpected results if the range is not selected correctly.
  4. Tick "Data has header row." This tells Sheets to keep your header labels at the top and to show column names in the sort dropdowns instead of letters. If your selection has no headers, leave it unticked.
  5. Choose the primary sort column. In the first "Sort by" dropdown, pick the column that should decide the main order (for example, "Department"). Select A → Z for ascending or Z → A for descending.
  6. Add secondary sort columns. Click Add another sort column. A second dropdown appears. Choose the column that should break ties in the first column (for example, "Last Name"), and set its order. Repeat for as many levels as you need. Sheets applies them in the order shown, top to bottom.
  7. Review the order of the sort levels. The first dropdown is the most important. If you want to sort by date and then by name, date must be first. You can drag the levels to reorder them if the dialog supports it, or remove and re-add them.
  8. Click Sort. Sheets reorders the rows in place. Check a few rows to confirm that related values stayed together (for example, that a person's name still matches their phone number).
  9. On mobile: open the Sheets app, tap the column letter to select a column, then tap it again to open the menu and choose Sort A → Z or Sort Z → A. For multi-column sorts, the mobile app is more limited; the reliable path is to use the desktop browser version, or create a filter view and sort within it.

Common Mistakes

  • Sorting only one column. If you select a single column and click the toolbar sort icon, Sheets may ask whether to expand the selection. Choosing "Continue with current selection" sorts that column alone and breaks the link between rows. Always select the whole table first.
  • Forgetting the header row setting. If "Data has header row" is unticked, your header text gets sorted into the data as if it were a value, which can push it into the middle of the table.
  • Leaving blank rows inside the range. Blank rows can cause Sheets to treat the data as separate blocks. Remove or fill them before sorting.
  • Sorting a range that includes merged cells. Merged cells can prevent sorting or produce an error. Unmerge them first.
  • Assuming formulas move with rows. Relative references usually adjust, but absolute references and cross-sheet formulas may not behave as expected. Check key formulas after sorting.
  • Sorting a filtered view. If a filter is active, sorting may only reorder visible rows. Clear the filter or sort the full range to avoid hidden rows ending up out of order.

Tips

  • Use a filter view for repeatable sorts. Create one via Data > Filter views > Create new filter view. You can sort and filter inside it without changing what other collaborators see.
  • Keep a backup. Before a large sort, duplicate the sheet (right-click the tab > Duplicate) so you can compare or revert.
  • Use named ranges. Select your table, then Data > Named ranges to give it a name. You can then select the range quickly from the name box.
  • Sort by date or number correctly. Make sure date and number columns are formatted as dates or numbers, not text. Text-formatted dates sort alphabetically, which is rarely what you want.
  • Consider SORT and SORTBY functions. For a dynamic sorted copy that updates automatically, use =SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...]) in a separate area. This leaves the original data untouched.

Troubleshooting

  • The Sort option is greyed out. This often happens when the selection includes a protected range, a merged cell, or when you are viewing a filter view you cannot edit. Check for protection via Data > Protect sheets and ranges.
  • Rows look scrambled after sorting. Undo immediately with Ctrl+Z (or Cmd+Z on Mac). Then reselect the entire table, including all columns, and repeat the advanced sort.
  • Headers moved into the data. Undo, then redo the sort with "Data has header row" ticked. If your headers are not in the first row of the selection, adjust the range to start at the header row.
  • Sort order is wrong for numbers or dates. Check the column format via Format > Number. Values stored as text sort differently from true numbers and dates.
  • Only some rows moved. This usually means the selection missed rows or included a blank row. Undo, then select from the top-left header to the bottom-right data cell in one drag.
  • Sorting does not stick after a refresh. If you sorted inside a filter view, the view may reset. Use a standard sort on the full range, or reapply the filter view sort.

Frequently Asked Questions

Can I sort by more than two columns?

Yes. In the advanced range sorting options dialog, click Add another sort column as many times as you need. Each added level breaks ties from the level above it.

Does sorting multiple columns work on the Google Sheets mobile app?

The mobile app offers basic single-column sorting. For full multi-column control, use the desktop browser version. You can also create a filter view on desktop and open it on mobile, though editing sort levels on mobile is limited.

Will sorting break my formulas?

Relative references generally adjust when rows move, but absolute references and formulas that point to specific cells may not. After sorting, spot-check important formulas. Using the SORT function in a separate area avoids changing the original data.

How do I sort a range that includes merged cells?

Unmerge the cells first. Merged cells can block sorting or cause an error. Select the merged area, then Format > Merge cells > Unmerge.

Can I sort only part of a sheet without affecting other data?

Yes, as long as you select only the range you want to sort. Sheets sorts within that selection. Be careful that the selection includes complete rows of your table so related data stays together.

What is the difference between sorting and filtering?

Sorting reorders rows; filtering hides rows that do not match criteria. You can combine them: apply a filter to narrow the view, then sort the visible rows. For repeatable setups, use a filter view.