The EOMONTH function returns the last date of the month that is a certain number of months away from the start date as a number.
This function can be useful when working with financial reports, planning, and other tasks related to dates.
Syntax
EOMONTH(start_date, months)
Argument |
Description |
Permitted values |
|---|---|---|
start_date |
The date from which the countdown begins |
Date or reference to a cell containing the date |
months |
The number of months before (negative value) or after (positive value) the specified value of the “start_date” argument. Returns the last calendar day of the month |
An integer (can be positive or negative) or a reference to a cell containing a number |
Examples of use
Determining the last day of the current month
=EOMONTH("2023-10-15", 0)
Result: 10/31/2023, as this is the last day of October.
Determining the last day of the following month
=EOMONTH("2023-10-15", 1)
Result: 11/30/2023, as this is the last day of November.
Determining the last day of the previous month
=EOMONTH("2023-10-15", -1)
Result: 09/30/2023, as this is the last day of September.
Notes
–Make sure that the value of the start_date argument is in the correct format, otherwise the function will return the #VALUE! error.
–The function automatically takes into account the varying number of days in months and leap years.
–The result of the function is the date of the last day of the month, with the time set to midnight.
–To display only the calendar day, use the combination with the DAY function: =DAY(EOMONTH(A1, 0))