How to Sort a Pivot Table: A Complete Guide

Pivot tables are one of the most powerful tools in any spreadsheet application — but raw data organized in a pivot table isn't always easy to read at a glance. Sorting brings order to that data, letting you surface your most important values, spot trends faster, and present findings more clearly. Whether you're working in Excel, Google Sheets, or another spreadsheet tool, understanding how sorting works in a pivot table — and what controls it — makes the difference between a table that informs and one that overwhelms.

What Does Sorting a Pivot Table Actually Do?

When you sort a pivot table, you're reordering its rows or columns based on the values in a selected field. Unlike sorting a flat spreadsheet range, sorting in a pivot table respects the table's hierarchy — meaning your groupings, subtotals, and aggregations stay intact while the order of items within them changes.

You can sort by:

  • Row labels (alphabetically or reverse alphabetically)
  • Column labels (same principle, applied horizontally)
  • Values (ascending or descending — e.g., sort products by total revenue)

This distinction matters. Sorting by label is useful when you want consistent alphabetical presentation. Sorting by value is more analytically powerful — it lets you immediately see your highest-performing categories, biggest expenses, or most active customers at the top.

How to Sort a Pivot Table in Excel 📊

Excel gives you several ways to sort, ranging from quick clicks to more controlled manual approaches.

Method 1: Quick Sort Using the Dropdown

  1. Click the dropdown arrow next to a Row Label or Column Label header.
  2. Select Sort A to Z (ascending) or Sort Z to A (descending) for text fields.
  3. For numeric fields, this becomes Sort Smallest to Largest or Sort Largest to Smallest.

Method 2: Sort by Value

  1. Click any cell in the Values column you want to sort by.
  2. Go to the Home tab → Sort & Filter, or right-click the cell.
  3. Choose Sort Largest to Smallest (or the reverse).

Excel will reorder the entire row grouping based on that column's values while keeping all associated data aligned correctly.

Method 3: More Sort Options

Right-clicking a label and choosing Sort → More Sort Options opens a dialog where you can:

  • Set sort direction
  • Choose which value column to sort by
  • Apply AutoSort so the table re-sorts automatically when data refreshes

This is especially useful when your pivot table is connected to a live data source.

Manual Sorting

You can also drag row items into a custom order by selecting a label cell and dragging it to a new position. Excel will recognize this as a manual sort and respect it unless AutoSort overrides it. To prevent that, disable AutoSort in the More Sort Options dialog.

How to Sort a Pivot Table in Google Sheets

Google Sheets handles pivot table sorting slightly differently, and the options are somewhat more limited than Excel — worth knowing if you're switching between platforms.

  1. In your pivot table, click the dropdown arrow next to a row or column field in the Pivot table editor panel.
  2. Under Order, choose Ascending or Descending.
  3. Under Sort by, select either the label itself or a specific summarized value column.

Changes apply instantly. Google Sheets doesn't have a drag-to-reorder feature for pivot table rows — if you need a custom sequence, you typically need to adjust the source data or use a helper column.

Key Variables That Affect How Sorting Behaves

Sorting in a pivot table isn't always straightforward. Several factors influence how it works and what results you get:

VariableHow It Affects Sorting
Data typeText sorts alphabetically; numbers sort numerically; dates sort chronologically
GroupingGrouped fields (e.g., months inside years) sort within their group, not across the whole table
Multiple row fieldsOuter fields control top-level order; inner fields sort within each outer group separately
Filters appliedActive filters change which items are visible, which can make a sort look different than expected
Calculated fieldsCustom calculated values are sortable, but behavior can vary depending on how they're defined
Blank or null valuesThese often sort to the top or bottom inconsistently — worth cleaning source data before sorting

Sorting with Multiple Row Fields 🗂️

When your pivot table has nested row fields — for example, Region as an outer field and Product as an inner field — sorting behaves at each level independently. Sorting by value will sort products within each region by that value, not across all regions globally.

This is the behavior most analysts want, but it surprises many first-time pivot table users. If you need a flat global sort, you may need to flatten the hierarchy first or use a different table layout.

When a Sort Doesn't Stick

A common frustration: you sort a pivot table, then refresh the data and the sort resets. This usually happens because:

  • AutoSort is disabled and the table defaults to source data order on refresh
  • AutoSort is enabled but set to sort by label rather than value, reverting your manual order
  • The pivot table is connected to a query or Power Query step that returns data in a fixed sequence

In Excel, the fix is usually to open More Sort Options and explicitly set the sort rule you want applied on every refresh. In Google Sheets, the sort setting in the editor panel is persistent and should hold across refreshes.

The Part That Depends on Your Situation

The mechanics of sorting a pivot table are learnable and consistent across most spreadsheet tools. But how you apply them — which field to sort by, whether to sort at the outer or inner level, whether manual ordering or automatic sorting serves your reporting better — those choices depend entirely on what your data looks like, how often it refreshes, and what story you need the table to tell.

A pivot table built around monthly sales snapshots calls for different sorting logic than one tracking real-time inventory or aggregating survey responses. The right sort order is the one that makes your specific data immediately meaningful to whoever's reading it.