Search This Blog

Monday 14 January 2013

Get Last day of the month for any date

=EOMONTH(D1,0)

Use this formula to get the last day of the month for the date, D1 is the cell containing the date.

EOMONTH function is only available for Excel 2007 and above, to get last day of the month for older versions of Excel, use this:

=DATE(YEAR(D1),MONTH(D1)+1, 0)

Note:
The DATE function will return a date value when you enter in the year, month and day as inputs, what is magical about the DATE function is displayed in my example. I used 0 as the last input for day, this automatically returns the last day of the previous month,  notice I add one to month? :)







No comments:

Post a Comment