+ Reply to Thread
Results 1 to 8 of 8

Rounding up/down of time values

  1. #1
    Registered User
    Join Date
    05-08-2008
    Posts
    40

    Rounding up/down of time values

    Hello,

    I need a quick formula to re-calculate a time format to that of 30sec blocks

    eg

    Data entered in;
    A = 1.29 returns 1.30 in B
    A = 1.56 returns 2.00 in B
    A = 21.19 returns 21.30 in B
    A = 1.51 returns 2.00 in B
    A =0.16 returns 0.30 in B

    etc, etc, etc.

    Hoping this is achievable, thanks in advance,

    Mike

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Hi Mike,
    and what sould 1.30 return? 1 or 2 ?

  3. #3
    Registered User
    Join Date
    05-08-2008
    Posts
    40
    Quote Originally Posted by arthurbr
    Hi Mike,
    and what sould 1.30 return? 1 or 2 ?

    Ahaha,..

    I'll have to use the dollarde formula as well to revert times such as 1.5Mins into real time such as 1:30 ???

    Thanks

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    My assumption would be that 1.30 rounds to 1.30...but it's not clear from your examples whether you are rounding up or just rounding (to the nearest). What should 1.04 round to?

    If you're always rounding up then that should become 1.30 and you could use this formula in B1

    =TEXT(CEILING(TEXT(A1*100,"0\:00")+0,"0:30"),"h.mm")+0

    or for rounding to 1

    =INT(A1)+LOOKUP(MOD(A1,1),{0,0.15,0.45;0,0.3,1})

    Note: it would be simpler if your "times" were in true time format, i.e. with a colon, then you can roundup with a formula like

    =CEILING(A1,"0:30")

    or round with

    =ROUND(A1*48,0)/48

  5. #5
    Registered User
    Join Date
    05-08-2008
    Posts
    40
    [QUOTE=daddylonglegs]My assumption would be that 1.30 rounds to 1.30...but it's not clear from your examples whether you are rounding up or just rounding (to the nearest). What should 1.04 round to?

    If you're always rounding up then that should become 1.30 and you could use this formula in B1

    =TEXT(CEILING(TEXT(A1*100,"0\:00")+0,"0:30"),"h.mm")+0

    I think this will be the one. I just need to incorporate the dollarde formula as times are entered in true format, such as 1:30 secs, which is calculated as 1.5.


    Appreciate your assistance..

    Mike

  6. #6
    Registered User
    Join Date
    05-08-2008
    Posts
    40
    Ok..

    Hopefully the attached will make my quest a little clearer.

    Column B needs to roundUP to the nearest 30sec block
    Column C needs to convert the .3's into .5's so that it calculates 3.3 as if it was 3 and a half mins.

    Sorry If I have not made this very clear.
    Attached Files Attached Files

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    B3 could be the earlier formula I suggested, i.e.

    =TEXT(CEILING(TEXT(A3*100,"0\:00")+0,"0:30"),"h.mm ")+0

    and then in C3

    =CEILING(B3,0.5)

  8. #8
    Registered User
    Join Date
    05-08-2008
    Posts
    40
    Quote Originally Posted by daddylonglegs
    B3 could be the earlier formula I suggested, i.e.

    =TEXT(CEILING(TEXT(A3*100,"0\:00")+0,"0:30"),"h.mm ")+0

    and then in C3

    =CEILING(B3,0.5)

    That fixed it....

    Thank you kindly..

    Mike

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1