Formula

P

Phxlatinoboi®

I have a speadsheet that I enter the Date of Hire of an employee. I would
like to have a formula that will calculate in a cell when someone would be
with the company for 4 months.

for example

A1 B1
04/01/07 08/01/07
 
J

joeu2004

I have a speadsheet that I enter the Date of Hire of an employee. I would
like to have a formula that will calculate in a cell when someone would be
with the company for 4 months.

for example

A1 B1
04/01/07 08/01/07

Ostensibly:

=date(year(A1), 4+month(A1), day(A1))

But I wonder if you would be happier with:

=date(year(A1), 4+month(A1),
day(if(day(A1)>day(eomonth(A1,4)), eomonth(A1,4), A1)))

Try both with 10/30/2006 in A1 and decide which you prefer.

Note: If you get a #NAME error, look at the Help page for EOMONTH.
 
J

joeu2004

improvement....

But I wonder if you would be happier with:
=date(year(A1), 4+month(A1),
day(if(day(A1)>day(eomonth(A1,4)), eomonth(A1,4), A1)))

Arguably better (but equivalent):

=if(day(A1)>day(eomonth(A1,4)), eomonth(A1,4),
date(year(A1), 4+month(A1), day(A1)))

Be sure to format B1 as Date.
 
T

Teethless mama

The formula below required Analysis ToolPak Add-Ins

=EDATE(A1,4)

Format cell as date
 
Top