# Get the Age of a person in Excel formula

Hello experts.

Here is a neat little task that I need:

I have a persons Date of birth 06/29/70.
And I have todays date, lets say 06/07/02.

I need a formula that would return an Integer
that shows a persons Age - in this case 32 years old.

So, in A1 - DOB, in B1 Today's Date, in C1 - Formula.

You can give me few ways of doing it if you wish.
The most elegant formula wins.

Thanks a lot,
LenkaL

###### Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x

Commented:
Note: you won't find the function in the Function wizard, or in the help file (at least in 97) as it is there for purposes of compatability with Lotus files

the syntax is

=DateDif(<<Start>>,<<End>>, <<Interval>>)

You can also use this as the interval to find month's, or day's

"m" - difference in months
"d" - difference in days
0

Commented:
Here is a link to a add-in program for excel that does exactly what you are looking to do:

http://www.j-walk.com/ss/excel/files/xdate.htm

=XDATEYEARDIF(xdate1,xdate2):
Returns the number of full years between two dates

0

Commented:
For Years
=IF(OR(A1>B1,A1=B1),0,IF((DATE(YEAR(A1)+1,MONTH(B1),DAY(B1))-A1)<365,YEAR(B1)-YEAR(A1)-1,YEAR(B1)-YEAR(A1)))
For Months
=IF(OR(A1>B1,A1=B1),0,IF(MONTH(A1)<MONTH(B1),MONTH(B1)-MONTH (A1),IF(MONTH(A1)>MONTH(B1),12+MONTH(B1)-MONTH(A1),0)))
For Days
=IF(OR(A1>B1,A1=B1),0,IF(DAY(A1)>DAY(B1),DATE(YEAR(A1), MONTH(A1)+1,DAY(B1))+1-A1,IF(DAY(A1)<DAY(B1),DATE(YEAR(A1),MONTH(A1),DAY(B1))-A1,0)))

To show all in one cell use

=IF(OR(A1>B1,A1=B1),0,IF((DATE(YEAR(A1)+1,MONTH(B1),DAY(B1))-A1)<365,YEAR(B1)-YEAR(A1)-1,YEAR(B1)-YEAR(A1))) & " years " & IF(OR(A1>B1,A1=B1),0,IF(DAY(A1)>DAY(B1),DATE(YEAR(A1), MONTH(A1)+1,DAY(B1))+1-A1,IF(DAY(A1)<DAY(B1),DATE(YEAR(A1),MONTH(A1),DAY(B1))-A1,0))) & " months " & IF(OR(A1>B1,A1=B1),0,IF(MONTH(A1)<MONTH(B1),MONTH(B1)-MONTH(A1),IF(MONTH(A1)>MONTH(B1),12+MONTH(B1)-MONTH(A1),0))) & " days"
0

Commented:
Sorry, I didn't realize you just needed the years. In that case you can use the built in (although undocumented) excel function

=DATEDIF(A1,B1,"y")
0

Commented:
Dont know about elegant but it works

=ROUNDDOWN((B1-A1)/365.25,0)
0

Commented:
This seems to work in C1:

=INT((A1-B1)/365) & " years old"

Hope this helps!
0

Commented:
Hi LenkaL,
I agree with blakeh1 on this and you do not nee the todays date colum if you modify the formula in C1 to the following:

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

Regards,

WJReid
0

Author Commented:
Thanks guys,
Lots of interesting formulas, but like blakeh's so far.
Do you now if DATEDIF is available in Office 2000?
0

Commented:
Hi Lenkal,

It may not show up on the list of functions, but if you just type it as shown above, it will work in Office 2000.

Regards,

WJReid
0

Author Commented:

Thanks,
LenkaL.
0