Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The ROUND function rounds a number value to a specified number of decimal places.

Syntax

Code Block
 ROUND number [UP | DOWN] TO POSITION position
  • number - Number or attribute of some type of number to be rounded.
  • UP or DOWN - The direction of rounding. The direction DOWN points to zero for both positive and negative values, UP points away from zero. If no direction is specified, rounding will be done to the nearest integer (half-way values will be rounded up).
  • position - The rounding position as integer. A positive integer represents the place value of the digit after the decimal point. Zero and negative integers represent the place value of the digit before the decimal point. Place values: [-n]..[-3][-2][-1][0].[1][2][3]..[n]

Return types

  • number
  • integer
  • currency
  • percentage

 

Info

If you prefer a functional syntax, then you can use the ROUNDDOWN or ROUNDUP function. Its syntax is ROUNDDOWN/ROUNDUP ( number, digits ). Example: ROUNDDOWN(1.23456, 2) = 1.23

 

Examples

  • ROUND 12345.23 TO POSITION -2 = 12300.0000
  • ROUND 12345.23 TO POSITION 1 = 12345.2000
  • ROUND 12345.23 UP TO POSITION -2 = 12400
  • ROUND 12345.23 UP TO POSITION 1 = 12345.3000
  • ROUND 12345.23 DOWN TO POSITION -2 = 12300.0000
  • ROUND 12345.23 DOWN TO POSITION 1 = 12345.2000
  • ROUND 12345.23 UP TO POSITION -5 = 100000.0000
  • ROUND 12345.23 TO POSITION -5 = 0.0000

...