ROUND

Rounds a number (using the common rule) to a specified number of decimals

Usage

ROUND(number, [num_digits])

Parameters

number

(Required) The number

num_digits

If zero or positive, the number of decimals to keep. If negative, the number digit to the left of the decimal point to turn to 0. Default is 0 which removes all decimals.

Examples

Example With these variables Result

ROUND(13)

(None)

13

ROUND(13.1)

(None)

13

ROUND(13.5)

(None)

14

ROUND(13.9)

(None)

14

ROUND(number)

number is -10.1

-10

ROUND(-10.5)

(None)

-11

ROUND(3.14159265, 2)

(None)

3.14

ROUND(11, -1)

(None)

10

ROUND(15, -1)

(None)

20

ROUND(-1234, -2)

(None)

-1200

More information

Values at the mid-point (ex: ROUND(0.5, 1)) are rounded away from zero.

Reminders

A text containing digits is not handled as a number. To have an actual number:

  • use the @NUMBER_QUESTION to set the variable
  • write a numeric value directly in the code without quotes, ex: age >= 18
  • use a function which converts to a number: NUMBER(text_containing_numbers)
  • use a function which returns a number: FIND("world", "hello everybody")

See also