Sub topic 2
EOMONTH: The Last Day of a Month, Shifted by n Months
EOMONTH is the function that puts month-end dates into a model's period columns. This chapter covers its arguments, its output, the patterns built from it, and the errors it produces.
It assumes you know basic Excel formulas, relative and absolute references, and the YEAR, MONTH and DAY functions. It also assumes you are used to a column-based model with periods across the top. The earlier chapter on serial dates explained why a date is a number. This chapter relies on that idea.
What EOMONTH does
EOMONTH takes a date and a number of months. It moves forward or backward by that many months, then returns the last day of the month it lands in.
=EOMONTH(start_date, months)| Argument | Meaning | Notes |
|---|---|---|
| start_date | The date to start from | Any day in the month works. Use a real date or a DATE() result. |
| months | Whole months to move | Positive moves forward, negative moves back, 0 stays in the same month. |
The result is a serial number, not a formatted date. If a result cell shows something like 45688, the cell has a General or Number format. Apply a date format such as dd-mmm-yyyy.
The day of the month in start_date has no effect on the result. Only its month and year matter. EOMONTH(DATE(2025,1,1),0) and EOMONTH(DATE(2025,1,31),0) both return 31-Jan-2025.
The core examples
Here is the function on one start date, 15-Jan-2025, with different month offsets:
=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-2024Notice three things.
- An offset of 0 does not return the start date. It returns the end of the same month. This is the most useful form in model timelines, because it turns any input date into a month end.
- A positive offset crosses into February and returns the 28th without any extra logic. In a leap year the same formula returns the 29th.
- A negative offset crosses the year boundary correctly. January minus one month gives December of the previous year.
You never need to test for 28, 29, 30 or 31 days. EOMONTH reads the calendar for you.
How it works internally
Excel does not count days to build the answer. It works out the target month, then returns the last day of that month.
A formula that does the same job without EOMONTH is useful for checking:
=DATE(YEAR(A1), MONTH(A1) + n + 1, 0)Day 0 of a month means the day before the 1st, so day 0 of the next month is the last day of the target month. EOMONTH is shorter and easier to read, which is why models use it.
Four patterns you will reuse
Every period column in a monthly timeline is built from these.
- Month end of any date:
=EOMONTH(C2,0). - Next month end from the previous one:
=EOMONTH(D6,1). Copy this formula to the right and each column is one month later. - First day of a month:
=EOMONTH(C2,-1)+1. Go to the end of the previous month, then add one day. - Days in a month:
=DAY(EOMONTH(C2,0)). The day number of the month end is the length of the month.
Pattern 3 is a convention, not a separate function. Excel has no "start of month" function of this kind, so the end of the previous month plus one is the standard idiom.
Here is a worked example. Say C2 holds 15-Jan-2025.
| Formula | Result | Why |
|---|---|---|
| `=EOMONTH(C2,0)` | 31-Jan-2025 | End of the same month |
| `=EOMONTH(C2,-1)+1` | 01-Jan-2025 | End of Dec 2024, plus one day |
| `=EOMONTH(C2,1)` | 28-Feb-2025 | End of the next month |
| `=DAY(EOMONTH(C2,0))` | 31 | Length of January |
| `=EOMONTH(C2,12)` | 31-Jan-2026 | Same month, one year later |
The last row shows why EOMONTH suits annual steps too. A shift of 12 months lands on the end of the same month in the next year.
Month-end input versus mid-month input
EOMONTH always returns a month end, so the day in the input does not matter. That has a consequence for chained formulas.
=EOMONTH(DATE(2025,1,31),1) -> 28-Feb-2025
=EOMONTH(DATE(2025,2,28),1) -> 31-Mar-2025The second result is 31-Mar, not 28-Mar. EOMONTH does not keep the day number. It returns the end of March, whatever the input day was. Chaining EOMONTH from the previous period end therefore never drifts. Each column is the true last day of its month. The next chapters contrast this with EDATE, which keeps the day number and can end up one day short of a month end.
Rules for the months argument
- Fractions are truncated.
EOMONTH(DATE(2025,1,15),1.9)behaves like an offset of 1. It does not round to 2. If the offset comes from a calculation such as a number of years times 12, make sure it is a whole number. Use ROUND where a fraction is possible. - Negative values move back. There is no separate "previous month" function.
- The offset can be a cell.
=EOMONTH($C$2,D8)shifts by the period counter in D8. This is an alternative to chaining. It gives the same dates, and each column depends only on the start date and its own counter, not on the column to its left.
Time portions and text dates
A serial number can have a fractional part, which is the time of day. EOMONTH ignores the time and returns a whole-day serial. EOMONTH(45688.75,0) gives the same answer as EOMONTH(45688,0). That is helpful when an input came from a system that exports timestamps.
Text is where errors come from. A cell showing 15/01/2025 may be text rather than a date, for example after pasting from a CSV file. EOMONTH may convert some text strings using your regional settings, but the same file can behave differently on another computer. Build dates with DATE(year, month, day), or convert the input once with DATEVALUE and keep the real date in the model input.
Errors and how to read them
| Symptom | Likely cause | Fix |
|---|---|---|
| `#VALUE!` | start_date is text that Excel cannot read as a date, or months is text | Enter the date as a real date or with DATE(). Check the months cell for text. |
| `#NUM!` | The result falls before 1-Jan-1900 or after 31-Dec-9999 | Check for a negative or very large offset. Check that the start date is not zero or blank. |
| A five-digit number such as 45688 | Cell format is General or Number | Apply a date format. The value is correct. |
| A date in January 1900 | start_date is blank, and Excel treats a blank as 0 | Make the start date a required input. Add a check cell that flags a blank. |
| `#VALUE!` when passing a range | EOMONTH does not accept a range as start_date in some versions | Apply the formula to one cell at a time and copy it across. |
The blank-cell case is quiet. The formula returns a valid-looking date and nothing flags the problem. A timeline that starts in 1900 usually means the start-date input was cleared or the link to it was broken.
Using EOMONTH as the timeline anchor
A model timeline needs a first period end taken from one input. The spine example uses this:
Inputs: C2 = model start date (any date in the first month, e.g. 15-Jan-2025)
Row 6 (period end): D6: =EOMONTH(C2,0) E6: =EOMONTH(D6,1)D6 turns the input into a month end, which is 31-Jan-2025. E6 steps one month from D6 and gives 28-Feb-2025. Copy E6 to the right and every later column is a true month end. The user can type any date in the first month, such as the 1st, the 15th or the 31st, and the timeline is the same.
Use the same pattern for the first day of a period: =EOMONTH(C2,-1)+1 for the first column. A later chapter derives period starts and day counts from it.
Checks worth adding now
A short check on every EOMONTH row catches most problems early.
End-of-month check: D12: =D6=EOMONTH(D6,0) -> must be TRUEIf a hardcoded date or a pasted value replaces a formula in the row, this check returns FALSE as soon as the value is not a month end. Add the check to the model's overall error summary so that one FALSE anywhere shows up in one place.
Summary of decisions
- Use EOMONTH when you need the last day of a month, or a column of month ends.
- Use an offset of 0 to convert an input date into its own month end.
- Use an offset of -1 plus one day to get the first day of the month.
- Pass whole numbers as the offset, and pass real dates, not text.
- Format result cells as dates, because the function returns a serial number.
Exercise
Cell B1 contains 10-Mar-2024. Without Excel, what do these four formulas return? (a) =EOMONTH(B1,0) (b) =EOMONTH(B1,-1)+1 (c) =EOMONTH(B1,11) (d) =DAY(EOMONTH(B1,-1))
Show answer
(a) 31-Mar-2024, the end of the same month. (b) 01-Mar-2024: EOMONTH(B1,-1) is 29-Feb-2024 because 2024 is a leap year, and adding one day gives 1 March. (c) 28-Feb-2025: eleven months after March 2024 is February 2025, and 2025 is not a leap year. (d) 29, the day number of 29-Feb-2024.
Exercise
A modeller types =EOMONTH(D6,1) in E6 and copies it right, but the first column D6 contains the typed value 28-Feb-2025 instead of a formula. The start date input in C2 is later changed to 15-Mar-2025. What happens to the timeline, and which check would catch it?
Show answer
D6 stays at 28-Feb-2025 because it is hardcoded, so every later column continues from February and the timeline no longer starts in the month of the input. The end-of-month check =D6=EOMONTH(D6,0) would still return TRUE here, because 28-Feb-2025 is a month end. A better check compares D6 with EOMONTH(C2,0), which catches the mismatch. The fix is to restore D6 to =EOMONTH(C2,0).