Category: Number function
This function rounds number to dec_places decimal digits using the Excel rounding logic.
Excel rounding logic rounds a decimal value of 5 or greater up to the next nearest value (towards positive infinity) and 4 or less down to the next nearest value (towards negative infinity).
|number||Number||The value, usually fractional, to be rounded.|
|dec_places||Number (positive, >=0)||The number of decimal places to round number to.|
Return value type: Number
There exists two types of rounding, in general - "Rounding away from zero" (a.k.a. symmetric rounding) and "Rounding to the nearest even number" (a.k.a. banker's rounding). This function uses the former (symmetric rounding), which is also the type of rounding used in Excel. For standard rounding (banker's rounding) use Round(number, dec_places).
Using a dec_places value of "0" rounds to the nearest whole number.
roundxl(5.55, 1) //Returns 5.6
roundxl(5.65, 1) //Returns 5.7
roundxl(10.434, 2) //Returns 10.43
roundxl(20.5456, 3) //Returns 20.546