Using dates in IF statements

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

Guest

I need to create a statement with the following criteria and response.

Please help.

Thanks,

If 7/15/07 > 1/2/02 + 5 years, then 5, otherwise 3.33
 
Don't get it, Today's date will ALWAYS be greater than 2nd Jan 2007, because
that date has already passed.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
I need to create a statement with the following criteria and response.
Please help.
[....]
If 7/15/07 > 1/2/02 + 5 years, then 5, otherwise 3.33

Does this do what you want?

=if(today() > date(5+year(A1), month(A1), day(A1)), 5, 3.33)

where today() and A1 replace what you wrote as 7/15/07 and 1/2/02
respectively.

Note the difference between that and the following:

=if(datedif(A1, today(), "y") > 5, 5, 3.33)

You decide which meets your intentions better.
 
Works perfectly
Thanks much


joeu2004 said:
I need to create a statement with the following criteria and response.
Please help.
[....]
If 7/15/07 > 1/2/02 + 5 years, then 5, otherwise 3.33

Does this do what you want?

=if(today() > date(5+year(A1), month(A1), day(A1)), 5, 3.33)

where today() and A1 replace what you wrote as 7/15/07 and 1/2/02
respectively.

Note the difference between that and the following:

=if(datedif(A1, today(), "y") > 5, 5, 3.33)

You decide which meets your intentions better.
 
Back
Top