Microsoft Office Tutorials and References
In Depth Information
Calculating Time between Two Dates with the DATEDIF Function
Calculating Time between Two Dates
with the DATEDIF Function
Excel provides the DATEDIF function to calculate the number of days,
months, or years between two dates. This is an undocumented function, that
is, you will not see it in the Insert Function dialog box, and you cannot find
it in the Excel Help system. Why is it undocumented? Beats me — but it sure
can be useful! Impress your friends and co-workers. The only thing you have
to do is remember how to enter it. Of course, I don’t mind if you keep this
book around to look it up.
DATEDIF takes three arguments:
Start date
End date
Interval
The interval argument tells the function what type of result to return,
summarized in Table 12-2.
Table 12-2
Settings for the Interval Argument of DATEDIF
Value
What It Means
Comment
Days
The count of inclusive days from the start date
through the end date.
“d”
“m”
Months
The count of complete months between the dates.
Only those months that fully occur between the
dates are counted. For example, if the first date starts
after the first of the month, then that first month is
not included in the count. For the end date, even
when it is the last day of the month, that month is not
counted. See Figure 12-10 for an example.
“y”
Years
The count of complete years between the dates.
Only those years that fully occur between the dates
are counted. For example, if the first date starts
later than January 1, that first year is not included
in the count. For the end date, even when it is
December 31, that year is not counted. See Figure
12-10 for an example.
(continued)
Search JabSto ::




Custom Search