Well, firstly, thatβs not how you say it.
k = 182.5 r = Round(k, 0)
really produce 182 but
k = 186.5 r = Round(k, 0)
will produce 186, not 187, as you mentioned. Now,
k = 185.5 r = Round(k, 0)
will also give 186. This is called Rounding Banker and is the standard in VB6. The goal is to cancel the offset, always rounding the exact middle.
If you want to always round 0.5, use
k = 186.5 r = Int(k * 2 + 1) \ 2
If you want to always round 0.5 down, you can use something along the line
k = 186.5 r = Int(k * 2 + 0.99) \ 2
Add as many nine as the sign digits after the decimal point.
source share