2
Spreadsheets Share By Ted French, About.com Guide Calculate the Number of Days Between Dates in Excel Excel DATEDIF Function The DATEDIF function can be used to calculate the number of days between two dates in versions of Excel from 97 to 2007. An interesting point about DATEDIF is that it is an "undocumented" function which means it is not listed with other functions under the formula tab in Excel 2007. To use the function you must type it manually into a cell on the worksheet rather than using the dialog box method available for other functions. The syntax for the DATEDIF function is: = DATEDI F ( start_date , end_date , unit ) The function has three arguments that need to be entered as part of the function: The unit argument can also be a combination of days, months, and years: Calculate the Nu mber of Days Between D ates Example Note: Commas are used as separators between the function's three arguments. For help with this example, see the image above. start_date - the first or starting date. end_date - the second or last date. unit - tells the function to find the number of days ("D"), complete months ("M"), or complete years ("Y") between the two dates. "YM" - excludes years - calculates the number of months between two dates as if the dates were in the same year. "YD" - excludes years - calculates the number of days between two dates as if the dates were in the same year. "MD" - excludes months - calculates the number of days between two dates as if the dates were in the same month and year. Enter the following dates into cells D1 and D2: 1/30/2009 and 5/18/2009 1.  Click on cell E1 in the spreadsheet - this is where the function will be located. 2.  Type " = datedif " in cell E1. 3.  Type an opening round bracket " ( " after the function name in cell E1. 4.  Click on cell D1 in the spreadsheet to enter the cell reference of the start_date into the function. 5.  Type a comma ( , ) in cell E1 after D1 to act as a separator between the two cell references in the function. 6.  Click on cell D2 in the spreadsheet to enter the cell reference of the end_date into the function after the first comma. 7.  Type a second comma ( , ) in cell E1 following the second cell reference as a second separator. 8.  For the unit argument, type the letter D in quotes ("D " ) in cell E1 after the second comma to tell the function we want to know the number of days between the two dates. 9.  Type the closing bracket " ) " . 10.  Press the ENTER key on the keyboard. 11.  The answer 108 should appear in cell E1 as there are 108 days between January 30th and May 18. 12.  Calculate the Number of Days Between Dates © Ted French Enter email address Free Spreadsheets Newsletter! Discuss in my forum Sign Up Page 1 of 2 Calculate Days Between Dates - Calculate the Number of Days Between Dates in Exc... 2011/11/24 http://spreadsheets.about.com/od/excelfunctions/qt/090714_number_of_days_betwee...

Spreadsheets.about.com Od Excel Functions Qt 090714 Numbe

  • Upload
    cn024

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Spreadsheets.about.com Od Excel Functions Qt 090714 Numbe

8/2/2019 Spreadsheets.about.com Od Excel Functions Qt 090714 Numbe

http://slidepdf.com/reader/full/spreadsheetsaboutcom-od-excel-functions-qt-090714-numbe 1/2

Spreadsheets Share

By Ted French, About.com Guide

Calculate the Number of Days Between Dates in ExcelExcel DATEDIF Function

The DATEDIF function can be used to calculate the number of days

between two dates in versions of Excel from 97 to 2007.

An interesting point about DATEDIF is that it is an "undocumented"

function which means it is not listed with other functions under the

formula tab in Excel 2007.

To use the function you must type it manually into a cell on the

worksheet rather than using the dialog box method available for other

functions.

The syntax for the DATEDIF function is:

= DATEDI F ( start_date , end_date , uni t )

The function has three arguments that need to be entered as part of the function:

The unit argument can also be a combination of days, months, and years:

Calculate the Nu mber of Days Between D ates Example

Note: Commas are used as separators between the function's three arguments. For help with this

example, see the image above.

start_date - the first or starting date.•

end_date - the second or last date.•

unit - tells the function to find the number of days ("D"), complete months ("M"), or complete

years ("Y") between the two dates.

"YM" - excludes years - calculates the number of months between two dates as if the dates

were in the same year.

"YD" - excludes years - calculates the number of days between two dates as if the dates were

in the same year.

"MD" - excludes months - calculates the number of days between two dates as if the dates

were in the same month and year.

Enter the following dates into cells D1 and D2: 1/30/2009 and 5/18/20091.

 

Click on cell E1 in the spreadsheet - this is where the function will be located.2.

 

Type " = datedif " in cell E1.3.

 

Type an opening round bracket " ( " after the function name in cell E1.4.

 

Click on cell D1 in the spreadsheet to enter the cell reference of the start_date into thefunction.

5.

 

Type a comma ( , ) in cell E1 after D1 to act as a separator between the two cell references

in the function.

6.

 

Click on cell D2 in the spreadsheet to enter the cell reference of the end_date into the

function after the first comma.

7.

 

Type a second comma ( , ) in cell E1 following the second cell reference as a second

separator.

8.

 

For the unit argument, type the letter D in quotes ("D " ) in cell E1 after the second comma

to tell the function we want to know the number of days between the two dates.

9.

 

Type the closing bracket " ) " .10.

 

Press the ENTER key on the keyboard.11.

 

The answer 108 should appear in cell E1 as there are 108 days between January 30th and

May 18.

12.

 

Calculate the Number of Days

Between Dates

© Ted French 

Enter email address

Free Spreadsheets Newsletter!

Discuss in my forum

Sign Up

Page 1 of 2Calculate Days Between Dates - Calculate the Number of Days Between Dates in Exc...

2011/11/24http://spreadsheets.about.com/od/excelfunctions/qt/090714_number_of_days_betwee ...

Page 2: Spreadsheets.about.com Od Excel Functions Qt 090714 Numbe

8/2/2019 Spreadsheets.about.com Od Excel Functions Qt 090714 Numbe

http://slidepdf.com/reader/full/spreadsheetsaboutcom-od-excel-functions-qt-090714-numbe 2/2

If you get a # N U M! error in the cell where your function is located, it means that the start_date

is larger (later in the year) than the end_date.

Related Articles 

If you click on cell C1, the complete function = DATEDI F ( D1 , D2 , "D" ) appears in the

formula bar above the worksheet.

13.

Excel 2007 NETWORKDAYS Function •

Excel 2007 DAYS360 Function •

Excel 2007 DATE Function •

Page 2 of 2Calculate Days Between Dates - Calculate the Number of Days Between Dates in Exc...

2011/11/24http://spreadsheets.about.com/od/excelfunctions/qt/090714 number of days betwee ...