Subtracting dates


Posted by Quang Tran on August 23, 2001 2:39 PM

I've done this before, but I can't seem to get it right this time. I would like to subtract 2 dates, such as today's date - birthdate to get the age. Thank you for any assistance.

Posted by Barrie Davidson on August 23, 2001 2:48 PM

Assuming the birthdate is in cell E1 and the second date is in cell E2, the following formula will give you age expressed as years, months, and days.

=IF(MONTH(E2)>=MONTH(E1),YEAR(E2)-YEAR(E1),YEAR(E2)-YEAR(E1)-1)&" years "&IF(MONTH(E2)-MONTH(E1)<0,MONTH(E2)-MONTH(E1)+12,MONTH(E2)-MONTH(E1))&" months "&DAY(E2)-DAY(E1)&" days"

Barrie

Posted by Aladin Akyurek on August 23, 2001 2:52 PM

=YEAR(TODAY())-YEAR(A1)

or

=DATEDIF(A1,TODAY(),"Y")

or, if too picky about it, use

=DATEDIF(A1,TODAY(),"y")&" years, "&DATEDIF(A1,TODAY(),"ym")&" months, "&DATEDIF(A1,TODAY(),"md")&" days"

Aladin



Posted by Quang Tran on August 23, 2001 3:03 PM

Thank you all for helping.