Templates, guides & honest tool reviews for small business

Sunday, November 29, 2026

Group Dates in an Excel Pivot Table: Months, Years, Quarters and Weeks

Group dates in an Excel pivot table by month and year
Illustration: Group dates in an Excel pivot table

To group dates in an Excel pivot table, right-click any date in the pivot table, choose Group and pick months, quarters or years. This turns a long list of daily rows into a short monthly or yearly summary. This guide shows the steps with made-up sales data, how to group by several levels at once, how to group by a custom number of days and how to fix the "cannot group that selection" error.

What you need first

Your source data needs a column of real dates, with a header and no blank cells in that column. Say the table has Date, Region and Sales. Build a pivot table with Date in the rows and Sales in the values. If you need the basics first, see our Excel pivot table tutorial.

Group dates by month

  1. Right-click any date in the Row Labels column of the pivot table.
  2. Click Group.
  3. In the Grouping box, select Months.
  4. Click OK.

The daily rows collapse into one row per month with the total sales.

Excel pivot table: right-click a date and choose Group by Months
Made-up daily sales (illustration).

Group by years and months together

In the same Grouping box you can select more than one level. Click Years and Months so both are highlighted. The pivot table then shows each year with its months below it. This is useful when your data covers more than a year, because January of two different years will not be mixed together.

Excel pivot table grouped by years and months together
Select both levels (illustration).

Group by quarters

Select Quarters, and add Years if the data spans several years. Excel labels the groups as Qtr1, Qtr2 and so on.

Group by a number of days

To group by weeks, select Days only in the Grouping box. A Number of days box becomes available. Enter 7 to get seven-day groups. The first group starts on the date in the Starting at box, so set it to the Monday of your first week if you want weeks to start on Monday. Check the date first, because the groups follow that start date and not the calendar.

Excel pivot table grouped by 7 days to make weeks
Set the start date first (illustration).

Set the start and end dates

The Grouping box has Starting at and Ending at fields. Change them if you want to limit the range, for example to one financial year.

Move the grouped field

After you group by months and years, Excel adds fields called Years or Months to the field list. You can drag them to the columns or the filters area just like other fields.

Ungroup dates

Right-click a grouped date and choose Ungroup. The pivot table returns to the daily rows.

Fix "Cannot group that selection"

This error means Excel cannot find valid dates in the field. The usual reasons are:

  • Text dates. A date that is left aligned in the source is probably text. Convert it with DATEVALUE or the Text to Columns tool.
  • Blank cells. Fill or delete empty cells in the date column of the source.
  • Mixed content. A word such as "TBD" in the date column blocks the grouping.

After you fix the source, refresh the pivot table with right-click and Refresh. The formulas that return the number of days between dates are covered in calculating days between two dates in Excel.

Fix for Excel pivot table error Cannot group that selection
Check for text dates and blanks (illustration).

Group dates with a helper column instead

If you prefer not to use the Group tool, add a helper column to your data with a formula such as =TEXT(A2, "yyyy-mm"), then use that column in the pivot table. It also works in older workbooks and in Google Sheets. For the Google Sheets version of a pivot table, read how to create a pivot table in Google Sheets.

Questions and answers

Why did Excel group my dates automatically?

Newer versions of Excel can group date fields automatically when you add them to a pivot table. You can ungroup them from the right-click menu.

Can I group numbers too?

Yes. Right-click a number and choose Group, then enter a starting value, an ending value and a step size, such as groups of 10.

Can I group text items?

Yes. Select several items, right-click and choose Group. This creates a custom group you can rename.

Does grouping change my source data?

No. It only changes the pivot table.

Summary

Right-click a date, choose Group, and select months, quarters, years or a number of days. If grouping fails, check the source for text dates and blank cells.

العربية