Sort a Pivot Table by Values in Excel (Rows and Columns) – LicenceHouse guide

To sort a pivot table by values in Excel, right-click any number in the value column you want to order, choose Sort, then pick Sort Largest to Smallest or Sort Smallest to Largest. Excel reorders the row items by that total. For more control, open the Row Labels arrow and choose More Sort Options.

What you want Where to click
Biggest totals at the top Right-click a value > Sort > Sort Largest to Smallest
Smallest totals at the top Right-click a value > Sort > Sort Smallest to Largest
Sort columns left to right by a row's values Right-click a value > Sort > More Sort Options > Left to Right
Sort by a specific value field Row Labels arrow > More Sort Options > Descending (Z to A) by > pick the field
Keep the order after a refresh More Sort Options > More Options > Sort automatically every time the report is updated

How do you sort values in a pivot table?

You sort values in a pivot table by right-clicking a number in the Values area and choosing a sort direction. The sort applies to every item at the same level in that column, not just the cell you clicked.

Pivot table sorted largest to smallest: North 42,150, West 27,300, East 18,400 and South 9,870 by Sum of Sales.

Here is a worked example. Say your source data lists sales by region and product, and your pivot table shows Region in Rows and Sum of Sales in Values:

Row Labels Sum of Sales
East 18,400
North 42,150
South 9,870
West 27,300
  1. Click any number in the Sum of Sales column, for example the cell showing 42,150.
  2. Right-click and point to Sort.
  3. Choose Sort Largest to Smallest.

The rows now read North, West, East, South. The Grand Total row stays at the bottom, because Excel never sorts it in with the items.

You can also use the ribbon. Select a value cell, then go to Data > Sort & Filter and click the Sort Largest to Smallest (Z-A) or Sort Smallest to Largest (A-Z) button. Inside a pivot table these buttons sort by the selected field rather than the whole sheet.

How do I sort a pivot table by values with More Sort Options?

Use More Sort Options when you want to choose exactly which value field drives the order. It is the most reliable method when your pivot table has several value columns.

  1. Click the drop-down arrow on the Row Labels header (or on the field name if you use the Tabular or Outline layout).
  2. Choose More Sort Options.
  3. Select Ascending (A to Z) by or Descending (Z to A) by.
  4. In the list underneath, pick the value field, for example Sum of Sales, instead of the row field name.
  5. Click OK.

If you pick the row field name in step 4, Excel sorts the labels alphabetically. For plain alphabetical order outside pivot tables, see our guide on how to alphabetize in Excel.

How do I sort columns in a pivot table?

To sort columns in a pivot table by their values, right-click a value in the row you want to sort by, choose Sort > More Sort Options, and pick Left to Right as the sort direction.

Five steps to sort pivot table columns by value: right-click the Grand Total row, More Sort Options, Largest to Smallest, Left to Right.

This matters when you have a field in Columns, such as months or products. For example, with Product in Columns and Region in Rows, you might want the best-selling product on the left for the Grand Total row:

  1. Right-click any number in the Grand Total row.
  2. Choose Sort > More Sort Options.
  3. Under Sort options, choose Largest to Smallest.
  4. Under Sort direction, choose Left to Right.
  5. Click OK.

The product columns now run from highest to lowest total. You can sort by any row this way, not just Grand Total. Choose a single region's row if you want that region's ranking to set the column order.

How do you sort within groups in a pivot table?

When you have two row fields, Excel sorts the inner items within each outer group. It does not break the groups apart.

Say Region is the outer field and Product is the inner field. If you right-click a product's value and sort Largest to Smallest, Excel ranks the products inside East, then inside North, and so on. The regions themselves keep their own order.

To rank the regions too, right-click a region subtotal and sort that level as well. Each field keeps its own sort setting, so you can have regions sorted by total and products sorted by total within each region.

What we commonly see: people sort, refresh the pivot table after adding new data, and find the new items sitting at the bottom out of order. That happens when AutoSort has been switched off, usually because someone dragged an item by hand. Open the Row Labels arrow, go to More Sort Options > More Options, and tick Sort automatically every time the report is updated. Dragging items manually switches the field to manual sorting, which also explains why a sort seems to stop working.

Why won't my pivot table sort by values?

A pivot table usually refuses to sort by values because the field is set to manual sort, a custom list is overriding the order, or you clicked a label instead of a number.

Table of pivot sort problems and fixes: manual sort, custom month lists, clicking a label, leading spaces and unsupported colour sorting.

  • Manual sorting is on. Choose More Sort Options and select Ascending or Descending by a value field. Manual mode ignores value sorts.
  • A custom list is in charge. Month and weekday names follow Excel's built-in custom lists by default. Right-click the pivot table, choose PivotTable Options, open the Totals & Filters tab and clear Use Custom Lists when sorting if you want months ranked by sales rather than calendar order.
  • You clicked the wrong cell. Right-clicking a row label gives you A to Z sorting. Right-click a number for value sorting.
  • Text with leading spaces. Leading spaces change sort results, so clean the source data first.
  • Colour sorting. You cannot sort a pivot table by cell colour, font colour or icon sets. Microsoft lists this among the restrictions in its guide to sorting data in a PivotTable or PivotChart.

If you need the sorted result as plain data you can edit freely, you can convert the pivot table to a normal table and sort it like any other range.

Does sorting a pivot table work the same on Mac and in every Excel version?

Yes, value sorting works in all current desktop versions, including Excel 2016, 2019, 2021, 2024 and Microsoft 365. The right-click Sort menu and More Sort Options dialog look much the same across them.

On a Mac, right-click (or Control-click) a value and choose Sort, or use the Data tab > Sort and pick from the Order list. Microsoft's Excel for Mac pivot sorting page shows the Mac wording. Sort order also follows your locale settings on both platforms.

Advanced nuance: Microsoft 365 also has the PIVOTBY function, which builds a pivot-style summary with a formula and has its own sort argument. It is not available in Excel 2024 or earlier, so a classic pivot table is still the portable choice for shared workbooks. The Excel 2024 vs Excel 365 comparison lists the other formula-only features. If your team needs a stable desktop version for pivot work, Office 2024 Professional Plus for Windows includes the full PivotTable toolset and Power Pivot.

Frequently asked questions

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

Click any number in the value column, right-click it, point to Sort and choose Sort Largest to Smallest. Excel ranks the row items by that value field and keeps the Grand Total at the bottom. If you have more than one value field, make sure you click a number in the field you want to rank by, because the sort follows the column you clicked.

Can I sort a pivot table by two value columns?

Not directly. A pivot field can only be sorted by one value field at a time. A common workaround is to add a calculated field that combines the two measures, or to sort by the main measure and use the second as a tiebreaker in the source data. You can also copy the pivot output as values and use Data > Sort with two levels.

Why does my pivot table sort reset when I refresh?

The sort resets when AutoSort is off or when a custom list order applies. Open the Row Labels arrow, choose More Sort Options, then More Options, and tick Sort automatically every time the report is updated. Microsoft notes that a custom list sort order is not kept after a refresh, so value sorting is more stable for reports you refresh often.

How do I sort months in a pivot table by sales instead of date order?

Excel applies its built-in month custom list, which keeps January to December in order. Right-click the pivot table, choose PivotTable Options, open the Totals & Filters tab and clear Use Custom Lists when sorting. Then sort by your value field as normal. The months now rank by sales. Tick the box again if you want calendar order back.

Can I drag pivot table rows into my own order?

Yes. Select a row label, then point at its border until the cursor shows a four-way arrow and drag it to a new position. You can also type a label name over another label's cell to swap them. Doing either switches that field to manual sorting, so value sorts and AutoSort stop applying until you choose Ascending or Descending again.

Related guides

Links in this guide

Link Type Why it helps
Microsoft Support: Sort data in a PivotTable or PivotChart External Official sort options and restrictions for Windows
Microsoft Support: Sort data in a PivotTable in Excel for Mac External Mac menu wording for the same task
How to alphabetize in Excel Internal A to Z sorting for normal ranges
Convert a pivot table to a normal table Internal Turns a sorted summary into editable data
Excel 2024 vs Excel 365 Internal Explains which formula features, such as PIVOTBY, are 365 only
Office 2024 Professional Plus for Windows Internal Desktop Excel with the full PivotTable toolset
Excel tutorial for beginners Internal Background on ranges, tables and the ribbon
INDEX MATCH with multiple criteria Internal Look up values from a sorted summary
Data analysis, Excel, How-to, Pivot tables