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.

Working with Dates and Times 13<br />

FIGURE 13.9<br />

Using a formula to create a series of incremental times.<br />

Rounding time values<br />

You may need to create a formula that rounds a time to a particular value. For example, you may need to<br />

enter your company’s time records rounded to the nearest 15 minutes. This section presents examples of<br />

various ways to round a time value.<br />

The following formula rounds the time in cell A1 to the nearest minute:<br />

=ROUND(A1*1440,0)/1440<br />

The formula works by multiplying the time by 1440 (to get total minutes). This value is passed to the<br />

ROUND function, and the result is divided by 1440. For example, if cell A1 contains 11:52:34, the formula<br />

returns 11:53:00.<br />

The following formula resembles this example, except that it rounds the time in cell A1 to the nearest hour:<br />

=ROUND(A1*24,0)/24<br />

If cell A1 contains 5:21:31, the formula returns 5:00:00.<br />

The following formula rounds the time in cell A1 to the nearest 15 minutes (a quarter of an hour):<br />

=ROUND(A1*24/0.25,0)*(0.25/24)<br />

In this formula, 0.25 represents the fractional hour. To round a time to the nearest 30 minutes, change 0.25<br />

to 0.5, as in the following formula:<br />

=ROUND(A1*24/0.5,0)*(0.5/24)<br />

247

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

Saved successfully!

Ooh no, something went wrong!