Consulting

Results 1 to 8 of 8

Thread: Solved: Rounding in units of 0.5

  1. #1
    VBAX Regular
    Joined
    Nov 2007
    Location
    Liverpool
    Posts
    13
    Location

    Solved: Rounding in units of 0.5

    Hi

    Im having trouble rounding up/down in units of 0.5

    The personnel manager would like the results of the rounding calculation to be those in column F of the attached spreadsheet. Cell e6 is problematical as it is neither one way or the other, Ive tried ceiling etc but cant get it to work as he would like. Any help would be greatly appreciated
    Attached Files Attached Files

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Maybe you should show what he expected.

    If the rule is to upper 0.5 then numbers like 16.5 and 17.0 are not changed.

    I would have used MRound() to get the nearest 0.5 but you may not want a round down.

  3. #3
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    You can use if case as below:
    =IF(RIGHT(E3,1)="5",CEILING(E3,1),CEILING(E3,0.5))
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Another approach would be:
    =ROUND(E2*2,0)/2
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    Hello Paul,
    The OP is specifically looking for a case where *.5 should be converted to next round up value. Please see his last cell:
    16.5 should be (probably) 17.0.
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    According to his request he said up and down, and his example left 16.5 at 16.5
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Quote Originally Posted by shrivallabha
    Hello Paul,
    The OP is specifically looking for a case where *.5 should be converted to next round up value. Please see his last cell:
    16.5 should be (probably) 17.0.
    There's nothing I've seen in either the OP's post or workbook to indicate that. The formula I posted correctly renders to specified rounding - both up and down - to the nearest 0.5.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  8. #8
    VBAX Regular
    Joined
    Nov 2007
    Location
    Liverpool
    Posts
    13
    Location
    Thanks guys, Shrivallabhas solution was the one I was looking for, he wanted to round up to the nearest 0.5 if the value was less than .49 but also to round up to the nearest 0.5 if it was .5 or above.
    Many many thaanks to you all!

Posting Permissions

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