Pivot tables have a built-in feature to allow manual grouping. In the example shown, a pivot table is used to group colors into two groups: Original and New. Notice these groups do not appear anywhere in the source data.
Fields
The source data contains three fields: Date, Sales, and Color. A fourth field, Group is created by the grouping process:
Before grouping, the original pivot table looks like this:
Manual grouping is done by selecting the cells that make up a group. The control key must be held down to allow non-contiguous selections.
With cells selected, right-click and select Group from the menu:
Repeat the process with the second group of items, Gold and Silver. The final two groups are named "Original" and "New".
Excel will name the grouping field "Color2". In the example, this field has been renamed "Group":
In addition, the grouping field is configured to insert a blank like after each new group:
Helper column alternative
As an alternative to manual grouping, you can add a helper column to the source data, and use a formula to assign groups. Once you have the grouping labels in the helper column, add the field directly to the pivot table as a row or column field .
Steps
- Create a pivot table
- Drag the Color field to the Rows area
- Drag the Sales field to the Values area
- Group items manually
- Select items
- Right-click and Group
- Name group as desired
- Repeat for each separate group
- Rename grouping field (Color2) to Group (or as desired)