User Tools

Site Tools


syntax:functions:roundxl

Differences

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

Link to this comparison view

Next revision
Previous revision
syntax:functions:roundxl [2016/07/09 08:48] – created dmitrysyntax:functions:roundxl [2023/02/28 20:14] (current) – [See also] fix MRound page reference -CT 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 +\\ 
-| round( 5.55, 1 )  |  5.6 | +
-| round( 5.65, 1 )  |  5.7 |+
  
 +=====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)
  
-=== See also === +\\  
-  * [[syntax:functions:floor]] +=====Arguments===== 
-  * [[syntax:functions:ceiling]] +^Argument^Type^Description^ 
-  * [[syntax:functions:round]]+|number|Number|The value, usually fractional, to be rounded.| 
 +|dec_places|Number (from -9 to 28)|The number of decimal places to round //number// to.| 
 +\\  
 +**Return value type:**  Number 
 + 
 +\\  
 +=====Remarks===== 
 +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. 
 + 
 +\\  
 +=====Examples===== 
 + 
 +  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 
 + 
 +  roundxl(12345, -2) //Returns 12300 
 + 
 +\\  
 +===== See also ===== 
 +  * [[syntax:functions:ceiling|Ceiling(number)]] 
 +  * [[syntax:functions:floor|Floor(number)]] 
 +  * [[syntax:functions:mround|MRound(number, grain)]] 
 +  * [[syntax:functions:round|Round(number, dec_places)]] 
 +  * [[syntax:functions:truncate|Truncate(number)]]
syntax/functions/roundxl.1468068529.txt.gz · Last modified: 2016/07/09 08:48 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki