To sort a range in Google Sheets without scrambling the rows, select the whole block you want to sort, then use Data > Sort range > Advanced range sorting options and tick "Data has header row" if your first row is a header. Google Sheets sorts the entire selected block together, so the values in each row stay matched. The key is selecting every column of the block before you sort, because sorting a single column moves only that column and breaks the row relationships.

What You'll Need

  • A Google account with access to Google Sheets (desktop browser or the mobile app).
  • A sheet with data laid out in rows, where each row is one record and each column is one field.
  • Editor access to the file — viewers cannot sort.

Step-by-Step

These steps are for the desktop browser version. Menu labels can differ slightly by version, device or region, and the mobile app uses a shorter menu.

  1. Open your spreadsheet in Google Sheets.
  2. Select the block you want to sort. Click the first cell of the block, hold Shift, and click the last cell — or click a column letter and drag across the columns you need. Include every column that belongs to a row, plus the header row if you have one.
  3. Go to Data > Sort range. If you are sorting a plain block without a header, you can pick Sort range by column A to Z or Z to A directly.
  4. For full control, choose Advanced range sorting options.
  5. If your first row contains column names, tick Data has header row. The sort dropdowns then show your header names instead of "Column A", "Column B", and so on.
  6. Pick the column to sort by in the Sort by dropdown, then choose A → Z or Z → A.
  7. Optionally click Add another sort column to break ties — for example, sort by Last Name, then by First Name.
  8. Click Sort. The entire selected block reorders, and each row stays intact.

If you select a single cell inside a contiguous table and use Data > Sort range, Sheets usually detects the surrounding block and offers to expand the selection for you. Confirm the expanded range in the dialog before sorting — check that the range shown covers all your columns and rows.

On the mobile app, select the cells, tap the three-dot menu, then look for the sort option in the menu. The app offers fewer sort controls than the browser, so for multi-level sorting use the desktop version.

Common Mistakes

  • Sorting one column only. If you select just column B and sort, only column B moves and the rows no longer match. Always select the full block.
  • Leaving the header out of the selection but not ticking "Data has header row". The header gets sorted into the data as if it were a value. Either include the header and tick the box, or exclude the header from the selection.
  • Forgetting merged cells. Merged cells inside the range can block sorting or produce odd results. Unmerge before sorting.
  • Sorting a filtered view and expecting hidden rows to stay put. Sorting reorders all rows in the range, including hidden ones.
  • Sorting formulas that reference fixed cells. Relative references move with the rows, but absolute references ($A$1) do not — check formulas after sorting.

Tips

  • Convert your range to a table with Format > Convert to table if available in your version; tables keep headers fixed and make sorting and filtering more predictable.
  • Use Data > Create a filter for quick A–Z sorting from the column header arrow, but remember filters sort the whole filtered range, not just visible rows.
  • Freeze your header row with View > Freeze > 1 row so it stays visible while you scroll and sort.
  • Before a big sort, make a copy of the sheet (File > Make a copy) so you can compare or revert.
  • Use Ctrl+Z (Windows/ChromeOS) or Cmd+Z (Mac) immediately if a sort goes wrong.

Troubleshooting

  • The sort dialog shows the wrong range. Cancel, reselect the full block including headers, and reopen Data > Sort range.
  • Rows are now mismatched. Undo right away with Ctrl+Z or Cmd+Z. If you have already made other edits, use File > Version history > See version history to restore an earlier version.
  • Sort options are greyed out. Check that you have edit access, that the sheet is not protected, and that you are not in a cell inside a merged range.
  • The header sorted into the data. Undo, then redo the sort with Data has header row ticked.
  • Sorting looks wrong on text that contains numbers. Sheets sorts text and numbers differently; values stored as text (often left-aligned) sort character by character. Convert them to numbers first.

Frequently Asked Questions

How do I sort in Google Sheets without mixing up the rows?

Select the entire block — every column and row you want to reorder — then use Data > Sort range. Sorting a single column is what causes rows to mismatch.

What does "expand selection" mean when sorting?

When you sort a range, Sheets may offer to expand the selection to the surrounding data so the whole table sorts together. Accept it only after checking the highlighted range covers all your columns.

Can I sort by more than one column?

Yes. In Data > Sort range > Advanced range sorting options, click Add another sort column and set a second and third sort key.

Does sorting change my formulas?

Relative references move with their rows, so formulas usually keep pointing at the right cells. Absolute references stay fixed to the same cell, which can change results after a sort — review formulas afterwards.

Why is my header row being sorted with the data?

Because "Data has header row" was not ticked. Undo, reopen the sort dialog and enable that option.

Can I sort on the Google Sheets mobile app?

Yes, but with fewer options. Select the cells, open the three-dot menu and choose the sort command. For multi-level sorting, use the desktop browser version.