Why every time report starts with a month key
Month-to-date, year-to-date, year-over-year, rolling twelve months: these are the comparisons every management report, board pack and sales review is built on. Power BI and other BI tools call them "time intelligence" and ship special functions for them. In Excel you can build all of them with a few plain formulas, as long as you get one thing right first: a clean way to say which month a date belongs to.
This lesson is for controllers, analysts, small-business owners and anyone who turns a list of dated transactions into monthly numbers. Perhaps you export orders from a web shop, receipts from a till system or invoices from accounting software, and every month you filter by date, copy totals by hand and hope nothing was missed. Here you learn the foundation that removes that work: a month key built with EOMONTH, and monthly totals with SUMIFS and COUNTIFS.
Our example business is Larkspur Coffee Co., a fictional coffee roaster with cafés, an online shop and wholesale customers. Its order list holds a date, a channel and an amount for each order between June and mid-September 2026. The owner wants to see sales and the number of orders per month, and later MTD, YTD and year-over-year figures. All of that starts here.
The core concept: dates are numbers, months are ranges
Excel stores every date as a whole number: the count of days since the start of its calendar. 3 June 2026 is stored as 46176, 30 June 2026 as 46203. The date format only changes how that number is displayed. This matters because it means a "month" is not a label in Excel. It is a range of numbers: June 2026 is every number from 46174 (1 June) to 46203 (30 June).
To group dates by month you can therefore do one of two things. You can give each date a key that is identical for every day of the month and then match on that key. Or you can describe the month by its two bounds, the first and the last day, and count everything in between. This lesson teaches both, because the rest of the course uses both.
EOMONTH(start_date, months) stands for "end of month". It takes a date, moves it by a number of whole months and returns the last day of that month. With 0 months it returns the end of the date's own month: 3 June, 11 June and 27 June all become 30 June 2026. That is the perfect month key. It is the same for every day of the month, it is still a real date that sorts correctly, and you can add months to it or compare it with < and >.
With −1 months, EOMONTH returns the end of the previous month. Add one day and you have the month start: =EOMONTH(A2,-1)+1. So month start and month key are the two bounds of every month window, and both come from the same function. Later in the course, the same pattern gives you the start of the year, the same month last year and a window of twelve months.
Worked example: Larkspur's orders by month
Here is the lab data with both helper columns already filled in. Column D holds the month key, column E the month start. All amounts are example figures.
| Order date (A) | Channel (B) | Amount (C) | Month key (D) | Month start (E) |
|---|---|---|---|---|
| 3 Jun 2026 | Wholesale | 1,840.00 | 30 Jun 2026 | 1 Jun 2026 |
| 11 Jun 2026 | Online | 264.50 | 30 Jun 2026 | 1 Jun 2026 |
| 19 Jun 2026 | Catering | 935.00 | 30 Jun 2026 | 1 Jun 2026 |
| 27 Jun 2026 | Online | 412.80 | 30 Jun 2026 | 1 Jun 2026 |
| 2 Jul 2026 | Wholesale | 2,210.00 | 31 Jul 2026 | 1 Jul 2026 |
| 9 Jul 2026 | Catering | 1,180.00 | 31 Jul 2026 | 1 Jul 2026 |
| 16 Jul 2026 | Online | 318.40 | 31 Jul 2026 | 1 Jul 2026 |
| 24 Jul 2026 | Wholesale | 1,675.00 | 31 Jul 2026 | 1 Jul 2026 |
| 1 Aug 2026 | Online | 289.90 | 31 Aug 2026 | 1 Aug 2026 |
| 6 Aug 2026 | Catering | 1,420.00 | 31 Aug 2026 | 1 Aug 2026 |
| 14 Aug 2026 | Wholesale | 1,960.00 | 31 Aug 2026 | 1 Aug 2026 |
| 22 Aug 2026 | Online | 506.20 | 31 Aug 2026 | 1 Aug 2026 |
| 29 Aug 2026 | Catering | 760.00 | 31 Aug 2026 | 1 Aug 2026 |
| 4 Sep 2026 | Wholesale | 2,045.00 | 30 Sep 2026 | 1 Sep 2026 |
| 10 Sep 2026 | Online | 371.60 | 30 Sep 2026 | 1 Sep 2026 |
| 15 Sep 2026 | Catering | 1,290.00 | 30 Sep 2026 | 1 Sep 2026 |
Look at the four June orders (3, 11, 19 and 27 June). Their dates differ, but their month key is the same: 30 Jun 2026. That single shared value is what SUMIFS needs. Notice also the order of 1 August: its month start is 1 August itself, and its key is 31 August. EOMONTH handles months of 30 and 31 days, February and leap years without any extra logic from you.
With the keys in place, the monthly summary is one formula per row. The month keys in A20:A23 are the four month ends, and =SUMIFS($C$2:$C$17,$D$2:$D$17,A20) adds every amount whose key equals the key in A20. The orders are counted the second way, without a helper column, by giving COUNTIFS two conditions on the order date: on or after the month start and on or before the month end.
| Month key (A) | Sales (B) | Orders (C) | Note |
|---|---|---|---|
| 30 Jun 2026 | 3,452.30 | 4 | |
| 31 Jul 2026 | 5,383.40 | 4 | |
| 31 Aug 2026 | 4,936.10 | 5 | |
| 30 Sep 2026 | 3,706.60 | 3 | list ends 15 Sep: partial month |
| Total | 17,478.40 | 16 |
The four monthly totals add up to 17,478.40, the sum of all sixteen orders, which is the check you should always make: nothing may fall between two months or be counted twice. Notice too that September looks weak. It is not; the list simply ends on 15 September, so September holds only half a month. Comparing a part month with full months is one of the most common errors in monthly reporting, and it is exactly what the month-to-date lesson that follows solves.
Here are the formulas of the lab in one place, with the result each one returns for the cell the Coach checks.
| Cell | Formula | Result | What it does |
|---|---|---|---|
| D7 | =EOMONTH(A7,0) | 31 Jul 2026 | Month key: last day of the order's month (order of 9 Jul) |
| E11 | =EOMONTH(A11,-1)+1 | 1 Aug 2026 | Month start: day after the previous month end (order of 6 Aug) |
| B22 | =SUMIFS($C$2:$C$17,$D$2:$D$17,A22) | 4,936.10 | August sales, matched on the month keys |
| C21 | =COUNTIFS($A$2:$A$17,">="&EOMONTH(A21,-1)+1,$A$2:$A$17,"<="&A21) | 4 | July orders, counted between two date bounds |
The COUNTIFS criterion ">="&EOMONTH(A21,-1)+1 deserves a closer look. COUNTIFS expects a criterion as text, such as ">=46204". The ampersand joins the text ">=" with the number that EOMONTH returns, so the criterion becomes exactly that. You will use this pattern for every window in the course: MTD, YTD, prior-year YTD and rolling twelve months are all "on or after one date and on or before another".
Which month key should you use?
There are several ways to turn a date into a month. They look similar in a small sheet but behave very differently once a report spans more than one year.
| Key formula | Example result for 9 Jul 2026 | Real date? | Keeps the year? | Good for |
|---|---|---|---|---|
=EOMONTH(A2,0) | 31 Jul 2026 | Yes | Yes | Month keys, windows, EDATE shifts (this course) |
=EOMONTH(A2,-1)+1 | 1 Jul 2026 | Yes | Yes | Month starts, lower bounds of windows |
=DATE(YEAR(A2),MONTH(A2),1) | 1 Jul 2026 | Yes | Yes | Same as above, easier to read for some |
=TEXT(A2,"yyyy-mm") | 2026-07 | No, text | Yes | Labels only; format codes can depend on the language of Excel |
=MONTH(A2) | 7 | No, number 1–12 | No | Seasonality across years, never for a timeline |
The most dangerous one is MONTH(A2). It returns 7 for July 2025 and for July 2026 alike, so a report that groups by MONTH silently merges both years. That is fine for a seasonality chart that deliberately compares all Julys, but fatal for a timeline, a YTD or a year-over-year calculation. Text keys from TEXT keep the year but are no longer dates: you cannot add a month to "2026-07", and the format codes can differ between language versions of Excel. A real date such as the month end avoids all of these issues.
Step by step: build month keys and a monthly summary
Follow along in your own workbook or directly in the lab at the top of the page, where the Coach checks D7, E11, B22 and C21.
- Make sure the order dates in column A are real dates: select a cell and look at the number format, or temporarily switch to General. A real date turns into a number such as 46176; text stays as it is.
- In D2 type
=EOMONTH(A2,0)and press Enter. Select D2:D17 and press Ctrl+D to fill it down. - If the keys show numbers like 46203, select D2:D17 and press Ctrl+Shift+#, or use Ctrl+1 > Number > Date. For a compact label choose Custom and type
mmm yyyy: the cell then shows "Jun 2026" but still holds the full date. - In E2 type
=EOMONTH(A2,-1)+1and fill down to E17. Format it as a date as well. - In A20:A23 type the four month ends, or type the first one and use
=EOMONTH(A20,1)in A21 copied down, so the list of keys extends itself. - In B20 type
=SUMIFS($C$2:$C$17,$D$2:$D$17,A20). Use F4 to add the dollar signs to the two ranges, but leave A20 relative. Fill down to B23. - In C20 type
=COUNTIFS($A$2:$A$17,">="&EOMONTH(A20,-1)+1,$A$2:$A$17,"<="&A20)and fill down to C23. - Check the totals:
=SUM(B20:B23)must equal=SUM(C2:C17), and=SUM(C20:C23)must equal=COUNT(A2:A17). - Optional: convert the order list to an Excel Table with Ctrl+T. New orders typed below the list then get their month key automatically, and SUMIFS with structured references such as
Orders[Amount]includes them without changing any range.

Common mistakes and how to spot them
- Using EOMONTH(A2,1) instead of 0. The second argument counts months forward, so 1 gives the end of the next month. Symptom: every order lands one month too late, and June shows no sales.
- Using EOMONTH(A2,-1) as the month start. That is the last day of the previous month. Add 1. Symptom: the month start of a 1 August order shows 31 July.
- Matching order dates against a month end.
=SUMIFS(C2:C17,A2:A17,A22)looks for orders placed exactly on 31 August and usually returns 0. Match the keys in column D, or use two bounds. - Keys that show as numbers. EOMONTH returns a serial number. A key column full of values like 46234 is correct but unformatted. Apply a date format.
- Dates stored as text. Imported dates such as "03.06.2026" may be text. EOMONTH then returns #VALUE!. Convert them with Data > Text to Columns (choose the date order in step 3) or with DATE and the text functions.
- Timestamps on the last day. If dates include a time, 31 Aug 14:30 is larger than the number for 31 Aug, so
"<="&A22misses it. With timestamps, use"<"&A22+1as the upper bound. The key column is safe either way, because EOMONTH ignores the time. - Grouping by MONTH across years. July 2025 and July 2026 become one bucket. Use a key that keeps the year.
- Unlocked ranges. Without $ signs, the SUMIFS ranges move down as you copy, and the later months are summed over the wrong rows. Spot it by a total that does not match the order list.
Quick reference: functions and shortcuts used
| Function / shortcut | What it does | Example |
|---|---|---|
| EOMONTH(start_date, months) | Last day of the month, shifted by a number of months | =EOMONTH(A2,0) |
| EOMONTH(…,-1)+1 | First day of the same month | =EOMONTH(A2,-1)+1 |
| DATE, YEAR, MONTH | Build or take apart a date | =DATE(YEAR(A2),MONTH(A2),1) |
| SUMIFS | Sum with one or more conditions | =SUMIFS($C$2:$C$17,$D$2:$D$17,A20) |
| COUNTIFS | Count with one or more conditions | =COUNTIFS($A$2:$A$17,">="&E2) |
| ">="&date | Builds a date criterion from an operator and a date | ">="&EOMONTH(A20,-1)+1 |
| Ctrl+; | Types today's date into the cell | Quick test dates |
| Ctrl+Shift+# | Applies a date format to a serial number | Fix keys that show 46203 |
| Ctrl+1 > Custom | Show a key as a month label without changing it | Format code mmm yyyy |
| F4 | Locks a reference with $ signs | $C$2:$C$17 |
Real-world uses of month keys
- Monthly sales reports. Export orders from a shop or till system, add a month key and get sales and order counts per month without filtering by hand.
- Expense tracking. Group card or bank transactions by month and by category with a SUMIFS on the month key and the category column.
- Billing and subscriptions. Find which billing month a sign-up or cancellation belongs to, and count active customers per month.
- Payroll and timesheets. Sum hours or overtime per employee per month from daily time records.
- Budget vs actual. A budget usually exists per month. With month keys on the actuals, a SUMIFS lines them up with the budget months exactly.
What you will build in the rest of this course
Month keys and month bounds are the building blocks. The following lessons turn them into the measures every management report needs, each with a lab on Larkspur's data.
Month-to-Date (MTD): SUMIFS Between the Month Start and the Report Date. You build an MTD block from a single report date, compare it with the same days of last month and estimate a full-month run-rate. This fixes the half-September problem you saw above.
Year-to-Date (YTD) and Prior-Year YTD with SUMIFS and EDATE. You calculate YTD sales up to the last closed month and the comparable prior-year YTD, using a year start, EDATE(…,-12) and the same window pattern.
Year-over-Year (YoY): Variance, Growth % and the "New" Case. You compare 2026 with 2025 month by month, calculate the correct YTD growth and keep the formulas clean when a category had no sales last year.
Rolling 12 Months: Moving Totals, Averages and a Trend Chart. You calculate R12 (also called LTM or TTM) totals and averages for any report month and chart a trend that is free of seasonal noise.
Fiscal Years Starting in April: FY, Fiscal Quarter and Fiscal YTD. You map every month to a fiscal year and quarter that start in April and calculate fiscal YTD and the sales of a chosen fiscal quarter.
Like-for-Like (Same-Store) Growth with COUNTIFS Flags. You flag which stores are comparable using opening dates and a closure log, then see how like-for-like growth differs from total growth.
Mid-Course Project: KPI Tiles (Month, YTD, YoY, R12) and a Current vs Prior Year Chart. You drive a whole KPI page from one report-month cell: YTD, YoY growth of YTD, rolling twelve months and a line chart of this year against last year.
Summary
Dates in Excel are numbers, and a month is a range of those numbers. =EOMONTH(A2,0) gives every date a month key (the last day of its month) that is still a real date, and =EOMONTH(A2,-1)+1 gives the month start. With keys, a monthly total is =SUMIFS(amounts,keys,key); without them, COUNTIFS or SUMIFS with the conditions ">="&start and "<="&end does the same. Avoid MONTH for timelines, format keys as dates, watch out for partial months and timestamps, and always check that the monthly totals add up to the full list.
Now try it in the lab above: build the month keys and month starts for Larkspur's sixteen orders and fill in the monthly summary with SUMIFS and COUNTIFS. The Coach checks each step. It takes about fifteen minutes and it is free.
Frequently asked questions
How do I group dates by month in Excel?
Add a helper column with =EOMONTH(A2,0), which turns every date into the last day of its month. Then sum or count per month with SUMIFS or COUNTIFS on that column.
What does EOMONTH do in Excel?
EOMONTH(start_date, months) returns the last day of the month that is the given number of months before or after start_date. With 0 it returns the end of the same month, with -1 the end of the previous month.
How do I get the first day of the month from a date in Excel?
Use =EOMONTH(A2,-1)+1, the day after the previous month end. =DATE(YEAR(A2),MONTH(A2),1) gives the same result.
How do I sum values by month in Excel?
With a month-key column: =SUMIFS(amounts, keys, month_key). Without one, use two date conditions: =SUMIFS(amounts, dates, ">="&month_start, dates, "<="&month_end).
Why does EOMONTH return a number instead of a date?
Excel stores dates as serial numbers, and EOMONTH returns one. Format the cell as a date with Ctrl+Shift+# or Ctrl+1 > Number > Date.
Should I use MONTH or EOMONTH to group by month?
Use EOMONTH for timelines, because it keeps the year and stays a real date. MONTH returns only 1 to 12, so the same month of different years falls into one group.
Keep going: Excel Time Intelligence: MTD, YTD, YoY, Rolling 12 Months & Fiscal Years
This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time CHF 9.90.
- Month-to-Date (MTD): SUMIFS Between the Month Start and the Report Date
- Year-to-Date (YTD) and Prior-Year YTD with SUMIFS and EDATE
- Year-over-Year (YoY): Variance, Growth % and the "New" Case
- Rolling 12 Months: Moving Totals, Averages and a Trend Chart
- Fiscal Years Starting in April: FY, Fiscal Quarter and Fiscal YTD
- Like-for-Like (Same-Store) Growth with COUNTIFS Flags
- Mid-Course Project: KPI Tiles (Month, YTD, YoY, R12) and a Current vs Prior Year Chart
- Quarter-to-Date (QTD): Quarter Start, QTD Sales and Prior-Year QTD
- Running YTD That Restarts Every January, and a Cumulative Year Chart
- Fair Month Comparisons: Open Days, Sales per Day and Calendar Effects
- Actual vs Budget: YTD Budget, Variance % and the Pace Still Needed
- Full-Year Outlook: Run-Rate, Prior-Year Pattern and Remaining Budget
- Month-over-Month vs Rolling 3 Months: Reading Short-Term Trends Without Seasonal Noise
- YTD by Channel: Growth Rates vs Contribution to Total Growth
- Check the Data Before You Report: Duplicate and Missing Months, Ledger Reconciliation
- Seasonality in Numbers: Seasonal Index, Share of Year and a Seasonal Estimate
- One Selector for Month, QTD, YTD and R12: Period Start with IFS
- YTD Ratio KPIs: Orders, Average Order Value and a Volume vs Price Split
- Final Project: Time-Intelligence Dashboard for the Online Channel