Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

formula for age

Posted on 2011-02-20
14
Medium Priority
?
630 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

718 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