To sort a pivot table in Google Sheets, click on the row or column label you want to sort by, then click Data > Sort sheet by column (or use the filter icon in the pivot table editor). For more control, open the Pivot table editor, go to the Rows or Columns section, and use the “Order” dropdown to choose ascending or descending, or sort by a value field like Sum of Sales.
What Is a Pivot Table and Why Sorting Matters
A pivot table is a data summarization tool in Google Sheets that lets you group, count, total, or average data from a larger dataset. For example, you can take a list of sales transactions and quickly see total sales per product category. Sorting that pivot table is essential to see highest-to-lowest values at a glance, find top performers, or identify trends. Without sorting, the rows appear in the order they were first created, which is often alphabetical or by the order of appearance in the source data—not necessarily the most useful order.
Basic Sorting: Using the Pivot Table Editor
When you create a pivot table in Google Sheets, the Pivot table editor appears on the right side of the screen. Here’s how to sort a row or column field:
- Select any cell in the pivot table to open the editor.
- Under Rows or Columns, find the field you want to sort (e.g., “Category”).
- Click the field name to expand its options.
- In the Order dropdown, choose Ascending (A→Z or 0→9) or Descending (Z→A or 9→0).
- If you want to sort by a value field (like total sales), change the Sort by dropdown to that value field (e.g., “Sum of Sales”).
For example, if your pivot table shows sales by region, and you want the region with the highest total sales first, set Sort by to “Sum of Sales” and Order to Descending. The rows will reorder instantly.
Sorting by Values (Not Just Labels)
Often you want to sort by the numbers in the pivot table, not alphabetically by the row label. In the Pivot table editor, under Rows or Columns, you’ll see a “Sort by” option. By default it says “Source data” or the field name, but you can change it to any value field that appears in the Values section. For instance, if you have a pivot table with products in rows and “Sum of Revenue” in values, you can sort the products by revenue descending to see your best sellers first.
This is a common point of confusion: many users try to sort by clicking the header of the value column, but that only works if you manually sort the pivot table’s output range, which can break the pivot table’s grouping. The correct method is always through the editor.
Using the Filter Icon in the Pivot Table
In the actual pivot table grid, each row label cell has a small filter icon (a funnel) when you hover over it. Clicking that icon gives you a quick menu with sort options: Sort A→Z, Sort Z→A, and for numeric values, Sort smallest to largest or largest to smallest. This is a faster way to sort if you don’t want to open the editor. However, this method sorts only by the label, not by a value field, unless you choose “Sort by value” from that same menu—which is available if you click the filter icon on a row label and then select “Sort by” and choose a value field.
Sorting by Multiple Fields (Secondary Sort)
If you have multiple fields in the Rows section (e.g., Region then Product), you can sort by each level independently. The first field sorts the top-level groups, and the second field sorts within each group. To set this up, expand each field in the editor and set its own Order and Sort by. For example, you could sort Region alphabetically, and within each region, sort products by total sales descending. This gives you a hierarchical sort that is often more useful than a single-level sort.
Common Problems and Fixes
Here are typical issues users run into when sorting pivot tables in Google Sheets:
- Sorting doesn’t stick: If you manually drag rows or sort the output range, the pivot table may revert when data refreshes. Always use the editor’s Order settings.
- Sort by value not available: If you don’t see a value field in the “Sort by” dropdown, make sure you have at least one field in the Values section. If not, add one (e.g., Sum of Quantity).
- Alphabetical order is wrong: If you have numbers stored as text, sorting may appear off. Check that your source data is formatted as numbers (Format > Number > Number).
- Pivot table is in a separate sheet: Sorting works the same regardless of where the pivot table is placed, but you must have the pivot table selected to see the editor.
Sorting vs. Filtering: When to Use Each
Sorting reorders the rows or columns, while filtering hides rows that don’t meet a condition. In a pivot table, you can also add a filter in the editor (e.g., show only regions with sales over $10,000). Sorting and filtering work together: you can filter to a subset of data and then sort that subset by a value. For example, filter to only “Electronics” category, then sort by profit descending. This is a powerful way to analyze data without altering the source sheet.
Alternative: Using SORT() Function
If you prefer a formula-based approach, you can use the SORT function in Google Sheets to create a sorted list from your pivot table output, but that is not a pivot table itself. For a true pivot table, the editor is the only built-in way to sort. However, you can also create a calculated field or use the QUERY function to mimic pivot table sorting. For most users, the editor is sufficient.
Frequently Asked Questions
How do I sort a pivot table by a specific column in Google Sheets?
Open the Pivot table editor, go to Rows or Columns, click the field you want to sort, and in the “Sort by” dropdown select the value field (e.g., Sum of Sales) and set Order to Ascending or Descending.
Why can’t I sort my pivot table by values?
Make sure you have a field in the Values section. If you only have row labels and no values, there is nothing to sort by. Add a value field like Count of ID or Sum of Amount.
Can I sort a pivot table alphabetically in Google Sheets?
Yes, click the filter icon on the row label and choose Sort A→Z, or in the editor set Order to Ascending. This sorts by the label text.
How do I sort a pivot table in descending order of total?
In the editor, under Rows, select the row field, then set Sort by to the value field that contains the total (e.g., Sum of Total), and Order to Descending.
Does sorting a pivot table affect the original data?
No, sorting only changes the arrangement of the pivot table output. The source data remains untouched.
Can I sort by multiple columns in a pivot table?
Yes, by adding multiple fields under Rows and setting sort options for each. The first field sorts the outer level, the second sorts within that, and so on.
Related
- Shortcut to Close All Tabs? Quick Keys & Steps
- Software for Client Data Entry: Top Options
- Enum with String Value in C++: How to Map
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Extend a Trendline to the Y-Axis in ExcelTo extend a trendline to the y-axis in Excel, select the trendline, open Format Trendline, and increase Forecast…
- How to Insert an Excel Chart Into PowerPoint EasilyTo insert an Excel chart into PowerPoint, select the chart’s outer border in Excel and press Ctrl+C, then…
- Excel Bar Graph Conditional Formatting: Color by RulesExcel does not apply worksheet conditional formatting rules directly to the bars in a chart. To make bar…
- Balloon Chart in Excel: A Step-by-Step TutorialTo make a balloon chart in Excel for Microsoft 365 on Windows, arrange your data in columns for…
- Excel Trendline Values: Show and Calculate ThemYes. In Excel for Microsoft 365 on Windows, select the chart, choose Chart Design > Add Chart Element…
- Excel Histogram Bin Range: Meaning and How to Set ItIn Excel’s Data Analysis Histogram tool, the bin range is a worksheet range containing the upper limits of…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.