ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Data tools
  3. How to Sort a Pivot Table in Excel

How to Sort a Pivot Table in Excel

By ExcelReady Team·Updated November 2, 2026·5 min read

The short answer

To sort a pivot table by its numbers, right-click any value in the column and choose Sort > Sort Largest to Smallest. To sort the labels, click the arrow next to Row Labels and choose Sort A to Z. The Grand Total row stays at the bottom, and the pivot keeps its sort when you refresh it.

Key takeaways

  • Right-click a value and choose Sort > Sort Largest to Smallest to rank items by their totals.
  • Use the arrow on the Row Labels header to sort the labels A to Z or Z to A.
  • Drag a label, or use right-click > Move, to put items in any order you like.
  • With nested row fields, Excel sorts the items inside each group, and the groups by their subtotals.
  • Month names sort in calendar order because of Excel's custom lists, not alphabetically.
On this page+
  1. The sample pivot table
  2. How to sort a pivot table by values
  3. How to sort pivot table labels A to Z
  4. How to sort a pivot table in a custom order
  5. How to sort inside groups with nested row fields
  6. How to show only the top items
  7. Why won't my pivot table sort?
  8. Practise it

To sort a pivot table, right-click inside it and use the Sort menu: sort by the values to rank items from largest to smallest, or by the labels to list them A to Z. A pivot table remembers its sort, so the order holds when you refresh. This guide covers both kinds of sort, custom orders, nested fields, and the reasons a sort sometimes seems to do nothing.

The sample pivot table#

The examples use a pivot table that totals sales by region:

Row LabelsSum of Sales
East18,400
North25,100
South12,750
West31,600
Grand Total87,850

By default, Excel lists row labels in A to Z order, as here. That is rarely the order a manager wants. Usually the question is "which region sold the most?", and the answer should be at the top. If you haven't built a pivot table before, start with the pivot table guide for beginners.

How to sort a pivot table by values#

Sort by the numbers to rank items. This is the sort you will use most:

  1. Right-click any number in the Sum of Sales column, such as 25,100. On a Mac without a right button, Control-click.
  2. Choose Sort > Sort Largest to Smallest.

The rows now read West (31,600), North (25,100), East (18,400) and South (12,750). The Grand Total row stays at the bottom; it is never sorted with the other rows.

You can also click a value cell and use the Data tab: Sort Largest to Smallest (Z to A) does the same job. Either way, click a value in the body of the pivot. Excel sorts by the column you clicked, so if the pivot has two value fields, such as Sales and Units, click the one you want to rank by.

How to sort pivot table labels A to Z#

Sort by the labels when you want an alphabetical list, or to undo a value sort. Click the small arrow next to Row Labels in the header, then choose Sort A to Z or Sort Z to A.

If the pivot uses the Tabular or Outline layout, the arrow sits on the field name, such as Region, instead. You can also right-click any label and choose Sort > Sort A to Z.

Numbers stored as text sort like words, so labels such as 1, 2 and 10 come out as 1, 10, 2. Convert them to real numbers in the source data, then refresh the pivot.

How to sort a pivot table in a custom order#

Sometimes neither A to Z nor largest first is right, for example North, South, East, West. You have three ways to set your own order:

  • Drag. Click a label, move the pointer to the cell's border until it becomes a four-headed arrow, and drag the item up or down.
  • Use Move. Right-click a label and choose Move > Move "East" Up (or Down, or to the beginning or end).
  • Type over a label. Click the cell that shows East and type West. Excel moves West into that position instead of renaming the item.

For an order you use often, such as Small, Medium, Large, create a custom list. On Windows, go to File > Options > Advanced > Edit Custom Lists; on a Mac, Excel > Preferences > Custom Lists (called Settings in newer versions). Type the items in order and click Add. A pivot uses custom lists when it sorts A to Z, as long as Use Custom Lists when sorting is ticked under PivotTable Options > Totals & Filters. It is ticked by default.

How to sort inside groups with nested row fields#

When a pivot has two row fields, such as Region and then Product, the sort works inside each group. Right-click a product's value and choose Sort Largest to Smallest, and each region lists its products from best to worst. The regions themselves don't move.

To rank the regions too, right-click a region's subtotal and sort it the same way. Excel orders the regions by their subtotals and keeps each region's products together underneath. The lesson on nested row fields and subtotals practises exactly this layout.

To sort the columns from left to right, such as months across the top, right-click a value, choose Sort > More Sort Options, and pick Left to right under Sort direction.

How to show only the top items#

Sorting puts the biggest items first, but a long list still shows everything. To show only the top 3, click the arrow on Row Labels, choose Value Filters > Top 10, change 10 to 3, and click OK. Combine it with a largest-first sort for a clean ranking.

Ranking questions like this are common in pivot table interview questions. If you need a ranking in a formula instead, Excel 2021 and Microsoft 365 can do it with SORT, as in the exercise on this page.

Why won't my pivot table sort?#

When a sort seems to do nothing, one of these is usually the cause:

  1. You clicked outside the values. A click on a header or a blank cell next to the pivot sorts nothing useful. Click a number in the body of the pivot.
  2. A manual order is in place. After you drag items, Excel keeps your order. Open Sort > More Sort Options and choose Ascending or Descending to switch back to an automatic sort.
  3. New items land at the end after refresh. In More Sort Options, click More Options and tick Sort automatically every time the report is updated.
  4. Months sort in calendar order. Jan, Feb, Mar is a built-in custom list. Untick Use Custom Lists when sorting to sort them alphabetically, though calendar order is usually what you want. For dates, group them by month or year instead.
  5. You sorted the wrong field. A pivot with Count and Sum shows two columns. Check which one you clicked; the guide to counting in a pivot table explains how to tell them apart.

Practise it#

A sorted pivot table answers "what's the biggest?" at a glance, and it is a standard task in data and finance tests. Practise building pivot tables in a live spreadsheet: you total sales by region and read the answers off the pivot, with instant checks. Then move on to nested fields and subtotals, or test yourself with the data analyst Excel test.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

This is the output of a pivot table. Which region comes first when you sort Sales largest to smallest? In D2, use SORT on A2:B5 by column 2 in descending order, then INDEX to take row 1, column 1.

fx
ABCDE
1
Region
Sales
2
East
18400
Top region
3
North
25100
4
South
12750
5
West
31600
6
7
8

Tip: SORT(A2:B5,2,-1) sorts by the second column, largest first. INDEX(...,1,1) takes the first cell.

Practise this in a lesson

LessonPivot tables 1Build your first PivotTable on a new sheet: total sales by region, split them by product, then switch the summary from Sum to Count and Average and read the answer off the pivot.LessonPivot tables 2Go further with PivotTables: nest two row fields with subtotals, add a report filter, show values as a % of the grand total, update the source when new rows arrive, and know when SUMIFS is the better tool.

Frequently asked questions

How do I sort a pivot table from largest to smallest?

+

Right-click any number in the values column you want to rank by, then choose Sort > Sort Largest to Smallest. On a Mac, Control-click if you don't have a right mouse button.

Why can't I sort my pivot table?

+

Common causes are a manual order that overrides the sort, clicking a cell outside the values, or labels stored as text that sort like 1, 10, 2. Click a number in the pivot and sort again.

How do I sort a pivot table by a column that isn't the first value field?

+

Right-click a number in that column and choose Sort. Excel sorts by the column you clicked, so pick the value field you want to rank by.

Does a pivot table keep its sort when I refresh it?

+

Yes, usually. If new items appear in the wrong place, open More Sort Options, then More Options, and tick Sort automatically every time the report is updated.

Sources

  • Create a PivotTable to analyze worksheet data - Microsoft Support
  • Sort data in a range or table - Microsoft Support
  • SORT function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. The sample pivot table
  2. How to sort a pivot table by values
  3. How to sort pivot table labels A to Z
  4. How to sort a pivot table in a custom order
  5. How to sort inside groups with nested row fields
  6. How to show only the top items
  7. Why won't my pivot table sort?
  8. Practise it

Keep reading

Tests & careers· 5 min read

Pivot Table Interview Questions and Answers

Pivot table interview questions usually cover how to build one, the four areas (Filters, Columns, Rows, Values), why a field shows Count instead of Sum, how to refresh after the data changes, how to show % of grand total, how to group dates by month, calculated fields, and when SUMIFS is a better choice. Be ready to build one live.

Data tools· 5 min read

Calculated Fields in a Pivot Table

A calculated field is a new value column you create inside a pivot table from a formula, such as =Sales-Cost for profit. Click the pivot, go to PivotTable Analyze > Fields, Items & Sets > Calculated Field, type a name and formula, then click Add. It works on summed fields, so ratios work but row-level maths like Units*Price doesn't.

Data tools· 5 min read

Pivot Tables in Excel: A Beginner's Guide

A pivot table summarizes a long table in a few clicks, without formulas. Click a cell in your data, choose Insert > PivotTable, and click OK to put it on a new sheet. Then drag fields into Rows, Columns and Values: Region in Rows and Sales in Values gives total sales for each region.

More on data tools

  • How to Reference Another Sheet in Excel
  • How to Refresh a Pivot Table (and Why It Doesn't Update)
  • How to Remove Duplicates in Excel (3 Ways)
  • Make a Scatter Plot in Excel to Show a Relationship
  • Slicers in Excel: Click-to-Filter Pivot Tables
  • How to Sort Data in Excel by One or More Columns
All data tools articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free