Page 8 of 16PREVNEXT

Learn how to figure out dates using formulas in Excel 2007

Formula to find the number of days between two dates

Callout 1 Formula in the worksheet.
Callout 2 Formula result.
Callout 3 Formula in the formula bar.

Imagine that today is June 9, 2010. Your vacation starts on August 21, 2010, and you want to find out how many days there are until vacation. To do the math, you would type a simple formula into an empty cell:

=A3-A2

There are 73 days between the two dates. You can use the dates in a formula because Excel recognizes the values in cells A2 and A3 by their format, and stores them as serial numbers. Excel subtracts the serial number for 6/9/2010 from the serial number for 9/21/2010: 40411 minus 40338 = 73.

The equal sign (=) tells Excel that this is a formula. The minus sign operator (-) tells Excel to subtract one value from another. A3 and A2 are the cell references that refer to the values in those cells.

You'll notice that after you type the equal (=) sign, Formula AutoComplete displays a list of function names for you to choose from, based on its guess about what you are doing. Because this formula does not use a function, just keep typing to ignore Formula AutoComplete.

If you wonder later on how you got the formula result, the formula is visible in the formula bar near the top of the worksheet whenever you select the cell that contains the formula. You can also double-click the cell to see the formula in the cell.

Note     The formula result may appear in date format because the values in A2 and A3 are in date format. In the practice session at the end of the lesson, you'll see how to reformat the result quickly, so that it appears as a number.

Page 8 of 16PREVNEXT