18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Part II<br />

Working with Formulas and Functions<br />

TIP<br />

The DATE function accepts invalid arguments and adjusts the result accordingly. For example,<br />

the following formula uses 13 as the month argument and returns January 1, 2008. The month<br />

argument is automatically translated as month 1 of the following year.<br />

=DATE(2007,13,1)<br />

Often, you’ll use the DATE function with other functions as arguments. For example, the formula that follows<br />

uses the YEAR and TODAY functions to return the date for Independence Day (July 4th) of the current<br />

year:<br />

=DATE(YEAR(TODAY()),7,4)<br />

The DATEVALUE function converts a text string that looks like a date into a date serial number. The following<br />

formula returns 39316, the date serial number for August 22, 2007:<br />

=DATEVALUE(“8/22/2007”)<br />

To view the result of this formula as a date, you need to apply a date number format to the cell.<br />

Be careful when using the DATEVALUE function. A text string that looks like a date in your<br />

country may not look like a date in another country. The preceding example works fine if your<br />

system is set for U.S. date formats, but it returns an error for other regional date formats because Excel is<br />

looking for the eighth day of the 22nd month!<br />

CAUTION<br />

Generating a series of dates<br />

Often, you want to insert a series of dates into a worksheet. For example, in tracking weekly sales, you may<br />

want to enter a series of dates, each separated by seven days. These dates will serve to identify the sales figures.<br />

The most efficient way to enter a series of dates doesn’t require any formulas. Use the Excel AutoFill feature<br />

to insert a series of dates. Enter the first date and drag the cell’s fill handle while pressing the right mouse<br />

button. Release the mouse button and select an option from the shortcut menu (see Figure 13.3) — either<br />

Fill Days, Fill Weekdays, Fill Months, or Fill Years.<br />

FIGURE 13.3<br />

Using Excel’s AutoFill feature to create a series of dates.<br />

232

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!