Page 275 - Excel 2007 Bible
P. 275
18_044039 ch13.qxp 11/21/06 11:05 AM Page 232
Part II
Working with Formulas and Functions
The DATE function accepts invalid arguments and adjusts the result accordingly. For example,
TIP
TIP
the following formula uses 13 as the month argument and returns January 1, 2008. The month
argument is automatically translated as month 1 of the following year.
=DATE(2007,13,1)
Often, you’ll use the DATE function with other functions as arguments. For example, the formula that fol-
lows uses the YEAR and TODAY functions to return the date for Independence Day (July 4th) of the current
year:
=DATE(YEAR(TODAY()),7,4)
The DATEVALUE function converts a text string that looks like a date into a date serial number. The follow-
ing formula returns 39316, the date serial number for August 22, 2007:
=DATEVALUE(“8/22/2007”)
To view the result of this formula as a date, you need to apply a date number format to the cell.
Be careful when using the DATEVALUE function. A text string that looks like a date in your
CAUTION
CAUTION
country may not look like a date in another country. The preceding example works fine if your
system is set for U.S. date formats, but it returns an error for other regional date formats because Excel is
looking for the eighth day of the 22nd month!
Generating a series of dates
Often, you want to insert a series of dates into a worksheet. For example, in tracking weekly sales, you may
want to enter a series of dates, each separated by seven days. These dates will serve to identify the sales figures.
The most efficient way to enter a series of dates doesn’t require any formulas. Use the Excel AutoFill feature
to insert a series of dates. Enter the first date and drag the cell’s fill handle while pressing the right mouse
button. Release the mouse button and select an option from the shortcut menu (see Figure 13.3) — either
Fill Days, Fill Weekdays, Fill Months, or Fill Years.
FIGURE 13.3
Using Excel’s AutoFill feature to create a series of dates.
232