Difference between revisions of "Manuals/calci/MROUND"

From ZCubes Wiki
Jump to navigation Jump to search
Line 2: Line 2:
  
 
*Where 'number' is the number to round and  
 
*Where 'number' is the number to round and  
*'multiple' is the number of digits to which the number is to be rounded.
+
*'multiple' is the multiple value to which number is to be rounded.
  
ROUND() rounds a number to specified number of digits.
+
MROUND() rounds a number to specified multiple.
  
 
== Description ==
 
== Description ==
Line 10: Line 10:
 
MROUND(number, multiple)
 
MROUND(number, multiple)
  
This function is used to round a number to certain number of digits mentioned in the argument.
+
This function is used to round a number to desired multiple.
  
 
For Example,
 
For Example,
  
MROUND(3.6712,2) ''returns 3.67'' as a result.
+
MROUND(3.6, 2) ''returns 4'' as a result.
  
MROUND(411.3,-1) ''returns 410'' as a result.
+
MROUND(44.1, 4) ''returns 44'' as a result.
 +
 
 +
*The number is rounded up or down, depending on the remainder of division of the number and the multiple. If the remainder is more than or equal to half the multiple value, the number is rounded up, else it is rounded down towards zero.
  
 
*If 'num_of_digits' is omitted, Calci assumes it to be zero and rounds the number to the nearest integer.
 
*If 'num_of_digits' is omitted, Calci assumes it to be zero and rounds the number to the nearest integer.

Revision as of 16:42, 3 December 2013

MROUND(number, multiple)

  • Where 'number' is the number to round and
  • 'multiple' is the multiple value to which number is to be rounded.

MROUND() rounds a number to specified multiple.

Description

MROUND(number, multiple)

This function is used to round a number to desired multiple.

For Example,

MROUND(3.6, 2) returns 4 as a result.

MROUND(44.1, 4) returns 44 as a result.

  • The number is rounded up or down, depending on the remainder of division of the number and the multiple. If the remainder is more than or equal to half the multiple value, the number is rounded up, else it is rounded down towards zero.
  • If 'num_of_digits' is omitted, Calci assumes it to be zero and rounds the number to the nearest integer.
  • The number is rounded to the specified number of decimal places, if num_of_digits > 0.
  • The number is rounded to the nearest integer, if num_of_digits = 0.
  • The number is rounded to the left of the decimal point, if num_of_digits < 0.
  • If any argument is non-numeric, Calci displays #NaN error message.

MROUND() can also be used for multiple number array as -

MROUND(2.5..6..0.5) that rounds the numbers 2.5 to 6 in steps of 0.5.

Number MROUND
2.5 3
3 3
3.5 4
4 4
4.5 5
5 5
5.5 6
6 6
  • ROUNDUP() can be used to round a number away from zero.
  • ROUNDDOWN() can be used to round a number towards zero.
  • MROUND() can be used to round a number to desired multiple.

Examples

Function Output
MROUND(3.6712,2) 3.67
MROUND(99.37,0) 99
MROUND(99.37) 99
MROUND(145.8,-1) 150
MROUND(-89.65,1) -89.7
MROUND(-89.65,-1) -90

See Also

References