Page 290 - Excel 2007 Bible
P. 290

18_044039 ch13.qxp  11/21/06  11:05 AM  Page 247
                                       FIGURE 13.9
                                     Using a formula to create a series of incremental times.
                                             Rounding time values                           Working with Dates and Times     13
                                             You may need to create a formula that rounds a time to a particular value. For example, you may need to
                                             enter your company’s time records rounded to the nearest 15 minutes. This section presents examples of
                                             various ways to round a time value.
                                             The following formula rounds the time in cell A1 to the nearest minute:
                                                 =ROUND(A1*1440,0)/1440
                                             The formula works by multiplying the time by 1440 (to get total minutes). This value is passed to the
                                             ROUND function, and the result is divided by 1440. For example, if cell A1 contains 11:52:34, the formula
                                             returns 11:53:00.
                                             The following formula resembles this example, except that it rounds the time in cell A1 to the nearest hour:
                                                 =ROUND(A1*24,0)/24
                                             If cell A1 contains 5:21:31, the formula returns 5:00:00.
                                             The following formula rounds the time in cell A1 to the nearest 15 minutes (a quarter of an hour):

                                                 =ROUND(A1*24/0.25,0)*(0.25/24)
                                             In this formula, 0.25 represents the fractional hour. To round a time to the nearest 30 minutes, change 0.25
                                             to 0.5, as in the following formula:
                                                 =ROUND(A1*24/0.5,0)*(0.5/24)











                                                                                                                      247
   285   286   287   288   289   290   291   292   293   294   295