In this Article
This tutorial demonstrates how to use the Excel DATEDIF Function in Excel to count the number of days, months, or years between dates.
DATEDIF Function Overview
The DATEDIF Function Returns the number of days, months or years between two dates.
To use the DATEDIF Excel Worksheet Function, Select cell and Type:
1 |
=DATEDIF( |
(Unlike most Excel Functions, the DATEDIF inputs do not appear when you start typing the function)
DATEDIF Function syntax and Inputs:
1 |
=DATEDIF(start_date, end_date, unit) |
start_date – The start date in Excel serial number format. Example: You can not enter 11/12/2015 directly into the cell. Instead you would need to use the corresponding serial number: 42320. Alternatively, you can reference a cell with the date 11/12/2015 entered. Excel automatically converts dates stored in cells into serial format (unless the date is entered as text).
end_date – The end date in Excel serial number format. Example: You can not enter 11/12/2015 directly into the cell. Instead you would need to use the corresponding serial number: 42320. Alternatively, you can reference a cell with the date 11/12/2015 entered. Excel automatically converts dates stored in cells into serial format (unless the date is entered as text).
unit – The time unit to use. Enter “Y”
DATEDIF Units
The DATEDIF Function can return the difference between two dates with various units:
Let’s look at some examples below.
Count Days Between Dates
To count the numbers of days between dates you can use the DATEDIF Function:
1 |
=DATEDIF(B3,C3,"d") |
You can also simply subtract the dates to find the difference in days between the dates.
1 |
=C3-B3 |
<<Note for steve: link to article>>
Count Workdays Between Dates
To find the number of workdays between dates, use the NETWORKDAYS Function:
1 |
=NETWORKDAYS(B3,C3) |
Number Weeks Between Dates
Instead of days, you can count weeks by dividing dates by 07.
<<Note for steve: From Indika – “w” Not working so I am using Date/7 >>
1 |
=DATEDIF(B3,C3,"d")/7 |
Date Difference in Months
Or months by setting the units to “m”:
1 |
=DATEDIF(B3,C3,"m") |
Count Years Between Dates
Or years with “y”:
1 |
=DATEDIF(B3,C3,"Y") |
DATEDIF in Google Sheets
The DATEDIF Function works exactly the same in Google Sheets as in Excel: