How to Use the DATEDIF function to calculate the ages of employees
To calculate the exact age of employees, use the undocumented DATEDIF function from the Analysis ToolPak add-in. This function calculates the exact number of years, months, and days between two dates. The syntax is:
DATEDIF(start_date, end_date, format)
start_date: The start date.
end_date: The end date.
format: Indicates the format to use. “y” gives the difference in years; “m” in months; “d” in days; “ym” the difference in months, ignoring the year; “yd” in days, ignoring the year; and “md” in days, ignoring the month and year.
To calculate the ages of employees:
- In column A list the names of employees.
- In column B enter their birthdays.
- Select cells C2:C10 and type the formula TODAY().
- Press Ctrl+Enter.
- Select cells D2:D10 and type the following formula:
=DATEDIF(B2,C2,”Y”) & ” years and ” & DATEDIF(B2,C2,”YM”) & ” months”. - Press Ctrl+Enter.
- How to Use the YEARFRAC function to calculate employees ages
- Use the DAYS360 function to calculate with a 360-day year
- How to Calculate the number of employees needed for a project
- How to use the WORKDAY function to calculate workdays in Excel
- How to add months to a date using the DATE Function in Excel
