View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default rounding to nearest .5 in vba

Hi Gary, have you looked at the MROUND function. I did a quick test with it
and it will round to the nearest .5 of an integer.

Formula in cell B2: =MROUND(a1, .5)


"Gary Keramidas" wrote in message
...
i'm wondering if there is a single formula that will round the following
examples in vba. i can do it with if statements, but looking for a more
compact solution to enter the value in a cell.

if it's < .5 it rounds to .5. if it's .5 it rounds to the nearest .5.

4.571428571 5
0.571428571 0.5
0.575428571 1
0.285714286 0.5
0.214285714 0.5
57.03571429 57


--


Gary Keramidas
Excel 2003