Summary

The Excel EOMONTH function returns the last day of the month, n months in the past or future. You can use EOMONTH to calculate expiration dates, due dates, and other dates that need to land on the last day of a month. Use a positive value for months to move forward in time, and a negative number to move back in time.

Purpose 

Get last day of month n months in future or past

Return value 

Last day of month date

Syntax

=EOMONTH(start_date,months)
  • start_date - A date that represents the start date in a valid Excel serial number format.
  • months - The number of months before or after start_date.

How to use 

The EOMONTH function returns the last day of the month a given number of months in the past or future. You can use EOMONTH to calculate expiration dates, due dates, and other dates that need to land on the last day of a month. The EOMONTH function takes two arguments: start_date and months. Start_date must be a valid Excel date. The months argument specifies how many months in the future or past to move – use a positive number to move forward in time, and a negative number to move back in time.

EOMONTH returns a serial number corresponding to an Excel date. To display the result as a date, apply a number format of your choice.

Note: The EOMONTH function returns the last day of the month n months in the past or future. The EDATE function returns the same day of the month n months in the past or future.

Example #1 - Basic usage

With May 12, 2017 in cell B5:

=EOMONTH(B5,0) // returns May 31, 2017
=EOMONTH(B5,4) // returns Sep 30, 2017
=EOMONTH(B5,-3) // returns Feb 28, 2017

You can use EOMONTH to move through years as well:

=EOMONTH(B5,12) // returns May 31, 2018
=EOMONTH(B5,36) // returns May 31, 2020
=EOMONTH(B5,-24) // returns May 31, 2015

Example #2 - last day of current month

To get the last day of the current month, combine the TODAY function with EOMONTH like this:

=EOMONTH(TODAY(),0) // last day of current month

The TODAY function returns the current date to the EOMONTH function. EOMONTH, with zero (0) for months, uses the current date to calculate the last day of the current month.

Example #3 - First day of current month

Although EOMONTH returns the last day of the month, you can use EOMONTH to get the first day month of the current month like this:

=EOMONTH(TODAY(),-1)+1 // first day of current month

See links below for more examples of how to use the EOMONTH function in formulas.

Notes

  1. For months, use a positive number for future dates and a negative number for past dates.
  2. EOMONTH will return the  #VALUE error if the start date is not a valid date.
  3. If the start date has a fractional time attached, it will be removed.
  4. If the months argument contains a decimal value, it will be removed.
  5. To move any date n months into the future or past, see the EDATE function.
  6. EOMONTH returns a date serial number, which must be formatted as a date.
Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.