DATEDIF () function (calculate the total number of years, total months or total days from two given periods) in Excel
Processing and calculating data with data is time (type date) very difficult because you can not use normal calculations. But the DATEDIF () function will help you do this, the function will help you calculate the data of the format of time in Excel.
The article describes the syntax and usage of the DATEDIF () function in Excel.
Description
The DATEDIF () function helps you calculate the total number of years, the total number of months, or the total number of days from two given periods.
You can use this function from Excel 2003 and newer versions, the DATEDIF () function is not in the list of Excel functions, so when you enter = DATEDIF, the function is not displayed in the Excel function list.
Syntax
= DATEDIF (start_day, end_day, unit)
Inside:
- start_day: start date to calculate.
- end_day: end date, end_day needs to be bigger than start_day.
- unit: type of result returned by the calculation, to be written in quotation marks.
Below is a list of unit options.
y: the number of years the difference between start_day and end_day.
m: number of months difference between start_day and end_day.
d: number of days difference between start_day and end_day.
md: the number of days difference between start_day and end_day, regardless of the number of years and months.
ym: the number of months difference between start_day and end_day, regardless of the number of years and days.
yd: number of days difference between start_day and end_day, regardless of the number of years.
For example
Example 1: Use the DATEDIF function to calculate the age of employees.
Apply the function to the last employee: = DATEDIF (D11, NOW (), "y")
- D11: is the start date (year of birth).
- NOW () is a function to get the current date of the computer.
- y to determine the return value is the difference between the current year and the year of birth.
The following results:
Example 2: For start_day is February 1, 2013 and end_day is December 28, 2014, applying all unit options will result in the following:
So you know how to use the DATEDIF () function in Excel. With the support of the DATEDIF () function, the processing of date data calculations will be a lot easier. Good luck!
You should read it
- Calculate the total value of the filtered list in Excel
- DATEDIF function - The function calculates the number of days, months, years between 2 dates in Excel
- How to calculate the number of days in Excel
- How to calculate the total value based on multiple conditions in Excel
- SUM function in Excel: How to use SUM to calculate totals in Excel - SUM function in Excel
- How to quickly see the total number of pages of Word files?
- Download 360 Total Security 10.8.0.1269: Free antivirus software for Windows
- How to subtract dates, months, and years in Excel - Calculate the distance between two dates in Excel
- DAYS function, how to use the function to calculate the number of days between two time points in Excel
- Practical exercise on computer rental list in Excel
- How to use DSUM function in Excel
- Try Bitdefender Total Security 2012 for 90 days
Maybe you are interested
Difference between function and formula in Excel
8 little-known Excel functions that can save you a lot of work
How to use the NORMDIST function in Excel - Function that returns the distribution in Excel
Date functions in Excel, DAY, WEEKDAY, MONTH
How to use the SUMIF function in Excel to calculate the sum based on conditions
How to use the Round function in Excel to round numbers and process data