# Date Calculation in Excel

on
There is a purchase date column in a Excel. Is it possible to write a formula such that is the purchase date - today is more than 3 years. A message "out of warranty" will be displayed.

Tks
Comment
Watch Question

Do more with

EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
try this
``````=IF(A1<TODAY()-1095,"Out Of Warranty","In Warranty")
``````

Commented:
See attached
date.xlsx
Commented:
Assuming - A column is date of purchase.
``````=IF(AND(A2<TODAY()-1095,A2<>""),"Out Of Warranty","")
``````
this more refine if there is either column  A is blank or date is in warranty period returns to blank. else Out Of warranty

if you want to returns result if date is in warranty with In Warranty Period then use this
``````=IF(A2<>"",IF(A2<TODAY()-1095,"Out Of Warranty",""),"")
``````

Thanks
Most Valuable Expert 2011
Top Expert 2011
Commented:
Just FYI, you can also use DATEDIF:

=IF(DATEDIF(A1,TODAY(),"Y")>=3,"Out Of Warranty","In Warranty")
Chief Operations Manager

Commented:
It might be safer to use 1096 to take account of possible leap years
or use Rory Archibald's formula.

Commented:
I am on my way back to home so can't help it now. Surly assist you after 2 hours to how to tackle leap year.

Thanks