+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Gerry Wilkins
    Guest

    specific rounding of formulas which may need to include an IF stat

    I am currently working on a worksheet where i would like to round the value
    in a cell (the cells currently contain a formula which has been rounded to 0
    decimal places). The rule being that if the last digit (before the decimal
    place) is the number 0, 1,2,3 or 4 then round up the last digit to the digit
    5. If the number is 5,6,7,8 or 9 then round up the last digit to 9. I would
    like to know how to write this formula.

    For example
    if the value is 493.75 then round up to 495.
    if the value is 498.75 then round up to 499.
    if the value is 1233.75 then round up to 1235.
    if the value is 1238.75 then round up to 1239.

  2. #2
    JE McGimpsey
    Guest

    Re: specific rounding of formulas which may need to include an IF stat

    One way:

    =CEILING(INT(A1)+0.1,5)-(MOD(A1,10)>=5)

    In article <0E9E62B3-FC69-4178-843C-02FB315EA244@microsoft.com>,
    "Gerry Wilkins" <Gerry Wilkins@discussions.microsoft.com> wrote:

    > I am currently working on a worksheet where i would like to round the value
    > in a cell (the cells currently contain a formula which has been rounded to 0
    > decimal places). The rule being that if the last digit (before the decimal
    > place) is the number 0, 1,2,3 or 4 then round up the last digit to the digit
    > 5. If the number is 5,6,7,8 or 9 then round up the last digit to 9. I would
    > like to know how to write this formula.
    >
    > For example
    > if the value is 493.75 then round up to 495.
    > if the value is 498.75 then round up to 499.
    > if the value is 1233.75 then round up to 1235.
    > if the value is 1238.75 then round up to 1239.


  3. #3
    Ola
    Guest

    RE: specific rounding of formulas which may need to include an IF stat

    Hi,

    Here is one solution:
    =IF((A1-TRUNC(A1/10,0)*10)<5,5,9)+TRUNC(A1/10,0)*10

    Ola


  4. #4
    Registered User
    Join Date
    08-13-2009
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: specific rounding of formulas which may need to include an IF stat

    Thanks for the above solution. I'm also need a solution alomost like the above. So I put my query here.

    For example
    if the value is 101 or 102 then round up to 100.

    if the value is 103 or 104 then round up to 105
    if the value is 106 or 107 then round up to 105

    if the value is 108 or 109 then round up to 110

    Thanks in advance!

  5. #5
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    2,929

    Re: specific rounding of formulas which may need to include an IF stat

    How about
    =A1 + CHOOSE(MOD(A7,10)+1, 5,4,3,2,1,0,3,2,1,0)

    for the OP.

    For Lavan_Joy,
    =CEILING(A1-2, 5)
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Registered User
    Join Date
    08-13-2009
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: specific rounding of formulas which may need to include an IF stat

    Quote Originally Posted by mikerickson View Post

    For Lavan_Joy,
    =CEILING(A1-2, 5)
    Thanks a lot Rickson! You have solved my problem!

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.2.0