WorkbookLogic
FormulaFreeDate and TimeintermediateEOMONTHEDATEDATEYEARMONTHIFAND

Get the Last Day of a Month

By WorkbookLogic

Return reliable month-end dates from any valid date with EOMONTH, including short months, leap years, and year rollovers, with an independent DATE-based reconciliation for verification.

ExcelLast reviewed Sep 11, 2026
get-last-day-of-month-v1.0.0.xlsxFree
Get Last Day of Month, Formula Review
Compare EOMONTH with the equivalent DATE construction across leap years and year boundaries.
Month-end examplesFormula review
Reference dateOffsetEOMONTHDATE alternativeExampleFormula syntaxResult
Feb 12, 20240Feb 29, 2024Feb 29, 2024Leap-year February=EOMONTH($A$12,0)Feb 29, 2024
Feb 12, 20250Feb 28, 2025Feb 28, 2025Non-leap February=EOMONTH($A$13,0)Feb 28, 2025
Apr 7, 20250Apr 30, 2025Apr 30, 2025Next month=EOMONTH($A$14,1)May 31, 2025
Dec 20, 20251Jan 31, 2026Jan 31, 2026Prior month=EOMONTH($A$15,-1)Nov 30, 2025
Jan 15, 2024-1Dec 31, 2023Dec 31, 2023Date alternative=DATE(YEAR($A$12),MONTH($A$12)+1,0)Feb 29, 2024
Jan 31, 20250Jan 31, 2025Jan 31, 2025
Reliability checks
Leap-year February returns 29-Feb-2024OK
Non-leap February returns 28-Feb-2025OK
EOMONTH and DATE alternatives agree for every exampleOK

Overview

Return the final calendar day of the month containing a reference date, or of a month before or after it. EOMONTH handles different month lengths, leap years, and December-to-January transitions automatically. Each formula returns one Excel date.

When to use it

Use it for forecast headers, accounting cutoffs, accrual periods, monthly debt schedules, and reporting selectors that require true calendar month-ends. The offset can remain zero or advance through a sequence of whole months.

When not to use it

Use EDATE when the day number should be preserved rather than forced to month-end. Combine EOMONTH with workday logic when the cutoff must be the last working day. Use a complete timeline Block when headers also require actual/forecast flags, period numbers, or fiscal labels.

Problem

Adding 30 or 31 days creates drift because calendar months vary in length. Hardcoded February logic also fails in leap years. A reliable calculation must let the calendar determine each final day and continue correctly across year boundaries.

Inputs

Input

Location

Sample

Schedule anchor

Combined Example!J11

15-Jan-2025

Month offsets

Combined Example!A12:A17

0 through 5

Source data

The calculation needs a valid Excel date and a whole-number month offset. The example schedule uses:

Offset

Expected month-end

0

31-Jan-2025

1

28-Feb-2025

2

31-Mar-2025

3

30-Apr-2025

4

31-May-2025

5

30-Jun-2025

Offsets may be negative. Sorting and duplicates are irrelevant because each row is calculated independently.

Calculations

  1. Read the valid reference date.
  2. Interpret zero as the reference month, positive offsets as later months, and negative offsets as earlier months.
  3. Return the last valid day in the target month with EOMONTH.
  4. Recalculate by constructing day zero of the following month with DATE.
  5. Compare both results across the schedule.

Outputs

Starting from 15-Jan-2025, the six outputs run from 31-Jan-2025 through 30-Jun-2025. February correctly returns 28 days. The result is stored as a date serial and requires date formatting for a readable display.

Formula map

EOMONTH calculation

=EOMONTH($J$11,A12)

The anchor is absolute and the offset is relative so the formula can fill down.

DATE reconciliation

=DATE(YEAR($J$11),MONTH($J$11)+A12+1,0)

Day zero rolls back from the following month to the target month’s final day.

Model checks

The workbook confirms the first schedule date is 31-Jan-2025, offset 5 returns 30-Jun-2025, and every EOMONTH output matches its DATE-based alternative. Passing checks return OK.

Edge cases

  • February 2024 returns 29-Feb because it is a leap year.
  • February 2025 returns 28-Feb.
  • Positive and negative offsets cross year-end automatically.
  • An already month-end date with offset zero remains unchanged.
  • An unrecognized text date produces an error or unreliable coercion.
  • EOMONTH does not preserve an earlier day within the month.

Common errors

  • Adding fixed days: outputs drift across different month lengths. Use EOMONTH.
  • Using EDATE: the result may preserve the day rather than return period-end. Match the function to the convention.
  • Ignoring date formatting: a correct date serial appears as a number. Apply a date number format.

Example

For anchor 15-Jan-2025 and offset 1, EOMONTH returns 28-Feb-2025. Independently, DATE constructs day zero of March 2025, which rolls back to the same date. The workbook also confirms that February 2024 returns 29-Feb-2024.

Example workbook

Replace the cream anchor in Combined Example!J11 or edit offsets in A12:A17. EOMONTH and DATE results appear side by side. Formula Review tests leap years, non-leap years, prior months, future months, and year rollover.

Key takeaway

Let the calendar determine month-end: EOMONTH converts a date and whole-month offset into a reliable period boundary without hardcoded day counts.