Solved

Get the Age of a person in Excel formula

Posted on 2002-06-07
10
334 Views
Last Modified: 2012-06-27

  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
 
0
Comment
Question by:LenkaL
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 5

Expert Comment

by:nfroio
ID: 7063530
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
 
LVL 6

Expert Comment

by:blakeh1
ID: 7063562
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
 
LVL 6

Expert Comment

by:blakeh1
ID: 7063571
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
 
LVL 6

Accepted Solution

by:
blakeh1 earned 50 total points
ID: 7063576
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
 
LVL 15

Expert Comment

by:dbase118
ID: 7063693
Dont know about elegant but it works

=ROUNDDOWN((B1-A1)/365.25,0)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:lstaple
ID: 7064611
This seems to work in C1:

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

Hope this helps!
0
 
LVL 13

Expert Comment

by:WJReid
ID: 7065145
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 Comment

by:LenkaL
ID: 7067899
Thanks guys,
 Lots of interesting formulas, but like blakeh's so far.
 Do you now if DATEDIF is available in Office 2000?
0
 
LVL 13

Expert Comment

by:WJReid
ID: 7068364
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 Comment

by:LenkaL
ID: 7073934

 Thanks,
 LenkaL.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Printing calendar search results in Outlook 2010. 1 53
OneDrive for Office 365 Users 2 58
Excel VB Help 4 48
Office 365 vs. In-House 4 80
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now