Formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top