Round to 0.5

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a formula, in a report or query, that will round my calculated result
to X.5 if the result has a decimal. Example: 2.6, 2.2, 1.9, 1.1 would be
changed to 2.5,2.5,1.5,1.5. If the result is a whole number then there is no
change. I need this for inventory counting whole/half bottles. Thanks, Dan
 
Dan said:
I need a formula, in a report or query, that will round my calculated
result to X.5 if the result has a decimal. Example: 2.6, 2.2, 1.9,
1.1 would be changed to 2.5,2.5,1.5,1.5. If the result is a whole
number then there is no change. I need this for inventory counting
whole/half bottles. Thanks, Dan

How about multiplying by 2 rounding to whole number (integer) then
dividing by 2?
 
IIf(([Value] - Int([Value])) > 0, Int([Value]) + 0.5, [Value])

It might be possible for truncation errors to creep in so you need to test
the sample boundary values, e.g. 2.9999999999, 3, 3.000000001 and the likes
....
 
Back
Top