Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Sort a Pivot Table by Value

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Sorting a pivot table by value is one of the quickest ways to turn a flat grid of numbers into a clear ranking – for example, showing your top-selling products first or your busiest months at the top. Instead of scanning rows manually, you can reorder the entire table in a couple of clicks. This guide covers the steps for Microsoft Excel and Google Sheets, the two most common tools for pivot tables, plus what to do when the sort doesn’t behave as expected.

What You'll Need

  • A pivot table already created from your data (if you haven’t made one yet, select your data range and insert a pivot table first).
  • At least one value field in the pivot table (such as Sum of Sales, Count of Orders, or Average Price).
  • Access to the pivot table’s field list or context menu – this is built into Excel and Google Sheets, so no extra software is needed.

Step-by-Step

  1. Click anywhere inside the pivot table – this activates the PivotTable tools and makes the sort options available.
  2. Find the value field you want to sort by – it’s usually in the “Values” area of the field list, like “Sum of Sales” or “Count of Orders”.
  3. Right-click on a number in that value column (not on a row label). A context menu appears.
  4. Choose “Sort” from the menu, then select either “Sort Largest to Smallest” (descending) or “Sort Smallest to Largest” (ascending). In Excel, this is under “Sort” > “Largest to Smallest” or “Smallest to Largest”. In Google Sheets, the option is “Sort sheet by column” or “Sort range by column” – but for a pivot table, you’ll see “Sort by” options directly in the menu.
  5. If you prefer using the ribbon or toolbar: In Excel, go to the “Data” tab and click the “Sort” button (with A→Z or Z→A icons) – but note that this only works if you’ve selected a cell in the value area. In Google Sheets, click the “Sort” button in the toolbar and choose the column.
  6. For more control (Excel only): Click the drop-down arrow on the row label header (like “Product” or “Month”), then choose “More Sort Options”. In the dialog, select “Descending (Z to A) by” or “Ascending (A to Z) by” and pick the value field from the list. This lets you sort by a specific value field when you have multiple.
  7. Check the result – the rows should now be reordered based on the numeric values. If you have multiple row levels (like Category then Product), the sort applies to the selected level only.

That’s it – the pivot table now shows your data ranked by value. The sort stays linked to the pivot table, so if you refresh or change the data, the order updates accordingly.

Common Mistakes

  • Sorting by row label instead of value – Clicking the drop-down on a row label and choosing “Sort A to Z” sorts alphabetically, not by the numbers. Always right-click on a value cell or use “More Sort Options” to sort by the actual value field.
  • Sorting the wrong column – If you have multiple value fields (e.g., Sum of Sales and Sum of Profit), make sure you right-click on the correct column before sorting.
  • Sorting a filtered pivot table – If you have a filter active (like showing only certain months), the sort only applies to the visible rows. Double-check that your filter isn’t hiding data that would affect the order.
  • Using the regular sheet sort on a pivot table – In Excel, using the “Sort” button on the Home tab may sort the underlying data, not the pivot table, which can break the pivot’s layout. Always use the pivot-specific sort options.

Tips

  • Sort by a computed field – If you want to sort by a calculated value like “Profit Margin” (Profit / Sales), add it as a value field first, then sort by that column.
  • Use the field list to reorder values – Dragging a value field to the top of the “Values” area often changes the default sort order, but it’s not a substitute for an explicit sort.
  • Keyboard shortcut (Excel) – After right-clicking a value cell, you can press “S” then “L” for largest to smallest, or “S” then “S” for smallest to largest.
  • Sorting by a subtotal – If your pivot has grouped data, you can sort by the subtotal column by right-clicking on a subtotal value and choosing sort.
  • Remember the refresh – After changing the source data, refresh the pivot table (right-click > Refresh) to ensure the sort reflects the latest numbers.

Troubleshooting

Sort option is grayed out – This usually happens when you’ve selected a cell in the row label area, not the value area. Click on a number in the values column first, then try again. In Excel, also check that the pivot table isn’t in “Compact” layout with merged cells – switching to “Tabular” layout can help.

Sort doesn’t stick after refreshing – If you refresh the pivot table and the order resets, you may have sorted the underlying data instead of the pivot. Re-apply the sort using the pivot-specific method (right-click > Sort). If it still resets, create the pivot table again and apply the sort immediately.

Sorting by value doesn’t affect the row order – This happens when you have multiple row fields and you’re sorting the wrong level. For example, if you have “Category” and “Product”, sorting by value will only reorder within the selected level. Click on a cell in the level you want to sort (e.g., a product name) and then sort.

Numbers are sorting as text – If your values are stored as text (e.g., “$1,000” as a string), the sort will be alphabetical. Convert the source data to numeric values (remove currency symbols or use the “Text to Columns” wizard) and refresh the pivot.

Google Sheets: “Sort by” menu is missing – In Google Sheets, the sort options for pivot tables are under the “Sort by” dropdown in the pivot table editor panel (right side). Look for the “Rows” section and click “Sort by” to choose the value field.

Frequently Asked Questions

Can I sort a pivot table by value in Google Sheets? – Yes. Click on the pivot table, open the “Pivot table editor” on the right, go to the “Rows” section, and under “Sort by” select the value field you want to sort by. Choose “Descending” or “Ascending”.

How do I sort by a specific value field when I have multiple? – In Excel, right-click on a cell in the value column you want to sort by, then choose “Sort” > “More Sort Options”. In the dialog, select “Descending by” or “Ascending by” and pick the field from the dropdown. In Google Sheets, use the “Sort by” dropdown in the pivot editor and select the field.

Why does my pivot table sort alphabetically instead of numerically? – This usually means you’re sorting by the row label, not the value. Make sure you right-click on a number in the values column, or explicitly choose the value field in the sort options.

Can I sort by a calculated field like percentage of total? – Yes. Add the calculated field as a value (e.g., “% of Grand Total”), then sort by that column just like any other value.

Does sorting a pivot table affect the original data? – No. Sorting a pivot table only changes the display order of the pivot table itself. The underlying source data remains untouched.

How do I sort in descending order by default for new pivot tables? – There’s no built-in default, but you can create a macro (Excel) or use a script (Google Sheets) to apply the sort automatically after refreshing. For most users, it’s easier to just re-apply the sort after creating the pivot.