Results 1 to 4 of 4
  1. #1
    Join Date
    May 2006
    Location
    Oceanside, CA
    Posts
    2

    Unanswered: Rounding & Truncating

    I have a calculated number in a cell with 1 decimal place.
    If the decimal is < .5, I want to round it down to an integer,
    if it is .5, I want to leave it as is,
    and if it is > .5, I want to round it up to the next higher integer.

    Does anyone have any suggestions as to how to do this?

    Thanks in advance,

    Giles.

  2. #2
    Join Date
    Feb 2006
    Posts
    113
    =ROUND(cell,0)

    You might like to check it handles negative numbers how you want. And exact xx.5 values

    HTH

  3. #3
    Join Date
    May 2006
    Location
    Oceanside, CA
    Posts
    2

    Rounding & Truncating

    I am aready using the round(x,1) function, and it returns the value I am trying to change. Round does not return the result I need.

    Giles

  4. #4
    Join Date
    Feb 2006
    Posts
    113
    My mistake, Giles. I didn't read your question fully.

    What you want requires a test to know the numbers that are exactly xx.5.

    One solution would be
    =IF(A1-INT(A1)=0.5,A1,ROUND(A1,0))

    Another one
    =IF(INT(2*A1)=2*A1,A1,ROUND(A1,0))

    Instead of these formulaic approaches, you could create a custom/user defined function in VBA.

    HTH,
    Fazza

Posting Permissions

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