Solved

formula for age

Posted on 2011-02-20
14
626 Views
Last Modified: 2012-05-11
How do you change a column containing the birthdate to the age of the person.
0
Comment
Question by:kvrogers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +2
14 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 34938440
=INT((TODAY()-E6)/365.25)
Or,
=DATEDIF(E6,TODAY(),"y")

Where E6 is the Date of birth.
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 34938451
Are you looking for something like this?

    [A]        [B]
[1] DOB	       Age
[2] 4/28/1968  =FLOOR(YEARFRAC(TODAY(),A2),1)

Open in new window

0
 

Author Comment

by:kvrogers
ID: 34938695
i used the formula:  =DATEDIF(E6,TODAY(),"y")

The date of birth for each person starts in B6 so I changed the formula to:
=DATEIF(B6,TODAY(),"y") but this is returning :  1/0/1900.  

Not sure what was wrong.
Do I replace the date of birth in a new column?
Do I replace the date of birth with the entry above?
Sorry, NOVICE for sure at this.  

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50

Expert Comment

by:barry houdini
ID: 34938727
1/0/1900 is actually just zero formatted as a date.

If you change the format of the cell with the formula to general do you see any ages? (obviously zero is a valid age, but only if the date in B6 is in the last year)

regards, barry
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 34938734
Does this example help?

regards, barry
26834720.xls
0
 
LVL 46

Expert Comment

by:aikimark
ID: 34939794
Be aware that the DateDiff() function only subtracts the year component of two dates.  This will not produce accurate AGE values, since it doesn't include a comparison of the month and day components.

AGE is a step function that increases on a person's birthdate anniversary.
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 34939898
The correct formula to calculate age is below (I revised the formula from my first post):

=FLOOR(YEARFRAC(A2,TODAY(),1),1)

Open in new window


More here:

How to Calculate a Person's Current Age in Microsoft Excel
http://www.brighthub.com/computing/windows-platform/articles/26696.aspx
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 34939899
Hello aikimark,

Note that the suggestion here from JimyX, followed up by me, is to use DATEDIF worksheet function which is not the same as DateDiff VBA function.

DATEDIF will accurately give an age in years as most people understand it, so if you use this formula today

=DATEDIF(DATE(1981,2,10),TODAY(),"y")

then that gives a result of 30 because Feb 10th has passed this year, but if the month is one later, i.e.

=DATEDIF(DATE(1981,3,10),TODAY(),"y")

That gives a result of 29 because we haven't yet reached 10th March

DATEDIF isn't very well documented, not in the function list and not in the help files for most Excel versions but Chip Pearson, MSMVP, describes how it functions here

regards, barry
0
 
LVL 46

Expert Comment

by:aikimark
ID: 34939938
Thanks for the link, Barry.  Pearson always writes deeply informative articles.

I guess my brain added the second "F" when I read DATEDIF().  That's my VB-centric experience at work -- only this time it worked against me.
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 34939965
Hello wdosanjos,

I think that using the formula

=FLOOR(YEARFRAC(A2,TODAY(),1),1)

will give the correct result in most circumstances but I still see some anomalies around birthdays, probably caused by leap years, for example, rather than a static TODAY() function if you use a variable date in place of that, i.e.

=FLOOR(YEARFRAC(A2,B2,1),1)

then if I use 12-Jun-1991 as the birthdate in A2 and "today's" date in B2 as 12-Jun-2011 then that formula gives me a result of 20, as expected because B2 is the date of 20th birthday....but if I change A2 to a year later, i.e. 12-Jun-1991 with b2 unchanged then I get 18 rather than 19 as I would expect.

regards, barry
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 34939985
@barryhoudini. Yes, you are correct.  DATEDIF is the better option in this case.
0
 

Author Comment

by:kvrogers
ID: 34942730
Barry:
I tried using your formula as =DATEDIF(B6,TODAY(),"y")  and used it exactly as your example, thanks for the example.  But this is the result I got.  See Attached

Kate
example.xlsx
0
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 34942828
You need to format the cell to show the age as a number. Right click at the cell where you inserted the formula select "Format cells..." and select the category "general" from the "Number" tab.
updated.xls
0
 

Author Comment

by:kvrogers
ID: 34943184
that worked.  Thank you very, very much.

Kate
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

623 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