Documentation/Calc Functions/CEILING

From The Document Foundation Wiki
Jump to: navigation, search
Other languages:
dansk • ‎English

Function name:

CEILING

Category:

Mathematical

Summary:

Rounds a number to the nearest multiple of a significance value.

For a positive number and a positive significance value, the function rounds up (away from zero). For a negative number and a negative significance value, the direction of rounding is determined by the value of a mode parameter. The function returns an error if the number and significance values have opposite signs.

Syntax:

CEILING(Number [; Significance [; Mode]])

Returns:

Returns an integer value.

Arguments:

Number is the real number that is to be rounded, or a reference to a cell containing the number.

Significance (optional) is the real number value, or a reference to a cell containing the value, to whose multiple Number is to be rounded. It defaults to +1 or -1 depending on the sign of Number.

Mode (optional) is a number, or a reference to a cell containing a number. The function only uses Mode if both Number and Significance are negative. Then if Mode is given and not equal to zero, numbers are rounded down (away from zero). If Mode is equal to zero or not given, negative numbers are rounded up (towards zero).

Additional details:

Gnome-dialog-warning.svg

Warning:
If the spreadsheet is exported to Microsoft Excel, the CEILING function is exported as the equivalent CEILING.MATH function that exists since Excel 2013. If you plan to use the spreadsheet with earlier Excel versions, use either CEILING.PRECISE that exists since Excel 2010, or CEILING.XCL that is exported as the CEILING function compatible with all Excel versions.


Examples:

Formula Description Returns
=CEILING(11.5) rounds up 11.5 to nearest multiple of +1(default) 12
=CEILING(-11.5) rounds up -11.5 to nearest multiple of -1(default) -11
=CEILING(-11;-2) rounds up -11 to nearest multiple of -2 -10
=CEILING(-10;-3;1) rounds down -10 to nearest multiple of -3 under mode 1 which is not 0 hence result will be away from 0 -12
=CEILING(-11.67;-2;0) rounds up -11.67 to nearest multiple of -2 under mode 0 i.e. towards 0 -10
=CEILING(-11.67;-2;1) rounds down -11.67 to nearest multiple of -2 under mode 1 which is not 0 hence result will be away from 0 -12
=CEILING(11.5;-1) rounds up 11.5 to nearest multiple of -1 but due to opposite sign this will return an error value Err:502

Related LibreOffice functions:

CEILING.MATH

CEILING.PRECISE

CEILING.XCL

FLOOR

ODF standard:

Section 6.17.1, part 2

Equivalent Excel functions:

CEILING.MATH