Friday, May 18, 2012

EXCEL - End of Month Date


The last day of the month has four values, 31,30,29,28.

Before I learned end of month function EOMONTH() in Excel, I take one more step to get what I want.

I build the formula to get the first day of the following month and then subtract one day to get the last day of the target month.

For example,

In cell A1, the value = 1/26/2012

In cell A2, Formula=DATE(YEAR(A1),MONTH(A1)+1,1)-1

                   Result= 1/31/2012

EOMONTH() can do the job directly.

In cell A1, the value = 1/26/2012

In cell A2, Formula= EOMONTH(A1,0)

                   Result= 1/31/2012


© Copyright Exceltipsandkeys All Rights Reserved.


No comments:

Post a Comment