Private Sub CommandButton0_Click()
MsgBox "Round(2.49,0)=" & Round(2.49, 0)
Private Sub CommandButton1_Click()
MsgBox "Round(2.5,0)=" & Round(2.5, 0)
Private Sub CommandButton2_Click()
MsgBox "Round(2.51,0)=" & Round(2.51, 0)
Description Rounds the argument X to D decimal places. The rounding algorithm depends on the data type of X. D defaults to 0 if not specified. D can be negative to cause D digits left of the decimal point of the value X to become zero.
ROUND() uses the following rules depending on the type of the first argument:
・For exact-value numbers, ROUND() uses the “round half away from zero” or “round toward nearest” rule: A value with a fractional part of .5 or greater is rounded up to the next integer if positive or down to the next integer if negative. (In other words, it is rounded away from zero.) A value with a fractional part less than .5 is rounded down to the next integer if positive or up to the next integer if negative.
・For approximate-value numbers, the result depends on the C library. On many systems, this means that ROUND() uses the “round to nearest even” rule: A value with a fractional part exactly halfway between two integers is rounded to the nearest even integer.