Consulting

Results 1 to 4 of 4

Thread: Round toTime to Quarter of the Hour

  1. #1

    Round toTime to Quarter of the Hour

    Hello. I am trying to use the following formula to round up to the quarter of the hour. I would prefer that when the total time is 2:11 that the cell will round up to 2:15 and the cell is formated to convert 2:15 to 2.25. I hope this makes sense. If the time is 2:06 then the cell is converted to 2.00.

    'Time is calculated in this cell based on cells c13:f13.
    r13 =(C13>D13)+D13-C13+(E13>F13)+F13-E13

    'This cell is supposed to round up to the closest quarter of the hour.
    t13=ROUND(R13*24/0.25,2)*((0.25/24)*24)

    At first i seem to get it to work but then it doesn't. Anyone's help is appreciated. Thank you.

  2. #2
    I don't have enough info to test your formulas, but look at this part:
    [vba] t13=ROUND(R13*24/0.25,2)*((0.25/24)*24)[/vba] I'm concerned that the preference rules might be giving you trouble with the red operators. In other words, is it supposed to be:
    (R13 * 24) / 0.25
    or should it be:
    R13 * (24 / 0.25)
    Just wondering.

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Try
    =ROUND(R13*24/0.25,0)/24*0.25
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    =ROUNDUP(R13*96,0)/4

    and format as general

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •