Sub topic 3
Grouping dates by months, quarters, and years
This chapter shows how to group a date field into months, quarters, and years with the Grouping dialog. It assumes you can build a PivotTable with fields in Rows, Columns, and Values, and that you can use Sum and Count. Your source data should sit in a table or contiguous range with one header row.
Why dates can be grouped
Excel stores every real date as a serial number. A PivotTable can only group a date field if every value in it is a real date or number. It then sorts those numbers into buckets such as months or quarters. A date typed as text, such as "2025-03-14" left-aligned in the cell, has no serial number and cannot be bucketed.
Before you group, check the source column. This formula returns TRUE for a real date and FALSE for text:
=ISNUMBER(A2)Fill it down next to the dates. Any FALSE marks a cell that will block grouping. Blank cells in the date column also block it.
Group a date field
Assume an Orders table with the columns OrderDate, Region, and Amount. Build a PivotTable with OrderDate in Rows and Sum of Amount in Values.
- Right-click any date in the Row Labels column.
- Choose Group. The Grouping dialog opens.
- Check that Starting at and Ending at show the first and last dates in your data.
- In the By list, select Months, Quarters, and Years. Selected units are highlighted.
- Select OK.
Excel replaces the single date field with one field per unit you chose. The field list now shows Years, Quarters, and OrderDate, which is the Months field and keeps the original field name.
Selecting several units at once
Each selected unit becomes its own field. You can arrange them to change the layout.
- Years, Quarters, and Months all in Rows give a nested outline, with Years on the outside.
- Years in Columns and Months in Rows give a table that compares the same month across years.
- Dragging a unit to Filters lets you show one year at a time.
Because the units are separate fields, you can move, filter, or remove them like any other field.
Automatic date grouping
In recent versions of Excel, dragging a date field into Rows often groups it for you, usually into Years, Quarters, and Months. This only happens when the column holds real dates. To change the result, right-click a date and choose Group or Ungroup.
To turn automatic grouping off, go to File > Options > Data and select Disable automatic grouping of Date/Time columns in PivotTables. This affects PivotTables you create afterward, not ones that already exist.
Quarters follow the calendar
The Quarters unit uses calendar quarters. Qtr1 is January to March, whatever your fiscal calendar says. Fiscal quarters need a helper column in the source data, which a later chapter covers. As a preview, this formula gives the fiscal year for a year that starts in July and is named for the year in which it ends:
=YEAR(A2)+(MONTH(A2)>=7)Common mistakes
| Symptom | Likely cause | Fix |
|---|---|---|
| "Cannot group that selection" | Text or blank cells in the date column | Convert the text to real dates and fill the blanks, then refresh |
| Months from different years are combined | Years was not selected | Ungroup, then regroup with Years included |
| Start or end date is wrong | The dialog filled in the data's range, which you later edited | Reopen the dialog and correct Starting at and Ending at |
Exercise
Your PivotTable shows twelve rows, January to December, but the data covers 2023 to 2025. Each total looks three times too large. What went wrong, and how do you fix it?
Show answer
The date field was grouped by Months only, so each month is summed across all three years. Right-click a date, choose Group, and select Years as well as Months, or choose Ungroup and regroup with both units. Years then appears as its own field, so each year is separate.
Exercise
A date column has 500 rows, and Group fails with "Cannot group that selection". Which formula helps find the cause, and what result should you look for?
Show answer
Use =ISNUMBER(A2) filled down the column. A FALSE result marks a text value that is not a real date. A blank cell also blocks grouping. Fix those cells, refresh the PivotTable, and group again.