Microsoft Office Tutorials and References

In Depth Information

**Syntax**

if it is a leap year for 29 days or not a leap year for 28 days. The formula

to solve this was horrible:

=DATE(YEAR(A2),MONTH(A2),CHOOSE(MONTH(A2),31,28,31,30,31,30,31,31,30,31,30,31)

+IF(MOD(YEAR(A2),4)=0,1,0))

Well-known Excel guru Aladin Akyurek weighed in with the great answer and

ended the entire discussion. Aladin suggested using the DATE function to move

up to the first of the next month and then simply subtract 1 day, using this

formula:

=DATE(YEAR(A2),MONTH(A2)+1,1)-1

The sheer simplicity of this is beautiful. However, the whole question be-

comes immaterial now that EOMONTH has been promoted to be part of the ac-

tual Excel function set.

Syntax

=EOMONTH(start_date,months)

The EOMONTH function returns the serial number for the last day of the

month that is the indicated number of months before or after start_date. You

use EOMONTH to calculate maturity dates or due dates that fall on the

last day of the month. This function takes the following arguments:

Caution

You must format the result of the EOMONTH formula to be a date to

see the expected results.

•
start_date

start_date
—
This is a date that represents the starting date. Dates

may be entered as text strings within quotation marks (for example, "1/

30/2015", "2015/01/30"), as serial numbers, or as results of other

formulas or functions (for example, DATEVALUE("1/30/2015")). If

start_dateis not a valid date, EOMONTH returns a #NUM! error.