PHPExcel classes » \PHPExcel_Calculation_MathTrig

PHPExcel_Calculation_MathTrig

category | PHPExcel
package | PHPExcel_Calculation
copyright | Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

## ATAN2

    ATAN2(float $xCoordinate, float $yCoordinate) : float

Static

This function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y ÷ x, except that the signs of both arguments are used to determine the quadrant of the result. The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between -pi and pi, excluding -pi.

Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard PHP atan2() function, so we need to reverse them here before calling the PHP atan() function.

Excel Function: ATAN2(xCoordinate,yCoordinate)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $xCoordinate

`float`

The x-coordinate of the point.

#### $yCoordinate

`float`

The y-coordinate of the point.

### Returns

`float`The inverse tangent of the specified x- and y-coordinates.

## CEILING

    CEILING(float $number, float $significance) : float

Static

Returns number rounded up, away from zero, to the nearest multiple of significance. For example, if you want to avoid using pennies in your prices and your product is priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the nearest nickel.

Excel Function: CEILING(number[,significance])

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $number

`float`

The number you want to round.

#### $significance

`float`

The multiple to which you want to round.

### Returns

`float`Rounded Number

## COMBIN

    COMBIN(int $numObjs, int $numInSet) : int

Static

Returns the number of combinations for a given number of items. Use COMBIN to determine the total possible number of groups for a given number of items.

Excel Function: COMBIN(numObjs,numInSet)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $numObjs

`int`

Number of different objects

#### $numInSet

`int`

Number of objects in each combination

### Returns

`int`Number of combinations

## EVEN

    EVEN(float $number) : int

Static

Returns number rounded up to the nearest even integer. You can use this function for processing items that come in twos. For example, a packing crate accepts rows of one or two items. The crate is full when the number of items, rounded up to the nearest two, matches the crate's capacity.

Excel Function: EVEN(number)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $number

`float`

Number to round

### Returns

`int`Rounded Number

## FACT

    FACT(float $factVal) : int

Static

Returns the factorial of a number. The factorial of a number is equal to 123... number.

Excel Function: FACT(factVal)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $factVal

`float`

Factorial Value

### Returns

`int`Factorial

## FACTDOUBLE

    FACTDOUBLE(float $factVal) : int

Static

Returns the double factorial of a number.

Excel Function: FACTDOUBLE(factVal)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $factVal

`float`

Factorial Value

### Returns

`int`Double Factorial

## FLOOR

    FLOOR(float $number, float $significance) : float

Static

Rounds number down, toward zero, to the nearest multiple of significance.

Excel Function: FLOOR(number[,significance])

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $number

`float`

Number to round

#### $significance

`float`

Significance

### Returns

`float`Rounded Number

## GCD

    GCD() : integer

Static

Returns the greatest common divisor of a series of numbers. The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder.

Excel Function: GCD(number1[,number2[, ...]])

access | public
category | Mathematical and Trigonometric Functions

### Returns

`integer`Greatest Common Divisor

## INT

    INT(float $number) : integer

Static

Casts a floating point value to an integer

Excel Function: INT(number)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $number

`float`

Number to cast to an integer

### Returns

`integer`Integer value

## LCM

    LCM() : int

Static

Returns the lowest common multiplier of a series of numbers The least common multiple is the smallest positive integer that is a multiple of all integer arguments number1, number2, and so on. Use LCM to add fractions with different denominators.

Excel Function: LCM(number1[,number2[, ...]])

access | public
category | Mathematical and Trigonometric Functions

### Returns

`int`Lowest Common Multiplier

## LOG_BASE

    LOG_BASE(float $number, float $base) : float

Static

Returns the logarithm of a number to a specified base. The default base is 10.

Excel Function: LOG(number[,base])

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $number

`float`

The positive real number for which you want the logarithm

#### $base

`float`

The base of the logarithm. If base is omitted, it is assumed to be 10.

### Returns

`float`

## MDETERM

    MDETERM(array $matrixValues) : float

Static

Returns the matrix determinant of an array.

Excel Function: MDETERM(array)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $matrixValues

`array`

A matrix of values

### Returns

`float`

## MINVERSE

    MINVERSE(array $matrixValues) : array

Static

Returns the inverse matrix for the matrix stored in an array.

Excel Function: MINVERSE(array)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $matrixValues

`array`

A matrix of values

### Returns

`array`

## MMULT

    MMULT(array $matrixData1, array $matrixData2) : array

Static

### Parameters

#### $matrixData1

`array`

A matrix of values

#### $matrixData2

`array`

A matrix of values

### Returns

`array`

## MOD

    MOD(int $a, int $b) : int

Static

### Parameters

#### $a

`int`

Dividend

#### $b

`int`

Divisor

### Returns

`int`Remainder

## MROUND

    MROUND(float $number, int $multiple) : float

Static

Rounds a number to the nearest multiple of a specified value

### Parameters

#### $number

`float`

Number to round

#### $multiple

`int`

Multiple to which you want to round $number

### Returns

`float`Rounded Number

## MULTINOMIAL

    MULTINOMIAL() : float

Static

Returns the ratio of the factorial of a sum of values to the product of factorials.

### Returns

`float`

## ODD

    ODD(float $number) : int

Static

Returns number rounded up to the nearest odd integer.

### Parameters

#### $number

`float`

Number to round

### Returns

`int`Rounded Number

## POWER

    POWER(float $x, float $y) : float

Static

Computes x raised to the power y.

### Parameters

#### $x

`float`

#### $y

`float`

### Returns

`float`

## PRODUCT

    PRODUCT() : float

Static

PRODUCT returns the product of all the values and cells referenced in the argument list.

Excel Function: PRODUCT(value1[,value2[, ...]])

access | public
category | Mathematical and Trigonometric Functions

### Returns

`float`

## QUOTIENT

    QUOTIENT() : float

Static

QUOTIENT function returns the integer portion of a division. Numerator is the divided number and denominator is the divisor.

Excel Function: QUOTIENT(value1[,value2[, ...]])

access | public
category | Mathematical and Trigonometric Functions

### Returns

`float`

## RAND

    RAND(int $min, int $max) : int

Static

### Parameters

#### $min

`int`

Minimal value

#### $max

`int`

Maximal value

### Returns

`int`Random number

## ROMAN()

    ROMAN($aValue, $style)

Static

### Parameters

#### $aValue

#### $style

## ROUNDDOWN

    ROUNDDOWN(float $number, int $digits) : float

Static

Rounds a number down to a specified number of decimal places

### Parameters

#### $number

`float`

Number to round

#### $digits

`int`

Number of digits to which you want to round $number

### Returns

`float`Rounded Number

## ROUNDUP

    ROUNDUP(float $number, int $digits) : float

Static

Rounds a number up to a specified number of decimal places

### Parameters

#### $number

`float`

Number to round

#### $digits

`int`

Number of digits to which you want to round $number

### Returns

`float`Rounded Number

## SERIESSUM

    SERIESSUM() : float

Static

Returns the sum of a power series

### Returns

`float`

## SIGN

    SIGN(float $number) : int

Static

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

### Parameters

#### $number

`float`

Number to round

### Returns

`int`sign value

## SQRTPI

    SQRTPI(float $number) : float

Static

Returns the square root of (number * pi).

### Parameters

#### $number

`float`

Number

### Returns

`float`Square Root of Number * Pi

## SUBTOTAL

    SUBTOTAL() : float

Static

Returns a subtotal in a list or database.

### Returns

`float`

## SUM

    SUM() : float

Static

SUM computes the sum of all the values and cells referenced in the argument list.

Excel Function: SUM(value1[,value2[, ...]])

access | public
category | Mathematical and Trigonometric Functions

### Returns

`float`

## SUMIF

    SUMIF($aArgs, string $condition, $sumArgs) : float

Static

Counts the number of cells that contain numbers within the list of arguments

Excel Function: SUMIF(value1[,value2[, ...]],condition)

access | public
category | Mathematical and Trigonometric Functions

### Parameters

#### $aArgs

#### $condition

`string`

The criteria that defines which cells will be summed.

#### $sumArgs

### Returns

`float`

## SUMPRODUCT

    SUMPRODUCT() : float

Static

Excel Function: SUMPRODUCT(value1[,value2[, ...]])

access | public
category | Mathematical and Trigonometric Functions

### Returns

`float`

## SUMSQ

    SUMSQ() : float

Static

SUMSQ returns the sum of the squares of the arguments

Excel Function: SUMSQ(value1[,value2[, ...]])

access | public
category | Mathematical and Trigonometric Functions

### Returns

`float`

## SUMX2MY2

    SUMX2MY2(mixed[] $matrixData1, mixed[] $matrixData2) : float

Static

### Parameters

#### $matrixData1

`mixed[]`

Matrix #1

#### $matrixData2

`mixed[]`

Matrix #2

### Returns

`float`

## SUMX2PY2

    SUMX2PY2(mixed[] $matrixData1, mixed[] $matrixData2) : float

Static

### Parameters

#### $matrixData1

`mixed[]`

Matrix #1

#### $matrixData2

`mixed[]`

Matrix #2

### Returns

`float`

## SUMXMY2

    SUMXMY2(mixed[] $matrixData1, mixed[] $matrixData2) : float

Static

### Parameters

#### $matrixData1

`mixed[]`

Matrix #1

#### $matrixData2

`mixed[]`

Matrix #2

### Returns

`float`

## TRUNC

    TRUNC(float $value, int $digits) : float

Static

Truncates value to the number of fractional digits by number_digits.

### Parameters

#### $value

`float`

#### $digits

`int`

### Returns

`float`Truncated value

## _factors()

    _factors($value)

Static

### Parameters

#### $value

## _romanCut()

    _romanCut($num, $n)

Static

### Parameters

#### $num

#### $n