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
- 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
May be interested
- DMAX () function (returns conditional maximum value) in Exceldmax () is the function that returns the maximum value in a column in a list or database that satisfies the condition that you give.
- DMIN () function (returns the minimum value by condition) in Exceldmin () function helps you find and return the smallest value in a column in a list or database that meets the conditions that you give.
- AVERAGEIF function (returns the average value according to the condition) in Excelthe averageif () function returns the average value of all selected cells that meet the conditions you specify.
- COUNTBLANK function - Count the number of blank (empty) cells in a selected range or array in Excelthe countblank () function helps to count the number of blank (empty) cells in a selected range or array in excel.
- DPRODUCT function in Excelthe dproduct () function returns the value of the multiplication of values in a column of a list or database under a specified condition.
- Syntax and description of search and reference functions in Excelthe following article summarizes the syntax and description of the search and reference functions in excel.