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 revisionPrevious revision
Next revisionBoth sides next revision
syntax:functions:roundxl [2016/08/23 18:09] dmitrysyntax:functions:roundxl [2021/07/31 21:40] craigt
Line 1: Line 1:
-===== RoundXl(number, N) =====+====== RoundXL(number, dec_places) =====
 +Category:  Number function
  
-Rounds a number to decimal digits using the Excel rounding logic.+\\  
 +=====Description===== 
 +This function rounds //number// to //dec_places// decimal digits using the Excel rounding logic.
  
-Note: 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, which is also the type of rounding used in Excel. For the standard rounding (the banker's roundinguse [[syntax:functions:round]] function.+Excel rounding logic rounds decimal value of 5 or greater //up// to the next nearest value (towards positive infinityand 4 or less //down// to the next nearest value (towards negative infinity).
  
- Example   Result  +\\  
-roundxl( 5.551 )  |  5.+=====Arguments===== 
-roundxl5.65  5.|+^Argument^Type^Description
 +|number|Number|The valueusually fractional, to be rounded.| 
 +|dec_places|Number (positive>=0)|The number of decimal places to round //number// to.| 
 +\\  
 +**Return value type:**  Number
  
 +\\ 
 +=====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)]].
  
-=== See also === +Using a //dec_places// value of "0" rounds to the nearest whole number. 
-  * [[syntax:functions:floor]] + 
-  * [[syntax:functions:ceiling]] +\\  
-  * [[syntax:functions:round]]+=====Examples===== 
 + 
 +  roundxl(5.55, 1) = 5.6 
 +  roundxl(5.65, 1) = 5.7 
 +  roundxl(10.434, 2) = 10.43 
 +  roundxl(20.5456, 3) = 20.546 
 + 
 + 
 +\\  
 +===== See also ===== 
 +  * [[syntax:functions:ceiling|Ceiling(number)]] 
 +  * [[syntax:functions:floor|Floor(number)]] 
 +  * [[syntax:functions:round|Round(number, dec_places)]] 
 +  * [[syntax:functions:truncate|Truncate(number)]]
syntax/functions/roundxl.txt · Last modified: 2023/02/28 20:14 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki