filmov
tv
Google Sheets DATEDIF Function | Calculate Age in Years, Months, and Days | TODAY Function

Показать описание
Use the Google Sheets DATEDIF function to calculate, for example, a person's age or an investment's age in years, months, and days. The Y, YM, and MD are the three attributes of DATEDIF that assists to accomplish the task. The attributes M and D of DATEDIF helps to calculate absolute months and days respectively between two dates.
===========================================
Tutorial
How to Use TODAY and DATEDIF Functions?
Tutorial
How to use the Y, M, and D attributes of DATEDIF Function?
===========================================
Here is the format of the DATEDIF function formula:
=DATEDIF(start_date, end_date, unit)
Start the formula with an equal-to symbol.
DATEDIF is the name of the formula.
start_date is the first date of the date range.
end_date is the last date of the date range.
unit equals any one of the following values: Y, M, D, YM, MD or YD. For info on Y, M, D, and YD, please refer to the tutorial titled How to Use TODAY and DATEDIF in Google Sheets. The link to the tutorial is given above.
Y, use it to get the time in whole years between the start date and end date.
YM, use it to get the whole months from fractional years between the start date and end date.
MD, use it to get the days from fractional months between the start date and end date.
Let's look at an example of using DATEDIF with the Y, YM, and MD attribtes:
Say you want to calculate the current age of a person, relative to his or her birthday, in years, months, and days.
Assume that date of birth of a person is 05/07/1990, which will be the start date, and today's date is 04/20/2021, which will be the end date. Note that you can use the TODAY function to get the current date. Of course, you can you use any other date, greater than the start date, as the end date.
Let's plug these values in the DATEDIF function formula:
=DATEDIF("05/07/1990", "04/21/2021", "Y")
The above function returns 30 as the age in years.
The formula
=DATEDIF("05/07/1990", "04/21/2021", "YM")
returns 11 as the whole months from the fractional year.
The formula
=DATEDIF("05/07/1990", "04/21/2021", "MD")
returns 14 as the days from the fractional month.
So, the person's age is 30 years, 11 months, and 14 days.
Checkout this video tutorial, which gives the steps to use the Google Sheets DATEDIF function to calculate a person's age in years, months, and days, using the Y, YM, and MD attributes. This tutorial uses the TODAY function to calculate the current date, which is the value for the end_date attribute.
===========================================
Tutorial
How to Use TODAY and DATEDIF Functions?
Tutorial
How to use the Y, M, and D attributes of DATEDIF Function?
===========================================
Here is the format of the DATEDIF function formula:
=DATEDIF(start_date, end_date, unit)
Start the formula with an equal-to symbol.
DATEDIF is the name of the formula.
start_date is the first date of the date range.
end_date is the last date of the date range.
unit equals any one of the following values: Y, M, D, YM, MD or YD. For info on Y, M, D, and YD, please refer to the tutorial titled How to Use TODAY and DATEDIF in Google Sheets. The link to the tutorial is given above.
Y, use it to get the time in whole years between the start date and end date.
YM, use it to get the whole months from fractional years between the start date and end date.
MD, use it to get the days from fractional months between the start date and end date.
Let's look at an example of using DATEDIF with the Y, YM, and MD attribtes:
Say you want to calculate the current age of a person, relative to his or her birthday, in years, months, and days.
Assume that date of birth of a person is 05/07/1990, which will be the start date, and today's date is 04/20/2021, which will be the end date. Note that you can use the TODAY function to get the current date. Of course, you can you use any other date, greater than the start date, as the end date.
Let's plug these values in the DATEDIF function formula:
=DATEDIF("05/07/1990", "04/21/2021", "Y")
The above function returns 30 as the age in years.
The formula
=DATEDIF("05/07/1990", "04/21/2021", "YM")
returns 11 as the whole months from the fractional year.
The formula
=DATEDIF("05/07/1990", "04/21/2021", "MD")
returns 14 as the days from the fractional month.
So, the person's age is 30 years, 11 months, and 14 days.
Checkout this video tutorial, which gives the steps to use the Google Sheets DATEDIF function to calculate a person's age in years, months, and days, using the Y, YM, and MD attributes. This tutorial uses the TODAY function to calculate the current date, which is the value for the end_date attribute.