How to Group time with the Same Interval in an Excel Pivot Table – 2 Methods

This is the sample dataset.


Method 1 – Group by Time Intervals in Excel Pivot Tables

1.1 Group by Hour

Steps:

  • Select data in your dataset.
  • Click Insert > Pivot Table.

 

Group by Time in Excel Pivot Tables

The Pivot table will automatically select the data range.

  • Select the worksheet- New Worksheet/ Existing Worksheet.
  • Click OK.

Group by Time in Excel Pivot Tables

  • In Pivot Table fields, drag Time to Rows and Sales to Values.

Group by Time in Excel Pivot Tables

This is the output.

Group by Time in Excel Pivot Tables

  • Select any cell containing time.
  • Right-click and select Group.

Group by Time in Excel Pivot Tables

Start time and End time are automatically selected.

  • Select Hours.
  • Click OK.

Group by Time in Excel Pivot Tables

Sales are grouped by hours.

Group by Time in Excel Pivot Tables

You can change the format of the Sum of values:

  • Click the drop-down arrow in Sum of values.

Group by Time in Excel Pivot Tables

  • Select Number Format.

  • In Format Cells, click Currency in Category.
  • Select the first option in Negative numbers.
  • Click OK.

  • Click OK.

The selected format is applied:


1.2 Group by Custom Time Intervals

A new column was added: Floor.

Steps:

  • Enter the following formula in F5.
=FLOOR(E5,"00:15")
  • Press Enter.

  • Drag down the Fill Handle to copy the formula.

Rounded time is displayed.

Make Group by Time in Excel Pivot Tables

 

  • Select data in the dataset.
  • Click Insert > Pivot Table.

 

Make Group by Time in Excel Pivot Tables

  • Select the worksheet and click OK.

Make Group by Time in Excel Pivot Tables

  • In PivotTable Fields, drag Floor to Rows and Sales to Values.

This is the output.

 

Read more: Pivot Table Custom Grouping


Method 2 – Group by Ranges in an Excel Pivot Table

Steps:

  • Create Pivot Table by selecting any cell and clicking Insert > Pivot Table.

Create Group by Range in an Excel Pivot Table

  • Choose New worksheet and click OK.

Create Group by Range in an Excel Pivot Table

  • Drag Month to Rows, Sales to Columns, and Time to Values.

Create Group by Range in an Excel Pivot Table

The Pivot Table is displayed:

Create Group by Range in an Excel Pivot Table

  • Click sales data.
  • Right-click and select Group.

You can also click: PivotTable Analyze > Group Selection.

  • In Grouping, choose the Starting at and Ending at values and enter the interval in By.
  • Click OK.

 

Read more: How to Group Columns in Excel Pivot Table


How to Ungroup a Pivot table?

Steps:

  • Select grouped data.
  • Right-click.
  • Click Ungroup.

Ungroup in Pivot table

You can also click: PivotTable Analyze > Ungroup.

Ungroup in Pivot table

The Pivot Table is ungrouped.


Error and Solution

You may get the ‘Cannot group that selection’ error while grouping by the same interval.

Cells may contain text instead of numbers. Convert text to numbers before grouping.


 

Download Practice Workbook

Download the free Excel template.


Further Readings


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

Get FREE Advanced Excel Exercises with Solutions!
Md. Sourov Hossain Mithun
Md. Sourov Hossain Mithun

Md. Sourov Hossain Mithun, an Excel and VBA Content Developer at Softeko's ExcelDemy project, joined in October 2021. Holding a Naval Architecture & Marine Engineering degree from BUET, Mithun showcases expertise during his two-year tenure. With over 200 published articles on Excel topics, he earned a promotion to Team Leader, excelling in leading diverse teams. Mithun's passion extends to Advanced Excel, Excel VBA, Data Analysis, and Python programming, contributing significantly to the innovative and dynamic environment of ExcelDemy... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo