18.11.2014 Views

Microsoft Office

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Part II<br />

Working with Formulas and Functions<br />

Displaying the current time<br />

This formula displays the current time as a time serial number (or as a serial number without an associated<br />

date):<br />

=NOW()-TODAY()<br />

You need to format the cell with a time format to view the result as a recognizable time. The quickest way is<br />

to choose Home ➪ Number ➪ Format Number and select Time from the drop-down list.<br />

NOTE<br />

TIP<br />

This formula is updated only when the worksheet is calculated.<br />

To enter a time stamp (that doesn’t change) into a cell, press Ctrl+Shift+: (colon).<br />

Displaying any time<br />

One way to enter a time value into a cell is to just type it, making sure that you include at least one colon<br />

(:). You can also create a time by using the TIME function. For example, the following formula returns a<br />

time comprised of the hour in cell A1, the minute in cell B1, and the second in cell C1:<br />

=TIME(A1,B1,C1)<br />

Like the DATE function, the TIME function accepts invalid arguments and adjusts the result accordingly.<br />

For example, the following formula uses 80 as the minute argument and returns 10:20:15 AM. The 80 minutes<br />

are simply added to the hour, with 20 minutes remaining.<br />

=TIME(9,80,15)<br />

If you enter a value greater than 24 as the first argument for the TIME function, the result may<br />

not be what you expect. Logically, a formula such as the one that follows should produce a<br />

date/time serial number of 1.041667 (that is, one day and one hour).<br />

CAUTION<br />

=TIME(25,0,0)<br />

In fact, this formula is equivalent to the following:<br />

=TIME(1,0,0)<br />

You can also use the DATE function along with the TIME function in a single cell. The formula that follows<br />

generates a date and time with a serial number of 39420.7708333333 — which represents 6:30 PM on<br />

December 4, 2007:<br />

=DATE(2007,12,4)+TIME(18,30,0)<br />

The TIMEVALUE function converts a text string that looks like a time into a time serial number. This formula<br />

returns 0.2395833333, the time serial number for 5:45 AM:<br />

=TIMEVALUE(“5:45 am”)<br />

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

TIMEVALUE function doesn’t recognize all common time formats. For example, the following formula<br />

returns an error because Excel doesn’t like the periods in “a.m.”<br />

=TIMEVALUE(“5:45 a.m.”)<br />

242

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

Saved successfully!

Ooh no, something went wrong!