How to Sort Multiple Columns in Google Sheets: A Step-by-Step Guide

Learn how to sort multiple columns in Google Sheets with practical, step-by-step methods. This guide covers built-in sort options, the dynamic SORT function, and best practices to keep data aligned across rows.

How To Sheets
How To Sheets Team
·5 min read
Sort in Sheets - How To Sheets
Photo by StockSnapvia Pixabay
Quick AnswerSteps

By the end of this guide, you will learn how to sort multiple columns in Google Sheets so that each row stays intact while you order by several criteria. You’ll explore built-in sort options and the dynamic SORT function, with practical examples and clear safety tips to avoid misaligned data.

Why sorting multiple columns matters

When you work with tabular data in Google Sheets, sorting by more than one column helps preserve the relationship between fields in each row. For example, sorting first by date and then by category ensures related items stay paired correctly, producing cleaner reports and more accurate summaries. This approach is especially valuable for students organizing assignment data, professionals tracking client milestones, and small business owners managing inventory or sales records. According to How To Sheets, mastering multi-column sorting is a foundational skill for reliable data analysis. In this section, we’ll explore scenarios where multi-column sorts shine and lay the groundwork for practical, real-world usage across tools and templates.

Core concepts behind multi-column sorts

Multi-column sorting works by establishing a priority order for one or more columns. The leftmost sort key has the highest priority, followed by the next key, and so on. This ensures that when the primary column has ties, the secondary column determines the final order, while all related rows stay tied together. In practical terms, you might sort first by Region, then by Sales Amount, and finally by Date to reveal seasonal patterns. There are static sorts (applied once) and dynamic sorts (update automatically as data changes). Understanding these concepts helps you choose between the built-in sort tools and dynamic functions like SORT.

Method 1: Static sort with Data > Sort range

Static sorting uses Google Sheets’ built-in range sort tool. Start by selecting the full data range you want to sort, including all relevant columns to maintain row integrity. Go to Data > Sort range. If your table has a header row, enable Data has header row so headers stay in place. Choose the primary sort column and order (ascending or descending). To refine the order, click Add another sort column and specify secondary keys (and a third, if needed). Finally, press Sort. This method is straightforward and excellent for one-off data cleanups. Be aware that changing data later won’t dynamically update the sorted view unless you reapply the sort.

Method 2: Dynamic multi-column sort with the SORT function

The SORT function creates a live, dynamic sorted view that updates as you add or modify data. A common pattern is:

  • Static range example: =SORT(A2:D, 2, TRUE, 3, FALSE)
  • Explanation: A2:D is the data range, 2 is the primary sort column (Column B), TRUE means ascending, 3 is the secondary sort (Column C), and FALSE is descending.

If your dataset has a header row, sort the data body (A2:D) and keep the header in place. You can also use array constants to specify multiple sort columns simultaneously, e.g., =SORT(A2:D, {2,3}, {TRUE, FALSE}). This approach is powerful for dashboards and live reports because the output automatically reflects new rows and edits.

Method 3: Sorting with FILTER for dynamic views

FILTER can create a sorted, filtered view of your data. Combine with SORT to control both which rows appear and in which order. Example:

=SORT(FILTER(A2:D, D2:D<>""), 2, TRUE, 3, FALSE)

This keeps only non-empty entries and sorts by the same two criteria as above. FILTER+SORT is especially useful when you only want to display a subset of your data in a separate sheet or a dashboard tab, without altering the original dataset. Remember to verify that all relevant columns are included in the filter range to avoid misalignment.

Practical examples: real-world datasets

Consider a simple sales table with columns: Date (A), Region (B), Sales (C), and Product (D). To see the top sales by region for the most recent dates, you could apply a static sort: sort by Date (A) then by Region (B) and Sales (C) with appropriate orders. For a live report, place the dynamic sort on a summary sheet: =SORT(A2:D, 2, TRUE, 3, FALSE). If you only want to show entries for a specific quarter, wrap the data with FILTER first: =SORT(FILTER(A2:D, B2:B="North"), 1, FALSE). These patterns illustrate the flexibility of multi-column sorting across typical business tasks.

Common pitfalls and how to avoid them

  • Pitfall: Sorting only a portion of the dataset can misalign rows. Always include all related columns in the sort range.

  • Pitfall: Merged cells inside the sort range can produce irregular results. If you must merge, do so outside the sort flow or avoid merging in the sort range.

  • Pitfall: Not updating the sort criteria when data grows. If you add columns or new data, review sort columns and consider a dynamic SORT approach for ongoing accuracy.

  • Pitfall: Confusing sort order when numbers are stored as text. Ensure numeric values are truly numeric (no stray spaces, currency symbols, or thousands separators that turn them into text).

  • Best practice: Back up your data before performing large sorts and test on a copy to confirm the outcome.

Authority sources

  • Data integrity and sorting strategies in spreadsheets ensure consistent reporting. For further reading on data handling and standards, see: https://www.census.gov
  • Verification and data quality principles can be explored through official standards and statistical methods: https://www.nist.gov
  • Public data practices and best-practice guidelines are discussed in institutional resources: https://www.bls.gov

Quick reference cheat sheet

  • Always include the entire range you intend to sort to keep rows aligned.
  • Use Data > Sort range for one-off sorts; use SORT for dynamic, updating views.
  • Prefer using a header row option to keep headers visible and distinct.
  • Combine SORT with FILTER for powerful, dynamic dashboards.
  • Back up your data before major sorts to prevent accidental data loss.

Tools & Materials

  • Google account with Sheets access(Stable internet connection and permissions to edit the workbook)
  • Sample dataset with multiple columns(Include headers and data in all relevant columns)
  • Device with a browser (PC/Mac/Chromebook)(Chrome or Firefox recommended for best compatibility)
  • Keyboard shortcuts cheat sheet (optional)(Helpful for speed, not required)

Steps

Estimated time: 10-15 minutes

  1. 1

    Select the data range

    Highlight the full range you want to sort, including all columns that must move together. If you have a header row, include it in the range so the sort can reference headers correctly. Confirm that all related data is within the selection to prevent row misalignment.

    Tip: Tip: Include the header row in the selection if you plan to use the header option in the next step.
  2. 2

    Open Sort range and set header option

    Go to Data > Sort range. In the dialog, check Data has header row if your table includes headers. This keeps header cells from moving with the data and preserves readability.

    Tip: Tip: If your sheet uses a header row, always enable this option to avoid accidentally sorting headers with data.
  3. 3

    Choose primary sort column and order

    Select the first column you want to sort by (the highest priority) and choose ascending or descending. This establishes the main order for your dataset.

    Tip: Tip: Use the left-to-right priority mindset—columns on the left typically represent primary attributes like Date or Region.
  4. 4

    Add secondary sort criteria

    Click Add another sort column and specify the next key (e.g., Sales or Category) along with its order. You can add a third key if needed to break ties cleanly.

    Tip: Tip: Use multiple sort keys to ensure deterministic ordering when primary keys are duplicated.
  5. 5

    Apply and verify the result

    Click Sort to apply. Review the sorted data to confirm that all rows moved together and that secondary orders align with expectations. If something looks off, undo and adjust the sort criteria.

    Tip: Tip: If you need an audit trail, copy the sorted output to a new sheet before making further changes.
Pro Tip: Always back up your data before performing large sorts.
Warning: Do not sort a subset of your columns; include all related columns to keep rows intact.
Note: If you have merged cells, sort may misalign data. Avoid sorting within merged regions.
Pro Tip: Use Data has header row to keep headers in place during sorting.

FAQ

How do I sort by multiple columns in Google Sheets?

You can sort by multiple columns using either Data > Sort range with multiple sort levels or the SORT function for a dynamic view. Define the primary key and additional keys in the desired order.

Use Data > Sort range with several sort levels, or apply the SORT function for a live, updating sort.

What about the header row when sorting?

If your data has a header row, enable the Data has header row option in Sort range so headers stay fixed at the top and don’t move with the data.

Always indicate that you have a header row in the sort dialog.

Can I sort dynamically as data changes?

Yes. The SORT function creates a dynamic, updating view. Combine with other functions like FILTER for even more flexibility.

Yes—use the SORT function for dynamic results that update automatically.

What should I do if there are merged cells?

Avoid sorting within merged cells. If necessary, unmerge before sorting or move the merged area outside the sort range.

Unmerge cells to sort reliably.

Why isn’t sorting affecting all rows?

Ensure the entire relevant data range is selected. Sorting a partial range will misalign data across rows.

Make sure all related columns are included in the sort range.

Are there keyboard shortcuts for sorting?

There isn’t a universal single-key shortcut for sorting in Sheets; use the menu or create a custom script for shortcuts.

Use the Sort range menu or set up a script for shortcuts.

Watch Video

The Essentials

  • Sort by multiple columns preserves row integrity.
  • Use Sort range for static sorts and SORT for dynamic sorting.
  • Include all relevant columns in the sort range.
  • Back up data before performing major sorts.
Process diagram showing selecting range, choosing sort keys, and applying sort
Three-step process to sort by multiple columns in Google Sheets

Related Articles