Of birth, between two dates, and more How to calculate age ...

9/24/2020

Oct

19

How to calculate age in Excel from birthday

How to calculate age in Excel: from date of birth, between two dates, and more

by Svetlana Cheusheva | updated on September 24, 2020

86 Comments

The tutorial shows different ways to get age from birthday in Excel. You will learn a handful of formulas to calculate age as a number of complete years, get exact age in years, months and days at today's date or a particular date.

There is no special function to calculate age in Excel, however there exist a few different ways to convert date of birth to age. This tutorial will explain the advantages and drawbacks of each way, shows how to make a perfect age calculation formula in Excel and tweak it for solving some specific tasks.

How to calculate age from date of birth in Excel Calculate age as the number of full years Get age from birth date in years, months, and days

More examples of age formula in Excel Calculate age on a specific date Get age in a certain year Compute when a person attains N years of age Get age from day, month and year in different cells

Age calculator in Excel How to create an age calculator in Excel Ready-to-use age calculator for Excel

Highlight ages under or over a particular age

How to calculate age from date of birth in Excel

In everyday life, the question "How old are you?" usually implies an answer indicating how many years you have been alive. In Microsoft Excel, you can make a formula to compute an exact age in months, days, hours and even minutes. But let's be traditional, and learn how to calculate age from DOB in years first.

Basic Excel formula for age in years

How do you normally figure out someone's age? Simply by subtracting the birth date from the current date. This conventional age formula can also be used in Excel.



1/17

9/24/2020

How to calculate age in Excel from birthday

Assuming a birthdate is in cell B2, the formula to calculate age in years goes as follows:

=(TODAY()-B2)/365

The first part of the formula (TODAY()-B2) returns the difference between the current date and date of birth is days, and then you divide that number by 365 to get the numbers of years.

The formula is obvious and easy-to-remember, however, there is a tiny problem. In most cases, it returns a decimal number as demonstrated in the screenshot below.

To display the number of complete years, use the INT function to round a decimal down to the nearest integer: =INT((TODAY()-B2)/365)

Drawbacks: Using this age formula in Excel produces pretty accurate results, but not flawless. Dividing by the average number of days in a year works fine most of the time, but sometimes it gets the age wrong. For example, if someone was born on February 29 and today is February 28, the formula will make a person one day older.

As an alternative, you can divide by 365.25 instead of 365 since every fourth year has 366 days. However, this approach is not perfect either. For example, if you are calculating the age of a child who hasn't yet lived through a leap year, dividing by 365.25 produces a wrong result.

Overall, subtracting the birth date from the current date works great in normal life, but is not the ideal approach in Excel. Further on in this tutorial, you will learn a couple of special functions that calculate age faultlessly regardless of the year.

Calculate age from date of birth with YEARFRAC function



2/17

9/24/2020

How to calculate age in Excel from birthday

A more reliable way to convert DOB to age in Excel is using the YEARFRAC function that returns the fraction of the year, i.e. the number of whole days between two dates.

The syntax of the YEARFRAC function is as follows:

YEARFRAC(start_date, end_date, [basis])

The first two arguments are obvious and hardly require any additional explanation. Basis is an optional argument that defines the day count basis to use. To make a perfectly true age formula, supply the following values to the YEARFRAC function:

Start_date - date of birth. End_date - TODAY() function to return the today's date. Basis - use basis 1 that tells Excel to divide the actual number of days per month by the actual number of days per year. Considering the above, an Excel formula to calculate age from date of birth is as follows:

YEARFRAC(date of birth, TODAY(), 1)

Assuming the birthdate is in cell B2, the formula takes the following shape: =YEARFRAC(B2, TODAY(), 1)

Like in the previous example, the result of the YEARFRAC function is also a decimal number. To fix this, use the ROUNDDOWN function with 0 in the last argument because you don't want any decimal places.

So, here's an improved YEARFRAC formula to calculate age in Excel:



3/17

9/24/2020

How to calculate age in Excel from birthday

=ROUNDDOWN(YEARFRAC(B2, TODAY(), 1), 0)

Calculate age in Excel with DATEDIF

One more way to convert date of birth to age in Excel is using the DATEDIF function:

DATEDIF(start_date, end_date, unit)

This function can return the difference between two dates in various time units such as years, months and days, depending on the value you supply in the unit argument:

Y - returns the number of complete years between the start and end dates. M - returns the number of complete months between the dates. D - returns the number of days between the two dates. YM - returns months, ignoring days and years. MD - returns the difference in days, ignoring months and years. YD - returns the difference in days, ignoring years. Since we aim to calculate age in years, we are using the "y" unit:

DATEDIF(date of birth, TODAY(), "y")

In this example, the DOB is in cell B2, and you reference this cell in your age formula:



4/17

9/24/2020

=DATEDIF(B2, TODAY(), "y")

How to calculate age in Excel from birthday

No additional rounding function is needed in this case because a DATEDIF formula with the "y" unit calculates the number of full years:

How to get age from birthday in years, months and days

As you have just seen, calculating age as the number of full years that the person has lived is easy, but it is not always sufficient. If you want to know the exact age, i.e. how many years, months and days there are between someone's birth date and the current date, write 3 different DATEDIF functions:

1. To get the number of years: =DATEDIF(B2, TODAY(), "Y") 2. To get the number of months: =DATEDIF(B2, TODAY(), "YM") 3. To get the number of days: =DATEDIF(B2,TODAY(),"MD")

Where B2 is the date of birth.

And then, concatenate the above functions in a single formula, like this:

=DATEDIF(B2,TODAY(),"Y") & DATEDIF(B2,TODAY(),"YM") & DATEDIF(B2,TODAY(),"MD")

The above formula returns 3 numbers (years, months, and days) concatenated in a single text string, as shown in the screenshot below:



5/17

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download