Microsoft Office Tutorials and References

In Depth Information

**Working with date and time functions**

are variables that supply the values a function needs to perform its calculations. You place

arguments between the parentheses for functions that require them.)

Similarly, you can type
=NOW( )
in a cell or formula to insert the current date and time.

This function also takes no arguments. The result of the function is a serial date and time

value that includes an integer (the date) and a decimal value (the time). Excel doesn’t

update the value of NOW continuously. If the value of a cell that contains the NOW

function isn’t current, you can update the value by recalculating the worksheet. (You recalculate

the worksheet by making a new entry or by pressing F9.) Excel also updates the NOW

function whenever you open or print the worksheet.

The NOW function is an example of a
volatile
function—that is, a function whose calculated

value is subject to change. Any time you open a worksheet that contains one or more NOW

functions, Excel prompts you to save changes when you close the worksheet, regardless of

whether you made any, because the current value of NOW has changed since the last time

you used the worksheet. (Another example of a volatile function is RAND.)

For more about the RAND function, see “The RAND and RANDBETWEEN functions” in

Chapter 14, “Everyday functions.”

Using the WEEKDAY function

The WEEKDAY function returns the day of the week for a specific date and takes the

arguments (
serial_number
,
return_type
). The
serial_number
argument can be a serial date value,

a reference to a cell that contains either a date function or a serial date value, or text such

as 1/27/14 or January 27, 2014. If you use text, be sure to enclose the text in quotation

marks. The function returns a number that represents the day of the week on which the

specified date falls. The optional
return_type
argument determines the way the result is

displayed. Table 15-2 lists the available return types.

TABLE 15-2
Return type codes

If
return_type
is
WEEKDAY returns

1 or omitted

A number from 1 through 7, where 1 is Sunday and 7 is Saturday

A number from 1 through 7, where 1 is Monday and 7 is Sunday

2

A number from 0 through 6, where 0 is Monday and 6 is Sunday

3

Note

You might want to format a cell containing the WEEKDAY function with a custom

dayof-the-week format, such as dddd. By applying this custom format, you can use the

result of the WEEKDAY function in other functions and still have a meaningful display

on the screen.