Group Pivot Table by Numbers: Step-by-Step
In this article
Grouping a pivot table by numbers lets you combine similar values into ranges, such as age brackets, price bands, or sales tiers, without manually editing your source data. This makes your summaries cleaner and easier to analyze. You only need the pivot table already created and the numeric field you want to group.
What You'll Need
- A pivot table already inserted in Excel or Google Sheets (the steps below cover both).
- A numeric field (e.g., Age, Sales, Quantity) in the pivot table's Rows or Columns area.
- For Excel: a Windows or Mac version with the PivotTable tools ribbon (Excel 2013 or later).
- For Google Sheets: a free Google account and the sheet open in a browser.
Step-by-Step
- Select the numeric values – In your pivot table, click on any cell that contains a number from the field you want to group. For example, if you have a "Sales" field in the Rows area, click on any sales amount.
- Right-click to open the context menu – Right-click on the selected cell. In Excel, a menu appears with an option called "Group..." (or "Group" depending on your version). In Google Sheets, the menu shows "Create pivot group rule".
- Choose the grouping option:
- Excel: Click "Group..." (or "Group" in the menu). A dialog box appears with fields for "Starting at", "Ending at", and "By".
- Google Sheets: Click "Create pivot group rule". A panel appears on the right with options like "Min", "Max", and "Group size".
- Set the range for grouping – In the dialog/panel, you'll see the starting and ending values. Excel automatically fills these with the lowest and highest numbers from your data. You can adjust them, but it's usually best to leave them as is unless you want to exclude outliers. In Google Sheets, these are labeled "Min" and "Max".
- Define the group size (interval) – This is the key step. Enter the interval that determines the range of each group. For example:
- If you enter 10, groups will be 0-9, 10-19, 20-29, etc.
- If you enter 100, groups will be 0-99, 100-199, etc.
- If you enter 5, groups will be 0-4, 5-9, etc.
- Apply the grouping – Click OK in Excel, or click "Add" in Google Sheets. Your pivot table will now show the numbers grouped into the ranges you specified.
- Rename the groups (optional but recommended) – After grouping, Excel automatically names each group with the range, like "0-9" or "100-199". You can click on a group name and type a more descriptive label, such as "Low" or "High". In Google Sheets, you can edit the group name directly in the cell.
- Adjust if needed – If the grouping doesn't look right, right-click on the group again and select "Group..." (Excel) or "Edit pivot group rule" (Google Sheets) to change the interval or range.
Common Mistakes
- Selecting the wrong field – Make sure you click on a numeric value, not a text label or the field header. If you click on a text field, the grouping option will be grayed out.
- Grouping a field that's already grouped – If you try to group a field that has already been grouped, Excel may give an error. You need to ungroup first (right-click > Ungroup) before creating a new grouping.
- Using a text-formatted number – If your numbers are stored as text (e.g., with a currency symbol or comma), the grouping option might not work. Convert them to actual numbers first.
- Setting the interval too large or too small – If the interval is too small, you'll have many groups and lose the benefit of grouping. If too large, you'll lose detail. Choose an interval that makes sense for your data.
- Grouping only part of the data – If you select only a few cells instead of one, Excel might group only those selected values, creating a partial group. Always select a single cell.
Tips
- Use the "By" field to set the interval – In Excel, the "By" field is where you enter the interval. It's easy to miss, but it's the most important part.
- Group by dates too – The same method works for dates. Right-click on a date and choose "Group..." to group by days, months, quarters, or years.
- Create multiple groups manually – If you need custom ranges (e.g., 0-50, 51-100, 101-500), you can manually select multiple items in the pivot table, right-click, and choose "Group" to create a custom group. Repeat for each range.
- Refresh after changing source data – If you add new numbers to your source data, refresh the pivot table (right-click > Refresh) to update the groups. New values outside the existing range will be added to a new group automatically.
- Ungroup to revert – If you want to go back to individual numbers, right-click on any group and choose "Ungroup" (Excel) or "Delete group rule" (Google Sheets).
Troubleshooting
- Grouping option is grayed out – This usually means the selected cell is not a numeric value. Check that the field is actually numeric (not text) and that you've selected a data cell, not the field header or a subtotal.
- Error "Cannot group that selection" – This happens in Excel when the field contains text or blank cells. Make sure all values in the source column are numbers, and there are no empty cells. If there are blanks, fill them with 0 or remove them.
- Groups don't update when source data changes – Pivot tables don't auto-refresh. Right-click anywhere in the pivot table and choose "Refresh" to update the groups.
- Groups appear in the wrong order – If your groups are sorted alphabetically (e.g., "0-9", "100-199", "10-19"), you can fix this by selecting the group field and sorting it manually. In Excel, use the "Sort" options in the PivotTable Tools menu. In Google Sheets, you can drag the group rows into the correct order.
- Google Sheets doesn't show the "Create pivot group rule" option – Make sure you're right-clicking on a numeric value in the pivot table, not on a summary cell or a blank area. Also, ensure the field is in the Rows or Columns area, not just in Values.
Frequently Asked Questions
Can I group by numbers in Google Sheets pivot tables?
Yes, right-click on a numeric value in the pivot table and select "Create pivot group rule". Set the Min, Max, and Group size, then click Add.
How do I change the group interval after creating it?
Right-click on any group and choose "Group..." (Excel) or "Edit pivot group rule" (Google Sheets). Change the "By" or "Group size" value and apply.
Can I group by numbers that are in the Values area?
No, grouping works only on fields placed in the Rows or Columns area. If your numeric field is in the Values area (e.g., Sum of Sales), you'll need to move it to Rows or Columns first.
What if my numbers have decimals?
Grouping works with decimals, but the intervals will be based on the values as they are. For example, with an interval of 10, 1.5 will fall into the 0-10 group. You can round the numbers in your source data if you need cleaner groups.
Can I group by numbers in a pivot table created from an external data source?
Yes, grouping works the same way regardless of the data source, as long as the field is numeric and the pivot table is not using a data model with certain limitations (like OLAP). In Excel, if you're using Power Pivot, grouping may not be available; you may need to create a calculated field instead.
Why did my groups disappear after refreshing?
This can happen if the source data range changed and the pivot table lost the field. Check that the source range includes the new data, then refresh. If the field is still there, re-apply the grouping.