From: Gary Keramidas on 4 Mar 2010 02:36 thanks for all of the replies. i learned a few things about rounding, even though some of my examples were incorrect. -- Gary Keramidas Excel 2003 "Gary Keramidas" <gkeramidas(a)XXMSN.com> wrote in message news:%23HZO5MuuKHA.6064(a)TK2MSFTNGP02.phx.gbl... > 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 > >
From: Bernd P on 4 Mar 2010 08:41
Hello Gary, I suggest to keep it simple: result = int(input*2+0.5)/2 'round to nearest 0.5 Regards, Bernd |