DATEDIF
The DATEDIF function calculates the difference between two dates in days, months, or years. It is useful for determining the duration between two dates in various date units.
Example explanation
This spreadsheet uses the DATEDIF function to calculate the number of days between two dates in cell D3 and the number of years since a birth date in cell B7.
Syntax 🔗
=DATEDIF(start_date
, end_date
, unit
)
start_date | The starting date from which to calculate the difference. |
end_date | The ending date up to which to calculate the difference. |
unit | The unit of measure for the difference: 'd' for days, 'm' for months, or 'y' for years. |
About DATEDIF 🔗
Use the DATEDIF function in Excel to calculate the number of days, months, or years between two dates. This function is helpful for project timelines, age calculations, or any situation where you need to find the difference between dates. Input the start date, end date, and specify the unit of time (days, months, or years) to get the result.
Examples 🔗
Calculate the number of days between January 1, 2022, and June 30, 2022: =DATEDIF("01/01/2022", "06/30/2022", "d")
Determine the number of months between September 15, 2020, and June 10, 2021: =DATEDIF("09/15/2020", "06/10/2021", "m")
Find out the age in years between July 20, 1985, and the current date: =DATEDIF("07/20/1985", TODAY(), "y")
Notes 🔗
The DATEDIF function doesn't appear in the Excel functions list, but you can type it directly into a cell. Remember, the 'unit' parameter is case-sensitive: use 'd' for days, 'm' for months, and 'y' for years.
Questions 🔗
No, the DATEDIF function is a hidden function in Excel, so it doesn't show up in the regular list of functions. However, you can still use it by typing it directly into a cell.
What happens if the 'start_date' is after the 'end_date' in the DATEDIF function?If the 'start_date' is later than the 'end_date', the DATEDIF function will return a negative value, indicating the difference is a negative duration.
Can I use cell references for the 'start_date' and 'end_date' in the DATEDIF function?Yes, you can use cell references that contain date values for the 'start_date' and 'end_date' parameters in the DATEDIF function, making it dynamic and adaptable to changing dates.