The DATEDIF Function in Excel is used to calculate the number of days, months, or years between two dates. A common error is to use “=dateif” instead of “=datedif.” This can come in handy if you need to determine how long a certain project has taken or if you bill by active days. You can use this formula as a base for other calculations.
Let’s start with the formula.
=DATEDIF(start_date,end_date,unit)
=DATEDIF(start_date,end_date,unit)
The start date and end date are self-explanatory. However, it is important to understand how to define a unit. Please refer to the table below.
Unit | Return |
“Y” | The number of complete years |
“M” | The number of complete months |
“D” | The number of Days in a period |
“MD” | The difference between the start date and end date in days. Months and years are ignored |
“YM” | Displays the difference between the months in start date and end date. Days and years are ignored. |
“YD” | The difference between days of start date and end date. Years are ignored. |
In the example below, we show how the Unit is used to change the calculation between dates.