ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Data tools
  3. Group Dates by Month or Year in a Pivot Table

Group Dates by Month or Year in a Pivot Table

By ExcelReady Team·Updated November 1, 2026·5 min read

The short answer

To group dates in a pivot table, put the date field in Rows, right-click any date and choose Group. In the Grouping box, select Months and Years, then click OK. The pivot then shows one total per month, split by year. If Excel says it cannot group the selection, the date column holds blanks or text.

Key takeaways

  • Right-click a date in the pivot and choose Group, then pick Months, Quarters, Years or Days.
  • Always select Years together with Months, or January of every year is added together.
  • For weekly totals, choose Days only and set Number of days to 7.
  • Cannot group that selection means the date column has blanks, text or errors.
  • Recent Excel versions group dates automatically when you add a date field to Rows.
On this page+
  1. Why group dates in a pivot table?
  2. How to group dates by month and year
  3. Why you should select Years with Months
  4. How to group dates by week or a number of days
  5. Automatic date grouping in newer Excel
  6. Why does Excel say "Cannot group that selection"?
  7. Can you group dates without a pivot table?
  8. Practise it

To group dates in a pivot table, right-click a date in the pivot, choose Group, and pick a unit such as Months and Years. Instead of one row per day, you get one total per month, quarter or year, which is what most reports need. This guide covers each grouping option, how to keep years apart, weekly groups, and what to do when Excel refuses to group.

Why group dates in a pivot table?#

A pivot table normally lists every date as its own row. With a year of daily orders, that is up to 365 rows, which is too detailed to read. Grouping rolls the dates up into bigger periods, so the pivot answers questions like "what were sales each month?" in one view.

The examples use this order list in A1:C9:

ABC
1DateRegionSales
25-Dec-2023East1200
319-Dec-2023West900
48-Jan-2024East1500
522-Jan-2024West700
63-Feb-2024East1100
714-Feb-2024East600
827-Feb-2024West1300
911-Mar-2024West800

If you are new to pivots, build one first with the beginner's guide to pivot tables.

How to group dates by month and year#

Put the date field in Rows and Sales in Values, then follow these steps:

  1. Right-click any date in the pivot table's row labels.
  2. Choose Group. (You can also use PivotTable Analyze > Group Field.)
  3. In the Grouping box, click Months and Years so both are highlighted. Click a selected item again to deselect it.
  4. Leave Starting at and Ending at as they are, unless you want to cut off early or late dates.
  5. Click OK.

The pivot now looks like this:

Row LabelsSum of Sales
2023
Dec2100
2024
Jan2200
Feb3000
Mar800
Grand Total8100

Excel adds a new Years field to the field list, and the original date field now shows months. You can drag Years to Columns to put the years side by side, which makes month-by-month comparisons easy.

Why you should select Years with Months#

If you choose Months alone, Excel groups by month name only. January 2023 and January 2024 land in the same "Jan" row, and the total mixes both years. That's a common mistake in reports and in interview tasks.

Select Years too whenever the data covers more than one year. With the table above, Months alone would still be correct today, but one more December order from 2024 would silently join the 2023 December row.

The same rule applies to Quarters: choose Quarters and Years together to get Qtr1 2024 rather than every first quarter added up.

How to group dates by week or a number of days#

Weeks aren't in the list, but you can make them from days:

  1. Right-click a date and choose Group.
  2. Deselect everything except Days.
  3. Set Number of days to 7.
  4. Change Starting at to a Monday (or Sunday) on or before your first date, so each group is a full calendar week.
  5. Click OK.

Each row now shows a date range in your date format, such as 4 December to 10 December 2023 for the first week. You can't combine a 7-day group with Months or Years; the Number of days box only works when Days is the only unit selected.

Automatic date grouping in newer Excel#

In Excel 2016 and later, including Microsoft 365, dropping a date field into Rows often groups it for you. Excel adds fields such as Years, Quarters and Months and shows the top level with plus buttons to expand.

If you want the plain dates, press Ctrl+Z (Mac: ⌘Z) right after adding the field, or right-click a date and choose Ungroup. In Excel for Windows, you can switch the feature off under File > Options > Data with the option to disable automatic grouping of date and time columns in PivotTables.

One more thing to know: pivots built from the same source share their grouping. If you group dates in one pivot, a second pivot from the same data shows the same groups.

Why does Excel say "Cannot group that selection"?#

This message means at least one item in the date field isn't a real date. Excel can only group a field when every value is a date or a number. Check the source data for:

  • Blank cells. A single empty date cell is enough. Fill it in, or remove the row.
  • Text dates. Dates typed as text, often from an import, sit on the left of the cell. Convert them with Data > Text to Columns or DATEVALUE.
  • Error values such as #VALUE! in the date column.
  • A source range with empty rows. If the pivot's range runs past the data, the empty rows count as blanks. Use an Excel table as the source so the range fits exactly.

After fixing the data, refresh the pivot (right-click > Refresh), then try Group again.

Can you group dates without a pivot table?#

Yes. A formula gives the same monthly totals and updates without a refresh. For February 2024, with 1-Feb-2024 in E2 and 1-Mar-2024 in E3:

Excel formula
=SUMIFS(C2:C9,A2:A9,">="&E2,A2:A9,"<"&E3)

The result is 3,000, the same as the pivot. Using "before 1 March" rather than "on or before 29 February" also catches dates that include a time. The comparison of pivot tables vs SUMIFS explains when each is better. After grouping, you can also show each month as a share of the year with percent of total in a pivot table, add a ratio with a calculated field, or filter months by clicking with slicers and timelines.

Practise it#

Grouping by month is one of the first things an interviewer asks you to do with a pivot, so it pays to be fast. Practise pivot tables in a live spreadsheet: nest row fields, add filters and percent of total, and check your answers instantly. If you're preparing for an interview, review the most common pivot table interview questions too.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Check the pivot's February 2024 total with a formula. In F2, use SUMIFS to add C2:C9 where the date in A2:A9 is on or after E2 and before E3.

fx
ABCDEFG
1
Date
Region
Sales
Month start / end
Feb 2024 sales
2
45265
East
1200
45323
3
45279
West
900
45352
4
45299
East
1500
5
45313
West
700
6
45325
East
1100
7
45336
East
600
8
45349
West
1300
9
45362
West
800
10
11
12

Tip: Sum C2:C9. First test: A2:A9 with ">="&E2. Second test: A2:A9 with "<"&E3.

Practise this in a lesson

LessonPivot tables 2Go further with PivotTables: nest two row fields with subtotals, add a report filter, show values as a % of the grand total, update the source when new rows arrive, and know when SUMIFS is the better tool.

Frequently asked questions

How do I group dates by month in a pivot table?

+

Right-click any date in the pivot table's rows and choose Group. Select Months, and also Years if the data covers more than one year, then click OK.

Why can't I group dates in my pivot table?

+

At least one cell in the date column is blank, text or an error, so Excel can't treat the field as dates. Fix those cells in the source data, refresh the pivot and try Group again.

How do I group dates by week in a pivot table?

+

Right-click a date, choose Group, deselect everything except Days and set Number of days to 7. Change Starting at to a Monday if you want Monday-to-Sunday weeks.

How do I stop a pivot table from grouping dates automatically?

+

Press Ctrl+Z straight after adding the field to undo the grouping, or right-click a date and choose Ungroup. In Excel for Windows you can turn it off under File > Options > Data.

How do I ungroup dates in a pivot table?

+

Right-click any grouped date or month label and choose Ungroup. The field goes back to showing each date on its own row.

Sources

  • Create a PivotTable to analyze worksheet data - Microsoft Support
  • SUMIFS function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 1, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. Why group dates in a pivot table?
  2. How to group dates by month and year
  3. Why you should select Years with Months
  4. How to group dates by week or a number of days
  5. Automatic date grouping in newer Excel
  6. Why does Excel say "Cannot group that selection"?
  7. Can you group dates without a pivot table?
  8. Practise it

Keep reading

Data tools· 6 min read

Pivot Table Tricks: Subtotals, Filters and % of Total

To show a percent of total in a pivot table, click the ▾ on the field in the Values area, choose Value Field Settings, open Show Values As and pick % of Grand Total. Each number then shows its share of the total, and the parts add up to 100%. You can also right-click a value and choose Show Values As.

Data tools· 5 min read

Calculated Fields in a Pivot Table

A calculated field is a new value column you create inside a pivot table from a formula, such as =Sales-Cost for profit. Click the pivot, go to PivotTable Analyze > Fields, Items & Sets > Calculated Field, type a name and formula, then click Add. It works on summed fields, so ratios work but row-level maths like Units*Price doesn't.

Comparisons· 7 min read

Pivot Table vs SUMIFS: Which Is Better for Reports?

Use a pivot table to explore data and build a summary fast: drag fields, regroup in seconds and show percentages of the total. Use SUMIFS when a report needs totals in fixed cells that update by themselves, such as a dashboard or a monthly template. Pivots need a refresh after the data changes; SUMIFS recalculates automatically.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free