How to Sort Data by Multiple Columns in Google Sheets

Organising complex data tables in Google Sheets often requires sorting by more than a single column. For instance, when managing a nationwide customer roster, you might want to sort entries primarily by county or state, and then secondarily by surname within each territory. Using basic single-column header filters can accidentally scramble row associations or fail to preserve primary group hierarchies. In Google Sheets, advanced range sorting and dynamic formulas allow you to define multi-tiered sorting hierarchies with ease.

Understanding Multi-Tiered Sorting Hierarchies

Multi-column sorting processes data records sequentially through assigned priority levels:

  • Primary Sort Key: The first column evaluated. All rows are grouped and ordered based on this column’s alphabetical, numeric, or chronological values.
  • Secondary Sort Key: Applied exclusively to resolve ties where rows share identical primary values, sorting subsets alphabetically or by date.
  • Tertiary Sort Keys: Additional tie-breakers used in vast datasets to maintain rigorous organisational order.

Method 1: Using the Advanced Range Sort Feature (In-Place Sort)

To sort an existing table directly on your sheet without writing mathematical formulas:

  1. Open your spreadsheet in Google Sheets.
  2. Highlight the entire table of data, including all columns and rows (e.g., A1:D100).
  3. Click on Data in the top menu bar.
  4. Hover over Sort range and select Advanced range sorting options.
  5. In the configuration dialogue, check the box labelled Data has header row so your column titles are excluded from sorting.
  6. Under Sort by, select your primary column (e.g., Region) and choose A to Z or Z to A.
  7. Click the Add another sort column button.
  8. Select your secondary column (e.g., Last Name) and specify its sort direction.
  9. Click Sort. The table rearranges immediately while keeping all row cells intact.

Method 2: Using the Dynamic SORT Formula

If you prefer keeping your original raw data unaltered while generating a cleanly sorted duplicate table elsewhere on your sheet:

  1. Click on an empty cell where you want the new sorted table to begin (e.g., F2).
  2. Enter the SORT function syntax:
    =SORT(A2:D100, 1, TRUE, 2, TRUE)
  3. In this formula:
    • A2:D100 represents your source data range.
    • 1 designates Column A as the primary sort column, with TRUE specifying ascending order (A to Z).
    • 2 designates Column B as the secondary sort column, with TRUE specifying ascending order.
  4. Press Enter. Google Sheets will automatically spill the sorted results across adjacent columns and rows, updating dynamically whenever source figures change.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.