Documentation/Calc Functions/FLOOR.MATH

From The Document Foundation Wiki
Jump to: navigation, search

Other languages:

Function name:

FLOOR.MATH

Category:

Mathematical

Summary:

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

For a positive number the function rounds down (towards zero). For a negative number, the direction of rounding is determined by the value of a mode parameter. The sign of the significance value is ignored.

Im-jabber.svg

Note:
This function is available since LibreOfficeDev 5.0.

Syntax:

FLOOR.MATH(Number [; Significance [; Mode]])

Returns:

Returns an integer value.

Arguments:

Number is the value, or a reference to a cell containing the value, that is to be rounded. If Number is set to 0, FLOOR.MATH returns 0, irrespective of the value of Significance.

Significance (optional) is the value, or a reference to a cell containing the value, to whose multiple Number will be rounded. If omitted, the default is 1. If Significance is set to 0, FLOOR.MATH returns 0, irrespective of the value of Number. The sign of Significance is ignored by this function.

Mode (optional) is a number, or a reference to a cell containing a number. If Mode is given and not equal to zero, a negative Number is rounded up (towards zero). If Mode is equal to zero or is not given, a negative Number is rounded down (away from zero).

If the second (Significance) and third (Mode) arguments are omitted, the function implements a standard mathematical floor function. That is, for a real number x, its floor is the largest integer that is less than or equal to x.

Additional details:

Gnome-dialog-warning.svg

Warning:
This function increases interoperability with Microsoft Excel, which has had an equivalent FLOOR.MATH function since Excel 2013. When Calc opens an Excel file or saves a spreadsheet to Excel format, it does not need to convert references to FLOOR.MATH to some other function.


Examples:

Formula Description Returns
=FLOOR.MATH(11.5) rounds down 11.5 to nearest multiple of 1(default) 11
=FLOOR.MATH(-11.5) rounds down -11.5 to nearest multiple of 1(default) -12
=FLOOR.MATH(-11;-2) rounds down -11 to nearest multiple of 2, ignoring the sign -12
=FLOOR.MATH(-10;-3;1) rounds up -10 to nearest multiple of 3, ignoring the sign, under mode 1 which is not 0 hence result will be towards 0 -9
=FLOOR.MATH(-11.67;-2;0) rounds down -11.67 to nearest multiple of 2, ignoring the sign, under mode 0 i.e. away from 0 -12
=FLOOR.MATH(-11.67;-2;1) rounds up -11.67 to nearest multiple of 2, ignoring the sign, under mode 1 which is not 0 hence result will be towards 0 -10
=FLOOR.MATH(11.5;-1) rounds down 11.5 to nearest multiple of 1, ignoring the sign 11

Related LibreOffice functions:

FLOOR

FLOOR.PRECISE

FLOOR.XCL

CEILING

INT

ODF standard:

None

Equivalent Excel functions:

FLOOR.MATH