Use the DATEDIF function to calculate the ages of employees using Microsoft Excel
DATEDIF(start_date, end_date, format)
start_date: The start date.
end_date: The end date.
To calculate the ages of employees:
1. In column A list the names of employees.
2. In column B enter their birthdays.
3. Select cells C2:C10 and type the formula TODAY().
4. Press <-Ctrl+Enter->.
5. Select cells D2:D10 and type the following formula:
=DATEDIF(B2,C2,"Y") & " years and " & DATEDIF(B2,C2,"YM") & " months".
6. Press <-Ctrl+Enter->.
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:
1. In column A list the names of employees.
2. In column B enter their birthdays.
3. Select cells C2:C10 and type the formula TODAY().
4. Press <-Ctrl+Enter->.
5. Select cells D2:D10 and type the following formula:
=DATEDIF(B2,C2,"Y") & " years and " & DATEDIF(B2,C2,"YM") & " months".
6. Press <-Ctrl+Enter->.
Use the DATEDIF function to calculate the ages of employees |
No comments:
Post a Comment