HomeGoogle DocsSpreadsheetAGE_CALC - A Named Function to Calculate Age or Duration in Google...

AGE_CALC – A Named Function to Calculate Age or Duration in Google Sheets

Published on

The purpose of the AGE_CALC Named Function is to return age in years, months, and days from a birth date to another date in Google Sheets.

The output will be like x years, x months, x days. If you want, you can split them into separate cells.

Moreover, AGE_CALC is an array function. So, you can convert a set of dates of birth to age in a flash.

The function takes two arguments, a starting date (date of birth) and an end date (today’s date or some other date).

So you can use the same function to get task duration in the above format.

We have a formula-based solution to get the same output – Google Sheets: Formula to Calculate Age from Birthday. But this function is easy to use and also more customized.

For example, when the formula returns “0 Years 5 months & 6 days,” the function returns “5 months, 6 days.”

Syntax and Arguments of the AGE_CALC Named Function in Google Sheets

Syntax:

AGE_CALC(dob, end_date)

Arguments:

dob – The cell or array contains the date of birth/start date.

end_date – The cell or array contains the date representing when the observation’s age is of interest.

Here, you can hardcode today() within the formula if you want to return the age based on today’s date.

Now, let’s see how to calculate age from birth date using the AGE_CALC Named Function in Google Sheets.

Examples to Calculate Age From Birth Date Using the AGE_CALC Function

Non-Array Formula

Example # 1: Age Based on Today’s Date.

=AGE_CALC(date(2002,5,10),today())

In the above example, the dob is 10th June 2002, and the end_date is today’s date.

You can also use =AGE_CALC("10/05/2002",today()). But, the dob must be as per the date format in your Sheets.

Example # 2: Age Based on a Particular Date.

=AGE_CALC(date(2002,5,10),date(2022,11,14))

Here the AGE_CALC Named Function will return the age 20 years, 6 months, 4 days. The alternative formula is =AGE_CALC("10/05/2002","14/11/2022").

In all the above formulas, you can use cell references. Please see the examples below.

AGE_CALC - Age from Date of Birth

AGE_CALC Array Formula to Calculate Age or Duration

When you want to calculate the age from a set of dates of birth, you can use the AGE_CALC Named Function in the following way.

Assume the dob is in A2:A and the end_date is in B2:B.

Insert the following AGE_CALC array formula in C2.

=AGE_CALC(A2:A,B2:B)

If you have only the dob in A2:A and want to use today() in end_date, you must additionally use an IF logical test and Array Formula to skip blank rows in the range.

=ArrayFormula(if(A2:A="",,AGE_CALC(A2:A,today())))
AGE_CALC Named Function - Array Formula

Needless to say, to calculate duration in x years, x months, and x days format, you just input the start date in dob and end date in end_date.

What about splitting the result into three columns, one each for years, months, and days?

If you follow my last example in cell B2 (see the image above), use the following SPLIT in cell C2.

=ArrayFormula(iferror(trim(split(B2:B,","))))

Importing AGE_CALC Function

To use the above custom Named Function, you must first import it to your Sheet.

To import, make a copy of my sample Sheet below.

Sample Sheet 141122

Then select Data > Named Function from within your Sheet. On the sidebar panel, select “Import function.”

Follow the onscreen instructions, and voila!

If you have any queries regarding using my AGE_CALC Named Function and calculating age from the birth date, please feel free to ask me in the comments below.

You May Like: How to Create Named Functions in Google Sheets.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.