Sub topic 9
Ungrouping and Changing a Grouping
Grouping is not permanent. You can remove it, change its settings, or rebuild it differently. This chapter covers how to do each, what each action does to the PivotTable layout, and the problems that appear when you edit a grouping.
This chapter assumes you can create a PivotTable and place fields in Rows, Columns, and Values. It also assumes you have already grouped dates, numbers, or text with the Grouping dialog, which earlier chapters cover.
What Ungroup Does
Ungroup removes the grouping from the selected field or items and returns the field to its original items. For a date field grouped by months and years, ungrouping brings back the individual dates. For a number field grouped in ranges, it brings back the individual values. For manually grouped text items, it dissolves the groups and shows the original items again.
Ungroup changes only the PivotTable. The source data stays as it was. Grouping never writes anything to your source range, so ungrouping never needs to restore anything there.
You can find Ungroup in three places:
- Right-click a grouped item or field heading and choose Ungroup.
- On the PivotTable Analyze tab, in the Group section, choose Ungroup.
- Select a cell in the grouped field and press Alt+J, T, U on Windows. On the ribbon, this is the same command as the button above.
For a mouse-based workflow, the right-click menu is usually fastest.
Where You Must Click
Where you click decides what Ungroup does. This matters most for dates and numbers, and it behaves differently for text.
| Field type | What you select | Result of Ungroup |
|---|---|---|
| Date with several units | Any group item or the field heading | All units for that date field are removed together |
| Number ranges | Any range item | The entire numeric grouping is removed |
| Manual text groups | The group name (a group item) | That one group is dissolved |
| Manual text groups | The field heading of the group field | All manual groups in that field are removed |
The key difference is that date and number grouping applies to the whole field. You cannot ungroup just the "2024" year while leaving "2025" grouped. Manual text grouping is item-based, so you can dissolve one group while keeping others.
Ungrouping Dates and Numbers
To ungroup a date or number field:
- Click any cell in the grouped field, for example a month label.
- Right-click and choose Ungroup.
- Check the Rows area of the field list. Any extra fields that Excel created for the grouping, such as Years or Quarters, are removed.
After ungrouping, the field returns to its full list of dates or values. If your data has hundreds of distinct dates, the PivotTable becomes long. That is expected. You are back to the raw granularity.
If you only want to change the units, for example from Months to Months and Quarters, you do not need to ungroup first. Use the Group command again, as described next.
Changing an Existing Grouping
You can open the Grouping dialog on a field that is already grouped and change its settings. The result replaces the previous grouping.
Changing date units
- Select a cell in the grouped date field.
- Right-click and choose Group, or use PivotTable Analyze > Group Selection.
- In the dialog, select or clear units. Selected units are highlighted.
- Click OK.
The PivotTable rebuilds with the new set of units. If you add Years to a field grouped only by Months, Excel adds a Years field and shows months nested under years. If you remove a unit, that field disappears from the layout.
Be aware of one detail. When you select several units, Excel creates a separate field for each unit except the lowest-level one, which keeps the original field name. In some layouts, a unit with the same name as the original field appears under a new name such as "Years" or "Quarters". You can see these in the field list. Treat each as a separate field that you can move or filter independently, with the caveat that they remain tied to one grouping.
Changing number ranges
For a numeric grouping, reopen the dialog and change Starting at, Ending at, or By. For example, changing By from 10 to 25 changes the buckets from 0-9, 10-19, and so on to 0-24, 25-49, and so on.
Keep these edge cases in mind:
- Excel can fill in Starting at and Ending at with the minimum and maximum of the data. If you overwrite them, values outside your range fall into labeled buckets such as
<10or>100. - Bucket labels use the form
start-end, and the end value is one less than the next start for whole numbers. With decimals, the labels show the boundary values and the bucket includes its lower bound but not its upper bound. - If you change the range and a value now falls outside it, it is not dropped from the totals. It is placed in the lower or upper overflow bucket.
You can compare the PivotTable totals before and after to confirm nothing was lost. The grand total should not change when you only change the grouping.
Changing manual text groups
For manually grouped text, the options are different, because there is no dialog with settings. You edit the groups directly:
- Add an item to a group: Select the item together with the items of the target group, then choose Group again. This creates a new group instead of extending the old one, so a safer approach is to ungroup the old group first and then group all the intended items together.
- Rename a group: Click the group name cell and type a new name, then press Enter. The new name is stored in the PivotTable.
- Move an item between groups: Drag the item under another group name, if the layout allows it. Dragging works well in Compact and Outline layouts. In Tabular layout, it is easier to regroup.
- Dissolve one group: Select the group name and choose Ungroup.
Items that are not in any manual group appear under their own names, beside the groups.
Renaming Groups and Items
Names in a grouped PivotTable are editable labels. The labels "Group1", "Group2" and so on come from Excel. The date labels such as "Qtr1" and "Jan" come from the grouping type. You can click any group-name cell and type over it.
- Renaming a manual text group is always safe.
- Renaming a date unit label, such as changing "Qtr1" to "Q1", works for the current layout but is lost if you ungroup and group again.
- If you type a name that already exists in the same field, Excel merges the two items. This is a quick way to combine items, but it also means a typo can merge items by accident.
Effects on the Layout and Formatting
Changing or removing a grouping can affect more than the labels:
- Field list: Date grouping adds fields. Ungrouping removes them. If you had placed a generated field such as Years in Columns and ungroup, that placement is gone.
- Filters and slicers: A filter on a generated field, such as a Years filter, is cleared when the field disappears. A Timeline slicer works on the original date field. It can stay in place, but you should verify that it still filters as you expect after the change.
- Sort order: Custom sort order that you set on group items is lost when the group is rebuilt.
- Subtotals and expand/collapse state: After regrouping, all items return to their default expanded state.
- Number format: Number formats on the value fields stay. Formatting applied to the row labels may not.
- Calculated fields: Calculated fields are based on value fields and are not affected by row grouping.
How the Settings Flow
The following diagram shows how the commands relate to each other for a date field.
Common Problems
Ungroup is greyed out
The command is unavailable when the selected cell is not in a grouped field. Check that you clicked a row label, not a value cell or a blank cell. If the field was never grouped, there is nothing to ungroup.
If the PivotTable is based on an OLAP (Data Model cube) source, the Group commands behave differently, and some options are not available. Grouping in a Data Model PivotTable uses the features of that model, so results can differ from the normal behavior described here.
Ungroup removes the wrong thing
If you ungroup a manual text group and the whole field returns to ungrouped, you probably selected the field heading instead of a single group item. Undo with Ctrl+Z and click the group name cell instead.
Group dialog opens with default values again
When you reopen the dialog on a number field, Excel may reset Starting at and Ending at to the data minimum and maximum. Check them before you click OK, especially if you had set custom bounds.
A unit you removed returns
If Automatic date grouping is on, adding a date field to the PivotTable can make Excel group it again. An earlier chapter shows how to turn this off. After that, ungrouping stays in effect.
Totals differ before and after
A grouped and an ungrouped table should have the same grand total. If they differ, a filter may be hiding items, or the source range changed. Refresh the PivotTable and compare again.
Worked Example
Suppose a sales table has columns Order Date, Region, Amount, and you have grouped Order Date by Years and Months.
- Right-click any month label and choose Group.
- In the dialog, select Quarters in addition to Months and Years, then click OK. The Quarters field appears between Years and Months.
- Right-click any quarter label and choose Group again. Clear Months and click OK. The PivotTable now shows Years and Quarters only.
- Right-click any year label and choose Ungroup. The field returns to individual order dates, and the Years and Quarters fields are removed from the field list.
- Compare the grand total of Amount with the total at the start. They must match.
This sequence shows that the Group command changes an existing grouping, and that Ungroup removes it entirely.
Summary of Rules
- Ungroup removes the grouping from the PivotTable only. The source data is untouched.
- Date and number grouping applies to the whole field. Text grouping applies to individual groups.
- Reopen the Grouping dialog to change units, start, end, or step. The new settings replace the old ones.
- Renaming an item to an existing name merges the items.
- Grand totals do not change when you only change grouping.
Exercise
A PivotTable has Order Date grouped by Years, Quarters, and Months. You right-click a month label and choose Ungroup. What do you see afterward, and how do you get back to Years and Quarters only?
Show answer
Ungroup removes the whole date grouping, not just the month unit. The Years and Quarters fields disappear and the field shows individual order dates. To get back to Years and Quarters only, right-click a date, choose Group, select only Years and Quarters, and click OK.
Exercise
You grouped a numeric Age field by 10, starting at 0 and ending at 100. You reopen the Grouping dialog, change By to 20, and click OK. Should the grand total of the Values field change? Why or why not?
Show answer
No. Changing the grouping only changes how items are bucketed, so every record is still counted in some bucket. A value outside the Starting at and Ending at range goes into an overflow bucket rather than being dropped. If the grand total changes, look for a filter or a source range change.