EOMONTH Function (LibreOffice Calc)
The EOMONTH function returns the last day of the month that is a specified number of months before or after a given date. It is essential for financial schedules, billing cycles, and month-end calculations.
What the EOMONTH Function Does
- Returns the last day of a target month
- Adds or subtracts whole months
- Handles leap years and variable month lengths
- Works with serial dates or text dates
- Returns a serial date number formatted as a date
It is designed to be precise, predictable, and ideal for month-end calculations.
Syntax
EOMONTH(start_date; months)
Arguments
-
start_date:
The reference date. -
months:
Number of months to offset (positive or negative).
Basic Examples
Last day of the current month
=EOMONTH("2024-01-15"; 0)
Returns 2024‑01‑31.
Last day of next month
=EOMONTH("2024-01-15"; 1)
Returns 2024‑02‑29 (leap year).
Last day of previous month
=EOMONTH("2024-03-10"; -1)
Returns 2024‑02‑29.
Using cell references
=EOMONTH(A1; B1)
Advanced Examples
First day of next month
=EOMONTH(A1; 0) + 1
First day of current month
=EOMONTH(A1; -1) + 1
Days in the current month
=EOMONTH(A1; 0) - EOMONTH(A1; -1)
Generate a month-end schedule
=EOMONTH($A$1; ROW(A1)-1)
Compute quarter-end
=EOMONTH(A1; MOD(3 - MONTH(A1); 3))
Compute fiscal year-end (March 31 example)
=EOMONTH(DATE(YEAR(A1)+(MONTH(A1)>3); 3; 1); 0)
Add months to a text date
=EOMONTH(DATEVALUE(A1); 6)
Add months to Excel serial dates imported as text
=EOMONTH(DATE(1899;12;30)+VALUE(A1); 1)
Compute the last day of the year
=EOMONTH(DATE(YEAR(A1);12;1); 0)
Compute the last day of the quarter
=EOMONTH(A1; 3 - MOD(MONTH(A1); 3))
Edge Cases and Behavior Details
EOMONTH returns a number, not text
Accepts:
- Real dates
- Serial numbers
- DATEVALUE outputs
- ISO date strings
Invalid text → Err:502
Time components are ignored
=EOMONTH("2024-01-15 23:59"; 0) → 2024‑01‑31
Negative months allowed
Large offsets allowed
=EOMONTH("2024-01-01"; 1200) → year 2124
Leap-year aware
EOMONTH of an error → error propagates
Common Errors and Fixes
Err:502 — Invalid argument
Cause:
- Text not recognized as a date
- Non-numeric month offset
Fix:
- Wrap with DATEVALUE
- Ensure months is numeric
Wrong result due to text dates
Fix:
- Normalize with DATEVALUE
Unexpected month-end behavior
Cause:
- Misunderstanding of month offset logic
Fix:
- Use EDATE if you want same-day-of-month behavior
Best Practices
- Use EOMONTH for all month-end calculations
- Use EDATE for same-day-of-month offsets
- Use DATEVALUE to normalize text dates
- Use EOMONTH(A1;0)+1 for first-of-month logic
- Use EOMONTH with ROW() or SEQUENCE() to generate schedules
Related Patterns and Alternatives
- Use EDATE for same-day-of-month offsets
- Use DATE for custom date construction
- Use DATEDIF for interval calculations
- Use DAYS for day differences
- Use YEARFRAC for fractional-year differences
By mastering EOMONTH and its companion functions, you can build powerful, reliable, and fully dynamic month‑end workflows in LibreOffice Calc.
Reproducible example (tested in LibreOffice Calc)
This standalone example was calculated in LibreOffice Calc 25.2.3.2 and matched the expected value. It is a practical cross-check of one usage, not proof that every example elsewhere on this page is correct.
=DAY(EOMONTH(DATE(2025;2;1);0))
Expected result: 28.
Identify the last day of a non-leap February.
If the result differs, check the referenced cells, argument separators and number formatting. For more information, consult the LibreOffice Calc official help.