Thanks to Pearson Consulting and
The DATEDIF EXCEL function computes the difference between two dates in a
variety of different intervals, such number of years, months, or days. This function is available in all versions of Excel since at least version 5/95, but is documented in the help file only for Excel 2000. For some reason, Microsoft has decided not to document this function in any other versions.
By the way, do not confuse the DATEDIF worksheet function with the DateDiff VBA function.
Syntax
=DATEDIF(Date1, Date2, Interval)
Where:
Date1 is the first date,
Date2 is the second date,
Interval is the interval type to return.
If Date1 is later than Date2, DATEDIF will return a #NUM! error.
If either Date1 or Date2 is not a valid date, DATEDIF will return a #VALUE error.
Interval value must be be one of the following:
| Interval | Meaning | Description | |
| m | Months | Complete calendar months between the dates. | |
| d | Days | Number of days between the dates. | |
| y | Years | Complete calendar years between the dates. | |
| ym | Months Excluding Years | Complete calendar months between the dates as if they were of the same year. | |
| yd | Days Excluding Years | Complete calendar days between the dates as if they were of the same year. | |
| md | Days Excluding Years And Months | Complete calendar days between the dates as if they were of the same month and same year. |
If you are including the Interval string directly within the formula, you must enclose it in double quotes:
=DATEDIF(Date1,Date2,”m”)
If you have the interval in another cell referenced by the formula, that cell should not have quotes around the interval string. For example, with the formula
=DATEDIF(Date1,Date2,A1)
cell A1 should contain m.
Tweet This