Pivot Table Custom Grouping: With 3 Criteria

We will use the following dataset to explain Custom Grouping in a Pivot Table.

Data set of Pivot Table Custom Grouping


What Is the Pivot Table in Excel?

A pivot table is one of the statistical tools of Microsoft Excel. It works with a large amount of data and can represent and summarize data in various ways.

In the Pivot table, we can rotate the data in the table to view from a different perspective. You don’t have to apply any further formula or other shortcuts to change the orientation of the data you want to show.


What Does Pivot Table Grouping Mean?

Grouping means organizing some data based on the same criteria such as all numerical data or text data. The Pivot table also has a grouping option. In the Pivot table, we can group data according to our needs. There is no restriction in grouping data in Excel.


How to Create a Pivot Table and Apply Grouping

Steps:

  • Go to the Insert tab.
  • Choose From Table/Range from the Pivot Table tool.

Create a Pivot Table and Apply Grouping

  • Put the range that you want to convert in the Pivot table on the Table/Range box.
  • Put the cell reference of the worksheet on the Location box.

Create a Pivot Table and Apply Grouping

  • Press OK.

We get the PivotTable Field options. We will customize the Pivot table.

  • Select Sales Person and Bill from the field.

We get the table of bills in terms of each salesperson.

  • We can also change the data presentation. Select Customer Name instead of the Sales Person and see the changes on the below image.

Create a Pivot Table and Apply Grouping

  • Select three names that start with “J”, those will be in a group.
  • Go to the PivotTable Analyze tab.
  • Select the Group Selection option.

Create a Pivot Table and Apply Grouping

We can see that those cells formed a group named Group1.

We can also apply this grouping in another way.

  • Select the cells.
  • Right-click on the selection.
  • Select the Group option.

Create a Pivot Table and Apply Grouping

Another group is created named Group2.

Create a Pivot Table and Apply Grouping


Undo Grouping from a Pivot Table

Method 1:

  • Select any of the groups. We selected Group1.
  • Right-click on it.
  • Choose Ungroup from the menu.

Undo Grouping From Pivot Table:

Group1 is removed.

Method 2:

  • Select Group2.
  • Go to the PivotTable Analyze tab.
  • Choose the Ungroup option.

Undo Grouping From Pivot Table:

Group 2 is not showing anymore.


Pivot Table for Custom Grouping: 3 Types of Objects

Example 1 – Grouping Dates in a Pivot Table

This grouping is done automatically. We will apply grouping on the below data set, which is formed by data and bill segments.

Grouping Dates in Pivot Table


Case 1.1 – Group Dates Based on Years in a Pivot Table

Steps:

  • Select any of the cells on the Pivot table.
  • Right-click and choose Group from the menu.

  • A dialog box will appear. Tick the boxes of Starting at and Ending at.
  • Choose Years.

Group Dates based on Years in Pivot Table

  • Press OK and see the return.

Group Dates based on Years in Pivot Table

The Sum of Bill is shown in terms of years only.


Case 1.2 – Group Dates Based on Quarters in a Pivot Table

Steps:

  • Select any of the cells on the Pivot table.
  • Right-click and choose Group from the menu.

  • A dialog box will appear. Tick the boxes of Starting at and Ending at.
  • Choose Quarters.

Group Dates based on Quarters in Pivot Table

  • Press OK and see the return.

The Sum of Bill is shown in terms of quarters only. However, we cannot identify the quarters with corresponding years.

  • Select both the Quarters and Years from the box.

Group Dates based on Quarters in Pivot Table

  • Press OK to see what happens.

Group Dates based on Quarters in Pivot Table


Case 1.3 – Group Dates Based on Months in a Pivot Table

Steps:

  • Select any of the cells on the Pivot table.
  • Right-click and choose Group from the menu.

  • A dialog box will appear. Tick the boxes of Starting at and Ending at.
  • Choose Months.

Group Dates based on Months in Pivot Table

  • Press OK and see the return.

The Sum of Bill is shown in terms of months only.

We can specify the bill of a specific month with a specific year.

  • Select both the Months and Years from the box.

Group Dates based on Months in Pivot Table

  • Press OK to see the return.

Group Dates based on Months in Pivot Table


Case 1.4 – Group Dates Based on the Day in a Pivot Table

Steps:

  • Select any of the cells on the Pivot table.
  • Right-click and choose Group from the menu.

  • A dialog box will appear. Tick the boxes of Starting at and Ending at.
  • Choose Days.
  • On the Number of days box, put 7.

Group Dates based on Day in Pivot Table

  • Press OK and see the return.

Group Dates based on Day in Pivot Table

We set the number of days 7 as we want to get the sum for each week. We can also modify this day value and put whatever interval need.


Example 2 – Group Text Items in a Pivot Table

We will show the grouping of text items in the Pivot Table.

Group Text Items in Pivot Table


Part 2.1 – Create a Text-based Group in a Pivot Table

  • Select Chicago and New York, as both form a group.
  • Right-click and choose Group from the menu.

Create Text-based Group in Pivot Table

A new group is constructed named Group1.

  • Create Group 2 that consists of Dallas and Los Angeles.

Create Text-based Group in Pivot Table


Part 2.2 – Rename a Group in a Pivot Table

Steps:

  • Select any of the groups. We select Group1.
  • Press F2.
  • Put a new name Old_Store.

  • Press Enter and see what happens.

Rename Group in Pivot Table

  • Rename Group2 as New_Store.


Part 2.3 – Change the Cell Format in a Pivot Table

Steps:

  • Select any of the cells from the value field.
  • Right-click and choose Value Field Settings.

Change Cell Format in Pivot Table

  • Select Number Format.

Change Cell Format in Pivot Table

You’ll get the Format Cells dialog.

  • Change the cell format.

Part 2.4 – Some Additional Features of Grouping in a Pivot Table

In this section, we will discuss some additional features of Grouping in the Pivot table.

  • Go to the Value Field Settings as shown earlier.

  • From the Summarize value field by box, choose other operations like Max.

Additional features of Grouping In Pivot Table

  • Press OK and see what occurs.

We can also present the value in terms of percentage.

  • Select Show Values As from the Value Field Settings.

Additional features of Grouping In Pivot Table

  • Press OK.

The sum of the bill is represented in percentage.

We can also represent a value in terms of multiple variables.

Additional features of Grouping In Pivot Table

In the first step, values are shown according to the Store, then based on years.

We can also get the details of any specific cell.

  • Right-click and select Show Details from the menu.

Additional features of Grouping In Pivot Table

We can see the details of that cell.

Read more: How to Group Columns in Excel Pivot Table


Example 3 – Group Numeric Values in Excel

Steps:

  • We have a Pivot in terms of bills and customer numbers.

  • Select any of the cells of the bills.
  • Right-click and select Group from the menu.

  • A dialog box will appear. Put the customized values in the boxes.

Group Numeric Values in Excel

  • Press OK.

Group Numeric Values in Excel

The number of customers is shown in terms of bill amounts.

Read More: How to Group Numbers in Excel Pivot Table


How to Turn Off Auto-Grouping of Dates in an Excel Pivot Table

This option is available from Excel 2016 to later versions.

Steps:

  • Select File from the main tab.

  • Go to Options.

  • Go to the Data tab.
  • Check Disable automatic grouping of Date/Time columns in the PivotTables. This option will turn off the auto grouping of date and time.

Turn Off Auto Grouping of Date in Excel Pivot Table

Note:

This setting change will affect all your Excel workbook files.

Read more: [Fixed] Excel Pivot Table: Cannot Group That Selection


Things to Remember

  • You can also group based on hours, minutes, seconds if the data set contains time arguments.
  • When creating a Pivot table, be careful about the different PivotTable fields.

Download the Practice Workbook


Further Readings


<< Go Back to Group Pivot Table | Pivot Table in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Alok Paul
Alok Paul

Alok Paul has completed his B.Sc. in Electronics and Telecommunication Engineering from East West University. He has been working on the ExcelDemy project for more than 2 years. He has written 220+ articles and replied to numerous comments. He is experienced in Microsoft Office, especially in Excel. He also led some teams on Excel and VBA content development. He has a keen interest in Advanced Excel, Data analysis, Excel Pivot Table, Charts, and Dashboard. He loves to research... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo