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.

Hierarchical Numbering Sequences in Excel

Creating hierarchical numbering sequences in an Excel spreadsheet can significantly improve the way you...

How to Easily Repeat a Sequence of Numbers in Excel

Excel offers multiple ways to accomplish tasks, and the simplicity of each approach depends...

Create a Sequence of Dates at Every Nth Row in Excel (Dynamic Array)

Would you like to create a sequence of dates in every nth row in...

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

More like this

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

Limit Formula Expansion to a Specific Row in Google Sheets

In this tutorial, I’ll explain how to limit the expansion of an array formula...

3-D Referencing Structured Data Tables in Google Sheets

When you have several tables within a single sheet—not across multiple sheets in a...

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.