How to Group Columns in an Excel Pivot Table – 2 Methods

The dataset contains date-wise sales data from different stores.

Create a Pivot Table and group columns into Column Labels.

How to Group Columns in Pivot Table


Method 1 – Creating a PivotTable and using the PivotChart Wizard to Group Columns in a Pivot Table

Steps:

  • Go to the source data sheet and press Alt + D + P.

  • The PivotTable and PivotChart Wizard will be displayed. Check Multiple consolidation ranges and PivotTable.
  • Click Next.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • Check I will create the page fields and click Next.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • Click the upward arrow in Range.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • Select the range for the Pivot Table.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • Click Next.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • Choose New Worksheet and click Finish.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • The Pivot Table is displayed. In the header of the Pivot Table, you will see the Column Labels drop-down icon.

  • To group data of Sales 1 and Sales 2 columns, select them first.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • Go to the PivotTable Analyze tab and select Group Selection.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • Sales 1 and Sales 2 Columns are grouped.

Apply PivotTable and PivotChart Wizard to Group Columns in Pivot Table

  • You can rename the group.

  • You can group the columns Sales 3 and Sales 4 and get the following result:

Read More: How to Make Group by Same Interval in Excel Pivot Table


Method 2 – Using the Excel Power Query Editor to Group Columns in a Pivot Table

Steps:

  • Go to the source dataset and press Ctrl + T. In the Create Table dialog box, check if the range of the table is correct, and click OK.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • The table is created.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • Go to Data > From Table/Range.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • In the Power Query Editor window, by default, the table data will be displayed with an autogenerated query.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • Select the columns as shown below.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • In the Power Query Editor window, go to Transform > Unpivot Columns > Unpivot Only Selected Columns.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • You will get the following data in the Power Query Editor.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • In the Power Query Editor window, go to Home > Close & Load > Close & Load.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • You will get the following table:

  • Select the table and go to Table Design > Summarize with PivotTable.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • In the PivotTable from table or range dialog box, enter the Table/Range and select New Worksheet.
  • Click OK.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • A blank Pivot Table will be created.

Set the row/column values for the Pivot Table:

  • Click the blank Pivot Table and go to PivotTable Fields.
  • Drag Date to Rows, Attribute to Columns, and Value to Values.

Use Excel Power Query Editor to Group Columns in Pivot Table

  • In this Pivot Table you can group columns.

  • Group columns as described in Method 1.

Read More: Pivot Table Custom Grouping


Ungroup Columns in Excel Pivot Table

Steps:

  • Click the group name.

Ungroup Columns in Excel Pivot Table

  • Go to PivotTable Analyze > Ungroup.

Ungroup Columns in Excel Pivot Table

Columns will be ungrouped.

Note:

You can group/ungroup by right-clicking.


Download Practice Workbook

Download the practice workbook.


Related Articles


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

Get FREE Advanced Excel Exercises with Solutions!
Hosne Ara
Hosne Ara

Hosne Ara is a materials and metallurgical engineer who loves exploring Excel and VBA programming. To her, programming is like a time-saving superhero for dealing with data, files, and the internet. She's skilled in Rhino3D, Maxsurf C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. With a B. Sc. in Materials and Metallurgical Engineering from Bangladesh University of Engineering and Technology, she's shifted gears and now works as a content developer. In this role, she... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo