1. Computing & Technology

Discuss in my forum

Excel DAY Function

Subtract Dates in Excel with the DAY Function

By , About.com Guide

Subtract Two Dates in Excel with the DAY Function

Subtract Two Dates in Excel with the DAY Function

© Ted French

The DAY function displays the day portion of a date that has been entered into the function. A typical use for the function is to subtract dates in Excel that occur in the same month.

The syntax for the DAY function is:

= DAY ( Serial_number )

Serial_number - the serial date or the cell reference to a date to be used in the calculation.

Example: Subtract Dates with the DAY Function

For help with this formula see the image above.

In this example we want to find out the number of days between two dates. Since the function excludes the month and year portions of a date, it will not correctly calculate the number of days between two dates that are in different months or years.

Our final formula will look like this:

= DAY ( D1 ) - DAY ( D2 )

To enter the formula into Excel we have two options:

  1. Type the above formula in to cell E1 with the two dates to be subtracted in cells D1 and D2
  2. Use the DAY function dialog box to enter the formula into cell E1
  1. Enter the following dates into the appropriate cells
       D1: 12/23/2009
       D2: 12/6/2009
  2. Click on cell E1 - the location where the results will be displayed.

  3. Click on the Formulas tab.

  4. Choose Date & Time from the ribbon to open the function drop down list.

  5. Click on DAY in the list to bring up the function's dialog box.

  6. Click on cell D1 to enter the cell reference of the first date into the dialog box.

  7. Click OK.

  8. In the formula bar you should see the first function: = DAY ( D1 ).

  9. Click in the formula bar after the first function.

  10. Type a minus sign ( - ) into the formula bar after the first function since we want to subtract the two dates.

  11. Choose Date & Time from the ribbon to open the function drop down list again.

  12. Click on DAY in the list to bring up the function's dialog box a second time.

  13. Click on cell D2 to enter the cell reference for the second date.

  14. Click OK.

  15. The number 17 should appear in cell E1 as there are 17 days between December 6th and December 23rd 2009.

  16. When you click on cell E1 the complete function = DAY ( D1 ) - DAY ( D2 ) appears in the formula bar above the worksheet.


Related Tutorials

©2012 About.com. All rights reserved.

A part of The New York Times Company.