Sub topic 4
What happens when the day does not exist
This chapter assumes you can write basic date formulas and know that EDATE and EOMONTH return serial numbers, which you format as dates. It covers one narrow behaviour that causes most date errors in timelines: asking for a day that the target month does not have, such as 31 February.
The problem: months have different lengths
A date has a month and a day number. When you shift a date by whole months, the month is easy to compute. The day number is the issue. If you start on 31 January and move one month forward, February has no 31st.
Software can handle this in three ways:
- Return an error.
- Roll the extra days into the next month, so 31 February becomes 3 March.
- Clamp the day to the last valid day of the target month.
Excel's EDATE and EOMONTH use the third approach. Neither function returns an error for a missing day, and neither rolls into the next month. The result stays in the month you asked for.
How EDATE clamps
EDATE(start_date, months) keeps the day number from start_date and moves the month. If that day does not exist in the target month, it returns the last day of that month.
=EDATE(DATE(2025,1,31),1) -> 28-Feb-2025
=EDATE(DATE(2025,1,30),1) -> 28-Feb-2025
=EDATE(DATE(2024,1,31),1) -> 29-Feb-2024
=EDATE(DATE(2025,1,31),2) -> 31-Mar-2025Read each line in turn:
- 31 January 2025 plus one month would be "31 February". February 2025 has 28 days, so the result is 28 February.
- 30 January also clamps to 28 February, because there is no 30 February either. Two different start dates give the same result.
- In 2024, a leap year, February has 29 days. The same formula returns 29 February.
- Two months after 31 January is March, which has 31 days. The day is not clamped, so the result is 31 March.
The last line is the important one. The clamp applies only to the month where the day is missing, and it does not change the day number you started with. The function still "remembers" 31 for the next calculation, as long as you give it the original date.
Format the result cells as dates. Without a date format you will see a serial number such as 45716 and may think the formula is wrong.
How EOMONTH avoids the problem
EOMONTH(start_date, months) does not keep the day number at all. It shifts the month and returns the last day of the target month, whatever the start day was. There is nothing to clamp, because the answer is defined as the month end.
=EOMONTH(DATE(2025,1,15),1) -> 28-Feb-2025
=EOMONTH(DATE(2025,1,15),0) -> 31-Jan-2025
=EOMONTH(DATE(2025,1,15),-1) -> 31-Dec-2024Using 0 as the month shift returns the end of the month that contains the start date. That is the standard way to find the end of a period from any date inside it.
This difference is the reason the next chapters build timeline columns with EOMONTH. A period end must always be a real month end, and EOMONTH guarantees that.
The decision path for EDATE
The flow below shows what EDATE does after it has moved the month.
There is no third branch for an error or an overflow into the next month.
The trap: chaining clamped results
Clamping is safe when every result is calculated from the original date. It causes trouble when you feed a clamped result into the next calculation. A clamped date has lost information: 28 February no longer tells you that the original day was 31.
Consider a column of payment dates built by stepping one month at a time from a 31 January start:
Start: 31-Jan-2025
Chained: each cell = EDATE(previous cell, 1)
Feb: EDATE(31-Jan-2025,1) -> 28-Feb-2025
Mar: EDATE(28-Feb-2025,1) -> 28-Mar-2025
Apr: EDATE(28-Mar-2025,1) -> 28-Apr-2025From February onwards, every date sits on the 28th. The 31st never returns, even in months that have one. The error is small in each cell, but it moves cash flows to the wrong days and can change the day count used for interest.
The fix is to always calculate from the original date and change only the number of months.
Inputs: C4 = loan drawdown date (e.g. 31-Jan-2025)
Payment date for period n (n in row 8): =EDATE($C$4,D8)
Check that a date falls in a period: =AND(F4>=D5,F4<=D6)With the anchor fixed at $C$4, the dates are:
| Period n | Formula | Result |
|---|---|---|
| 1 | `=EDATE($C$4,1)` | 28-Feb-2025 |
| 2 | `=EDATE($C$4,2)` | 31-Mar-2025 |
| 3 | `=EDATE($C$4,3)` | 30-Apr-2025 |
| 4 | `=EDATE($C$4,4)` | 31-May-2025 |
Each row clamps only when it has to. March returns to the 31st because the calculation started again from 31 January. The AND test then assigns each payment date to the monthly period that contains it, by comparing it with the period start and period end.
The same trap with month-end anchors
Drift also appears in annual stepping from a month end. The case that matters is a leap year. Step 12 months at a time, and compare EOMONTH with chained EDATE:
Anchored on a month end, 12 months at a time:
=EOMONTH(DATE(2024,2,29),12) -> 28-Feb-2025
=EOMONTH(DATE(2025,2,28),12) -> 28-Feb-2026
=EOMONTH(DATE(2027,2,28),12) -> 29-Feb-2028
Chained EDATE drifts:
=EDATE(DATE(2025,2,28),12) -> 28-Feb-2026
=EDATE(DATE(2027,2,28),12) -> 28-Feb-2028 (not the month end)Look at the last two lines. EDATE from 28 February 2027 returns 28 February 2028. That date exists, so there is nothing to clamp, but it is not the month end. February 2028 has 29 days. A timeline column built this way would show 28-Feb-2028 as a period end, and a check that tests "is this date a month end?" would fail.
EOMONTH returns 29 February 2028 for the same step, because it always returns the last day of the target month.
Comparing the two functions side by side
| Start date | Shift | EDATE result | EOMONTH result |
|---|---|---|---|
| 15-Jan-2025 | +1 | 15-Feb-2025 | 28-Feb-2025 |
| 31-Jan-2025 | +1 | 28-Feb-2025 | 28-Feb-2025 |
| 31-Jan-2025 | +2 | 31-Mar-2025 | 31-Mar-2025 |
| 28-Feb-2027 | +12 | 28-Feb-2028 | 29-Feb-2028 |
| 29-Feb-2024 | +12 | 28-Feb-2025 | 28-Feb-2025 |
The two functions agree whenever the start date is the last day of a month and the target month is not longer, or whenever clamping happens. They disagree when the target month has more days than the day number in the start date. That is why you cannot treat them as interchangeable just because they happen to match on a test date.
Testing your own formulas for the clamp
You do not need to memorise every month length. Test the cases where clamping can occur. Use these start dates in a scratch area and check the results by eye:
- A date on the 31st, shifted into a 30-day month, such as 31-Jan then +3 (April).
- A date on the 29th, 30th or 31st, shifted into February of a non-leap year.
- The same date shifted into February of a leap year.
- A date shifted by 12 or 24 months, to test leap-year boundaries.
If your model's start date is an input, these cases will occur sooner or later, because a user can type any date. A formula that works for 15 January and fails for 31 January is a bug waiting for the wrong input.
Common errors
- Chaining
EDATEfrom the previous cell. The clamped day carries forward. Fix it by anchoring to the original date. - Assuming
EDATEreturns month ends. It returns the same day number, clamped only when needed. - Reading a serial number as an error. A value like 45716 means the cell needs a date format.
- Typing dates as text. A start date stored as text such as "31/01/2025" can cause
#VALUE!from both functions, depending on regional settings. UseDATE(2025,1,31)or a real date value. - Using a fractional month count. Both functions truncate the months argument to a whole number, so
1.9behaves as1. Keep the shift an integer.
Exercise
A loan is drawn on 30-Nov-2025, stored in C4. Payment dates are calculated with =EDATE($C$4,n). What date does the formula return for n = 3 and for n = 4? A colleague instead chains EDATE from the previous payment date, starting at 30-Nov-2025. What date does the chained method give for payment 4, and why does it differ?
Show answer
For n = 3, the target month is February 2026, which has 28 days, so the result is 28-Feb-2026. For n = 4, the target month is March 2026 and the day 30 exists, so the result is 30-Mar-2026. The chained method gives 30-Dec-2025, 30-Jan-2026, then 28-Feb-2026 (clamped), and then 28-Mar-2026 for payment 4. It differs because after the February clamp the chained formula starts from 28-Feb and no longer knows the original day was 30. The anchored formula recalculates from 30-Nov each time.
Exercise
A timeline column uses =EDATE(D6,12) to step the period end forward 12 months, starting from D6 = 28-Feb-2027. What does the next column show, and which function would guarantee a month end instead?
Show answer
It shows 28-Feb-2028, which is not the month end because February 2028 has 29 days. =EOMONTH(D6,12) returns 29-Feb-2028, the true last day of the month.