Welcome toExcel.Tips.Net
Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Learn Access Now
Free Printable Forms
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site
Adding a Little Animation to Your Life
Converting a Range of URLs to Hyperlinks
Making the Formula Bar Persistent
Many times in early childhood education, a child's age in Years.Months format is needed for reporting, admitting, and evaluation. Basically, this format shows the number of elapsed years and months since birth, separated by a period.
There are several ways you can go about getting the desired age. The formula you choose to do the work depends, quite literally, on your preference in formulas.
Assuming that you have the birth date in cell A1, you might think you could use some math on the date to determine the proper information. For instance, you might think that you could use this formula:
=NOW() - A1
This produces a value that is the difference between the two dates, but if you then apply a custom format ("yy.mm") to the result, you'll find out that it doesn't give the sought-after Years.Months. You get something close; the years are right, but the months vary from 1 to 12 when they should vary from 0 to 11. (Somebody can be 12 years and 0 months old, but it is not proper to say 12 years and 12 months old.)
This means that you need to start casting about for a formulaic approach. A simple formula would be the following:
=YEAR(NOW())-YEAR(A1) & "." & MONTH(NOW())-MONTH(A1)
There are many variations on the above, but the problem is that they all only look at the month of today compared to the month of the birthdate; they don't take the day of the month into account. What is that important? Because the number of elapsed months since birth is dependent on how the day of the birth month compares to the day of the present month, and the formula doesn't allow for that distinction.
So, you might consider a more complex formula that actually tries to calculate elapsed years and months, such as the following one:
=TEXT(INT((NOW() – A1)/365.25),"##0")&"."&TEXT(INT(MOD(NOW – A1,365.25)/31),"00")
This comes much closer to what is needed, but it is still possible to be off by a day or two right around the time of the month when the birth day is approached. Closer still is a formula which uses the YEARFRAC function:
=ROUNDDOWN(YEARFRAC(A1,TODAY()),0)&"."&ROUNDDOWN((YEARFRAC(A1,TODAY())-ROUNDDOWN(YEARFRAC(A1,TODAY()),0))*12,0)
The best (and simplest) formulaic approach, however, is this one:
=DATEDIF(A1,NOW(),"y") & "." & DATEDIF(A1,NOW(),"ym")
The formula relies on the DATEDIF function, which determines the difference between two dates. The value returned by the function depends on the third parameter passed to the function. In this case, the first invocation of DATEDIF returns the number of elapsed years and the second returns the number of elapsed months. It provides the most accurate results of any of the formulas discussed so far.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3230) applies to Microsoft Excel versions: 97 2000 2002 2003 2007
Remove Some Stress at Tax Time! Doing your personal income taxes can be a royal pain. Why not make the process just a bit less stressful with our 101-question checklist. You can prepare for filing your taxes with confidence, knowing you've covered all your bases.