Full Version: Calculate a persons actual birthday
UtterAccess Discussion Forums > Microsoft® Office > Microsoft Excel
big0
Here is my formula:

=Year(A3)-Year(A2)

CELL A3 = 10/8/94
CELL A2 = 02/28/06

The answer I get is 12. The correct answer should be 11 yrs old.

Please assist

big0
freakazeud
Hi,
have a look at this detailed /Working_Out_a_Person's_Age_in_Microsoft_Excel/634.html]tutorial!
It should answer all your questions.
HTH
Good luck
fkegley
You're going to have to change your formula to take into account the month and day as well. Here's one way:

=IF(MONTH(A1)>MONTH(A2),YEAR(A1)-YEAR(A2),IF(MONTH(A1)<MONTH(A2),YEAR(A1)-(YEAR(A2)+1),IF(DAY(A1)>DAY(A2),YEAR(A1)-YEAR(A2),YEAR(A1)-(YEAR(A2)+1))))
dannyseager
or use this UDF

CODE
Public Function CalcAge(dtDOB As Date) As Integer
    CalcAge = DateDiff("yyyy", dtDOB, Date) + (Date < DateSerial(Year(Date), Month([dtDOB]), Day([dtDOB])))
End Function
big0
Thanks every one for a quick response.

It works

big0
KingMartin
Chip has a day-exact formula for calculating a person's age here:

http://www.cpearson.com/excel/datedif.htm

Martin
Luceze
You can also use the DATEDIF worksheet function.

=DATEDIF(A3,A2,"Y")

HTH,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.