User Tools

Site Tools


syntax:functions:roundxl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
syntax:functions:roundxl [2021/09/07 11:20]
craigt [See also]
syntax:functions:roundxl [2021/09/30 13:10] (current)
dmitry
Line 7: Line 7:
  
 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). 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).
 +
 +\\ 
 +
 +=====Alternative syntax=====
 +The 2nd argument in this function is optional. If omitted, it's assumed to be 0.
 +  RoundXL(number)  //The same as RoundXL(number, 0)
  
 \\  \\ 
Line 12: Line 18:
 ^Argument^Type^Description^ ^Argument^Type^Description^
 |number|Number|The value, usually fractional, to be rounded.| |number|Number|The value, usually fractional, to be rounded.|
-|dec_places|Number (positive, >=0)|The number of decimal places to round //number// to.|+|dec_places|Number (from -9 to 28)|The number of decimal places to round //number// to.|
 \\  \\ 
 **Return value type:**  Number **Return value type:**  Number
Line 18: Line 24:
 \\  \\ 
 =====Remarks===== =====Remarks=====
-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 [[syntax:functions:round|Round(number, dec_places)]].+There exist 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 [[syntax:functions:round|Round(number, dec_places)]].
  
 Using a //dec_places// value of "0" rounds to the nearest whole number. Using a //dec_places// value of "0" rounds to the nearest whole number.
Line 33: Line 39:
   roundxl(20.5456, 3) //Returns 20.546   roundxl(20.5456, 3) //Returns 20.546
  
 +  roundxl(12345, -2) //Returns 12300
  
 \\  \\ 
syntax/functions/roundxl.txt · Last modified: 2021/09/30 13:10 by dmitry