Name

DATEDIF

Synopsis

If you need to figure out the number of months, days, or years between two different dates, you should consider using DATEDIF. For example, you can quickly determine the number of days that exist between today and the end of the year using this function and NOW by specifying =DATEDIF(NOW( ), "12/31/2000", " d").

Note

Although DATEDIF is supported by Excel, you will not find it listed on the Paste Function dialog that displays when you select Insert Function. This function was included to provide compatibility with Lotus 1-2-3. To use this function, you need to type the function in the formula bar. For more information on manually typing formulas, refer to Chapter 11.

To Calculate

=DATEDIF(Start_Date, End_Date, Unit)

You must specify values for all three arguments of this function.

Unit

Use one of the six values listed in Table 13-2 to return the number of days, months, or years between the two dates. For example, to return the number of days between the two dates and ignore the year value you should use a value of "yd". Make sure you place the values inside quotes, as indicated in the table.

Table 13-2. Acceptable DATEDIF Unit Values

Value

Description

“m”

Returns the number of complete months between the Start_Date and the End_Date.

Remember, if there is not a complete month between the two dates, Excel will return a value of 0.

“d”

Returns the number of complete days between the two dates.

“y”

Returns the number of complete years between the two dates. ...

Get Excel 2000 in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.