# Mathematical Functions in LibreOffice

## Mathematical

This category contains the Mathematical functions for Calc.

### 1 ABS

Returns the absolute value of a number.

### Syntax

ABS(Number)

Number is the number whose absolute value is to be calculated. The absolute value of a number is its value without the +/- sign.

### Example

=ABS(-56) returns 56.

=ABS(12) returns 12.

=ABS(0) returns 0.

### 2 CEILING

Rounds a number up to the nearest multiple of Significance.

### Syntax

CEILING(Number; Significance; Mode)

Number is the number that is to be rounded up.

Significance is the number to whose multiple the value is to be rounded up.

Mode is an optional value. If the Mode value is given and not equal to zero, and if Number and Significance are negative,

### Example

=CEILING(-11;-2) returns -10

=CEILING(-11;-2;0) returns -10

=CEILING(-11;-2;1) returns -12

### Syntax

DEGREES(Number)

Number is the angle in radians to be converted to degrees.

### Example

=DEGREES(PI()) returns 180 degrees.

### 4 EVEN

Rounds a positive number up to the next even integer and a negative number down to the next even integer.

### Syntax

EVEN(Number)

Returns Number rounded to the next even integer up, away from zero.

### Example

=EVEN(2.3) returns 4.

=EVEN(2) returns 2.

=EVEN(0) returns 0.

=EVEN(-0.5) returns -2.

### 4 EXP

Returns e raised to the power of a number. The constant e has a value of approximately 2.71828182845904.

### Syntax

EXP(Number)

Number is the power to which e is to be raised.

### Example

=EXP(1) returns 2.71828182845904, the mathematical constant e to Calc’s accuracy.

### 5 FACT

Returns the factorial of a number.

### Syntax

FACT(Number)

Returns Number!, the factorial of Number, calculated as 1*2*3*4* … * Number.

=FACT(0) returns 1 by definition.

The factorial of a negative number returns the “invalid argument” error.

### Example

=FACT(3) returns 6.

=FACT(0) returns 1.

### 6 GCD

Returns the greatest common divisor of two or more integers.

The greatest common divisor is the positive largest integer which will divide, without remainder, each of the given integers.

### Syntax

GCD(Integer1; Integer2; …; Integer30)

Integer1 To 30 are up to 30 integers whose greatest common divisor is to be calculated.

### Example

=GCD(16;32;24) gives the result 8, because 8 is the largest number that can divide 16, 24 and 32 without a remainder.

=GCD(B1:B3) where cells B1, B2, B3 contain 9129 gives 3.

### 7 INT

Rounds a number down to the nearest integer.

### Syntax

INT(Number)

Returns Number rounded down to the nearest integer.

Negative numbers round down to the integer below.

### Example

=INT(5.7) returns 5.

=INT(-1.3) returns -2.

### 8 LCM

Returns the least common multiple of one or more integers.

### Syntax

LCM(Integer1; Integer2; …; Integer30)

Integer1 to 30 are up to 30 integers whose lowest common multiple is to be calculated.

### Example

If you enter the numbers 512;1024 and 2000 in the Integer 1;2 and 3 text boxes, 128000 will be returned as the result.

### 9 LN

Returns the natural logarithm based on the constant e of a number. The constant e has a value of approximately 2.71828182845904.

### Syntax

LN(Number)

Number is the value whose natural logarithm is to be calculated.

### Example

=LN(3) returns the natural logarithm of 3 (approximately 1.0986).

=LN(EXP(321)) returns 321.

### 10 LOG

Returns the logarithm of a number to the specified base.

### Syntax

LOG(Number; Base)

Number is the value whose logarithm is to be calculated.

Base (optional) is the base for the logarithm calculation. If omitted, Base 10 is assumed.

### Example

=LOG(10;3) returns the logarithm to base 3 of 10 (approximately 2.0959).

=LOG(7^4;7) returns 4.

### 11 LOG10

Returns the base-10 logarithm of a number.

### Syntax

LOG10(Number)

Returns the logarithm to base 10 of Number.

### Example

=LOG10(5) returns the base-10 logarithm of 5 (approximately 0.69897).

### 12 MOD

Returns the remainder when one integer is divided by another.

### Syntax

MOD(Dividend; Divisor)

For integer arguments this function returns Dividend modulo Divisor, that is the remainder when Dividend is divided by Divisor.

This function is implemented as Dividend – Divisor * INT(Dividend/Divisor) , and this formula gives the result if the arguments are not integer.

### Example

=MOD(22;3) returns 1, the remainder when 22 is divided by 3.

=MOD(11.25;2.5) returns 1.25.

### 13 MULTINOMIAL

Returns the factorial of the sum of the arguments divided by the product of the factorials of the arguments.

### Syntax

MULTINOMIAL(Number(s))

Number(s) is a list of up to 30 numbers.

### Example

=MULTINOMIAL(F11:H11) returns 1260, if F11 to H11 contain the values 23 and 4. This corresponds to the formula =(2+3+4)! / (2!*3!*4!)

### 14 ODD

Rounds a positive number up to the nearest odd integer and a negative number down to the nearest odd integer.

### Syntax

ODD(Number)

Returns Number rounded to the next odd integer up, away from zero.

### Example

=ODD(1.2) returns 3.

=ODD(1) returns 1.

=ODD(0) returns 1.

=ODD(-3.1) returns -5.

### 15 PI

Returns 3.14159265358979, the value of the mathematical constant PI to 14 decimal places.

PI()

### Example

=PI() returns 3.14159265358979.

### 16 POWER

Returns a number raised to another number.

### Syntax

POWER(Base; Exponent)

Returns Base raised to the power of Exponent.

The same result may be achieved by using the exponentiation operator ^:

Base^Exponent

### Example

=POWER(4;3) returns 64, which is 4 to the power of 3.

=4^3 also returns 4 to the power of 3.

### 17 PRODUCT

Multiplies all the numbers given as arguments and returns the product.

### Syntax

PRODUCT(Number1; Number2; …; Number30)

Number1 to 30 are up to 30 arguments whose product is to be calculated.

PRODUCT returns number1 * number2 * number3 * …

### Example

=PRODUCT(2;3;4) returns 24.

### 18 RAND

Returns a random number between 0 and 1.

### Syntax

RAND()

This function produces a new random number each time Calc recalculates. To force Calc to recalculate manually press F9.

To generate random numbers which never recalculate, copy cells each containing =RAND(), and use Edit – Paste Special (with Paste All and Formulas not marked and Numbers marked).

### Example

=RAND() returns a random number between 0 and 1.

### 19 ROUND

Rounds a number to a certain number of decimal places.

### Syntax

ROUND(Number; Count)

Returns Number rounded to Count decimal places. If Count is omitted or zero, the function rounds to the nearest integer. If Count is negative, the function rounds to the nearest 10, 100, 1000, etc.

This function rounds to the nearest number. See ROUNDDOWN and ROUNDUP for alternatives.

### Example

=ROUND(2.348;2) returns 2.35

=ROUND(-32.4834;3) returns -32.483. Change the cell format to see all decimals.

=ROUND(2.348;0) returns 2.

=ROUND(2.5) returns 3.

=ROUND(987.65;-2) returns 1000.

### 20 SIGN

Returns the sign of a number. Returns 1 if the number is positive, -1 if negative and 0 if zero.

### Syntax

SIGN(Number)

Number is the number whose sign is to be determined.

### Example

=SIGN(3.4) returns 1.

=SIGN(-4.5) returns -1.

### 21 SQRT

Returns the positive square root of a number.

### Syntax

SQRT(Number)

Returns the positive square root of Number.

Number must be positive.

### Example

=SQRT(16) returns 4.

=SQRT(-16) returns an invalid argument error.

### 22 SQRTPI

Returns the square root of (PI times a number).

### Syntax

SQRTPI(Number)

Returns the positive square root of (PI multiplied by Number).

This is equivalent to SQRT(PI()*Number).

### Example

=SQRTPI(2) returns the squareroot of (2PI), approximately 2.506628.

### 23 SUM

Adds all the numbers in a range of cells.

### Syntax

SUM(Number1; Number2; …; Number30)

Number 1 to Number 30 are up to 30 arguments whose sum is to be calculated.

### Example

If you enter the numbers 2and 4 in the Number 1; 2 and 3 text boxes, 9 will be returned as the result.

=SUM(A1;A3;B5) calculates the sum of the three cells. =SUM (A1:E10) calculates the sum of all cells in the A1 to E10 cell range.

### 24 SUMIF

Adds the cells specified by a given criteria. This function is used to browse a range when you search for a certain value.

### Syntax

SUMIF(Range; Criteria; SumRange)

Range is the range to which the criteria are to be applied.

Criteria is the cell in which the search criterion is shown, or the search criterion itself. If the criteria is written into the formula, it has to be surrounded by double quotes.

SumRange is the range from which values are summed. If this parameter has not been indicated, the values found in the Range are summed.

### Example

To sum up only negative numbers: =SUMIF(A1:A10;”<0″)

=SUMIF(A1:A10;”>0″;B1:10) – sums values from the range B1:B10 only if the corresponding values in the range A1:A10 are >0.

See COUNTIF() for some more syntax examples that can be used with SUMIF().

### 25 SUMSQ

If you want to calculate the sum of the squares of numbers (totaling up of the squares of the arguments), enter these into the text fields.

### Syntax

SUMSQ(Number1; Number2; …; Number30)

Number1 to 30 are up to 30 arguments the sum of whose squares is to be calculated.

### Example

If you enter the numbers 23 and 4 in the Number 1; 2 and 3 text boxes, 29 is returned as the result.

All Libreoffice calc functions credit goes to libreoffice