Consulting

Results 1 to 4 of 4

Thread: Rounding to a Fraction

  1. #1
    VBAX Expert
    Joined
    Feb 2010
    Posts
    696
    Location

    Rounding to a Fraction

    Is there a way to round to the nearest .25? For example, if one has 1.45 teaspoons of soup, is there a way to round that to 1.5. 1.15 would be rounded to 1.25 while 1.10 would be rounded to to 1.00.

  2. #2
    Hi Opv,

    This will give the desired result based on the value in cell A1 (change to suit):

    =IF(AND(A1-INT(A1)>=0.01,A1-INT(A1)<=0.14),INT(A1),CEILING(A1,1/4))

    Regards,

    Robert

  3. #3
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    =FLOOR(CEILING(A1,.125),.25)
    Last edited by snb; 08-30-2015 at 11:26 PM.

  4. #4
    VBAX Expert
    Joined
    Feb 2010
    Posts
    696
    Location
    Trebor76, your suggested solution rounds 1.13 down to 1 rather than up to 1.25.

    snb, as always your suggested solution is both succinct and works like a charm.

    Thanks to both of you for your kind response.

Posting Permissions

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