Get instant live expert help with Excel or Google Sheets
“My Excelchat expert helped me in less than 20 minutes, saving me what would have been 5 hours of work!”

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.

Get last day of month

While working with Excel, we are able to determine the last day of the month of any future or past date by using the EOMONTH function.  This function is especially useful when determining maturity or due dates.  This tutorial will assist all levels of Excel users in getting the last day of the month for any specified date.  

Figure 1.  Final result: Get last day of month

Syntax of EOMONTH Function

EOMONTH adds or subtracts a certain number of months before or after a specified date and returns a date falling on the last day of the month

=EOMONTH(start_date, months)

  • start_date – a date representing the start date; can be a date enclosed in quotation marks or a cell reference  
  • months – the number of months either before or after the start date; a positive value results to a future date while a negative value results to a past date  
  • If months is not an integer, the truncated value is used by the function
  • The date must be between January 1, 1900 and December 31, 9999
  • If start_date is not a valid date, EOMONTH returns the #VALUE! error

Setting up our Data

Our table contains three columns: Start Date (column B), Months (column C) and Last day of month (column D).  We want to add or subtract the number of months in column C from the start date in column B and return the last day of the month of the resulting date.  The results will be recorded in column D.

Figure 2.  Sample data to get last day of month

Determine last day of month using EOMONTH

We want to determine the last day of the month resulting from the start date and given number of months by using the EOMONTH function.  Let us follow these steps:

Step 1.  Select cell D3

Step 2.  Enter the formula: =EOMONTH(B3,C3)  

Step 3.  Press ENTER

Step 4:  Copy the formula in cell D3 to cells D4:D10 by clicking the “+” icon at the bottom-right corner of cell D3 and dragging it down

For our first example in row 3, the number of months is zero “0”.  Hence, the EOMONTH function returns the same month as the start date, but falling on the last day.  As a result, the value in D3 is “1/31/2019”.  

In row 4, the start date is 1/31/2019, which is already the last day of January.  Setting the number of months to zero “0” yields the same result as the start date.  The result in cell D4 is also “1/31/2019”.  

Figure 3.  Getting last day of the same month using EOMONTH function

In row 5, the number of months is “1” and adding one month to January yields February.  Hence, the last day of month resulting from the EOMONTH function is “2/28/2019”, which is the last day of February 2019.  

Figure 4.  Getting last day of month for future dates using EOMONTH function

For our next example, the number of months is 1.5, which is not an integer.  EOMONTH truncates this value and interprets the number of months as 1. As a result, the date in cell D6 is “2/28/2019”, which is one month from our start date, and falling on the last day of the month of February.  

Figure 5.  EOMONTH truncates non-integer values for months

We can also determine the last day of month for past dates by using the EOMONTH function with negative values for the number of months, as shown in the next example.  The value -3 means three months before the start date. Finally, our formula returns “11/30/2018” in cell D8, which falls on the last day of November in the previous year 2018.    

Figure 6.  Getting last day of month for past dates using EOMONTH function

Note

The EOMONTH function returns the error #VALUE! when the start date is invalid.  In cell B9, the date “2/29/2019” is not valid because it does not exist. The last day of the month of February in 2019 is 28, not 29.  

Cell B10 containing “3/14/1888”  is also invalid because the EOMONTH function only allows dates between January 1, 1900 and December 31, 9999.  

Figure 7.  EOMONTH returns an error for invalid start dates

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Solution examples
I need a formula that has these 2 rules. If letter was rec'd between 1st and 15th = 1st of the month following letter rec'd date. If letter was rec'd between 16thst and end of the month= 1st of the 2nd month following letter rec'd date.
Solved by V. F. in 20 mins
I need a column to total (Hours)(85) + (Travel)(.55) per line
Solved by F. Q. in 20 mins
Trying to figure out what is wrong with my formula in Oct-ZD tab in column AY and BG.
Solved by O. Q. in 8 mins
So I have used vlookup to find the price of a product on a different sheet and then I have tried to times that by a quantity. e.g. =vlookup(d4,table35,2,false)*e4 This is the formula I typed in which worked for another list I did but for some reason it's not working now even though everything is practically the same, apart from the contents. Could you help?
Solved by B. U. in 60 mins
I have a column containing date and time data together and i need to isolate the time data. When I tried to use text to column, it changed all the times to AM. There is an extremely large amount of data - over 550,000 rows so manually changing it won't work. The file is too large to attach.
Solved by S. E. in 40 mins

Leave a Comment

avatar

Subscribe to Excelchat.co

Get updates on helpful Excel topics

Subscribe to Excelchat.co

Did this post not answer your question?
Get a solution from connecting with the expert

Another blog reader asked this question today on Excelchat:

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
Trusted by people who work at
Amazon.com, Inc
Facebook, Inc
Accenture PLC
Siemens AG
Macy's
The Allstate Corporation
United Parcel Service
Dell Inc