# Get last day of month

=EOMONTH(date,0)

To calculate the last day of a month based on a given date, you can use the EOMONTH function. In the example shown, the formula in cell B5 is:

=EOMONTH(B5,0)

The 2nd argument (*months*) of the EOMONTH function allows you to get the last day of the month in future or past months. When you use zero for months, EOMONTH will return the last day of the month in the same month.

To get the last day of the prior month, use:

=EOMONTH(date,-1)

To get the last day of the next month, use:

=EOMONTH(date,1)

### Alternative formula

You can also write a formula using the DATE, YEAR and MONTH functions to return the last day of the month:

The trick with this formula is supplying zero for the day. When you supply zero as the day argument to DATE, the date function will "roll back" one day to the last day of the previous month. So, by adding 1 to the month, and using zero for day, DATE returns the last day of the "original" month.

Although EOMONTH is a more convenient function, it won't accept a range of dates in an array formula. In that case, you can use the alternative above.

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

## Download 200+ Excel Shortcuts

Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.