\PHPExcel_Calculation_Financial

PHPExcel_Calculation_Financial

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Summary

Methods
Properties
Constants
ACCRINT()
ACCRINTM()
AMORDEGRC()
AMORLINC()
COUPDAYBS()
COUPDAYS()
COUPDAYSNC()
COUPNCD()
COUPNUM()
COUPPCD()
CUMIPMT()
CUMPRINC()
DB()
DDB()
DISC()
DOLLARDE()
DOLLARFR()
EFFECT()
FV()
FVSCHEDULE()
INTRATE()
IPMT()
IRR()
ISPMT()
MIRR()
NOMINAL()
NPER()
NPV()
PMT()
PPMT()
PRICE()
PRICEDISC()
PRICEMAT()
PV()
RATE()
RECEIVED()
SLN()
SYD()
TBILLEQ()
TBILLPRICE()
TBILLYIELD()
XIRR()
XNPV()
YIELDDISC()
YIELDMAT()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
isLastDayOfMonth()
isFirstDayOfMonth()
couponFirstPeriodDate()
isValidFrequency()
daysPerYear()
interestAndPrincipal()
No private properties found
N/A

Methods

ACCRINT()

ACCRINT(mixed  $issue, mixed  $firstinterest, mixed  $settlement, float  $rate, float  $par = 1000, integer  $frequency = 1, integer  $basis) : float

ACCRINT

Returns the accrued interest for a security that pays periodic interest.

Excel Function: ACCRINT(issue,firstinterest,settlement,rate,par,frequency[,basis])

Parameters

mixed $issue

The security's issue date.

mixed $firstinterest

The security's first interest date.

mixed $settlement

The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.

float $rate

The security's annual coupon rate.

float $par

The security's par value. If you omit par, ACCRINT uses $1,000.

integer $frequency

the number of coupon payments per year. Valid frequency values are: 1 Annual 2 Semi-Annual 4 Quarterly If working in Gnumeric Mode, the following frequency options are also available 6 Bimonthly 12 Monthly

integer $basis

The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360

Returns

float

ACCRINTM()

ACCRINTM(  $issue,   $settlement,   $rate,   $par = 1000,   $basis) : float

ACCRINTM

Returns the accrued interest for a security that pays interest at maturity.

Excel Function: ACCRINTM(issue,settlement,rate[,par[,basis]])

Parameters

$issue
$settlement
$rate
$par
$basis

Returns

float

AMORDEGRC()

AMORDEGRC(  $cost,   $purchased,   $firstPeriod,   $salvage,   $period,   $rate,   $basis) : float

AMORDEGRC

Returns the depreciation for each accounting period. This function is provided for the French accounting system. If an asset is purchased in the middle of the accounting period, the prorated depreciation is taken into account. The function is similar to AMORLINC, except that a depreciation coefficient is applied in the calculation depending on the life of the assets. This function will return the depreciation until the last period of the life of the assets or until the cumulated value of depreciation is greater than the cost of the assets minus the salvage value.

Excel Function: AMORDEGRC(cost,purchased,firstPeriod,salvage,period,rate[,basis])

Parameters

$cost
$purchased
$firstPeriod
$salvage
$period
$rate
$basis

Returns

float

AMORLINC()

AMORLINC(  $cost,   $purchased,   $firstPeriod,   $salvage,   $period,   $rate,   $basis) : float

AMORLINC

Returns the depreciation for each accounting period. This function is provided for the French accounting system. If an asset is purchased in the middle of the accounting period, the prorated depreciation is taken into account.

Excel Function: AMORLINC(cost,purchased,firstPeriod,salvage,period,rate[,basis])

Parameters

$cost
$purchased
$firstPeriod
$salvage
$period
$rate
$basis

Returns

float

COUPDAYBS()

COUPDAYBS(  $settlement,   $maturity,   $frequency,   $basis) : float

COUPDAYBS

Returns the number of days from the beginning of the coupon period to the settlement date.

Excel Function: COUPDAYBS(settlement,maturity,frequency[,basis])

Parameters

$settlement
$maturity
$frequency
$basis

Returns

float

COUPDAYS()

COUPDAYS(  $settlement,   $maturity,   $frequency,   $basis) : float

COUPDAYS

Returns the number of days in the coupon period that contains the settlement date.

Excel Function: COUPDAYS(settlement,maturity,frequency[,basis])

Parameters

$settlement
$maturity
$frequency
$basis

Returns

float

COUPDAYSNC()

COUPDAYSNC(  $settlement,   $maturity,   $frequency,   $basis) : float

COUPDAYSNC

Returns the number of days from the settlement date to the next coupon date.

Excel Function: COUPDAYSNC(settlement,maturity,frequency[,basis])

Parameters

$settlement
$maturity
$frequency
$basis

Returns

float

COUPNCD()

COUPNCD(  $settlement,   $maturity,   $frequency,   $basis) : mixed

COUPNCD

Returns the next coupon date after the settlement date.

Excel Function: COUPNCD(settlement,maturity,frequency[,basis])

Parameters

$settlement
$maturity
$frequency
$basis

Returns

mixed —

Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

COUPNUM()

COUPNUM(  $settlement,   $maturity,   $frequency,   $basis) : integer

COUPNUM

Returns the number of coupons payable between the settlement date and maturity date, rounded up to the nearest whole coupon.

Excel Function: COUPNUM(settlement,maturity,frequency[,basis])

Parameters

$settlement
$maturity
$frequency
$basis

Returns

integer

COUPPCD()

COUPPCD(  $settlement,   $maturity,   $frequency,   $basis) : mixed

COUPPCD

Returns the previous coupon date before the settlement date.

Excel Function: COUPPCD(settlement,maturity,frequency[,basis])

Parameters

$settlement
$maturity
$frequency
$basis

Returns

mixed —

Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

CUMIPMT()

CUMIPMT(float  $rate, integer  $nper, float  $pv, integer  $start, integer  $end, integer  $type) : float

CUMIPMT

Returns the cumulative interest paid on a loan between the start and end periods.

Excel Function: CUMIPMT(rate,nper,pv,start,end[,type])

Parameters

float $rate

The Interest rate

integer $nper

The total number of payment periods

float $pv

Present Value

integer $start

The first period in the calculation. Payment periods are numbered beginning with 1.

integer $end

The last period in the calculation.

integer $type

A number 0 or 1 and indicates when payments are due: 0 or omitted At the end of the period. 1 At the beginning of the period.

Returns

float

CUMPRINC()

CUMPRINC(float  $rate, integer  $nper, float  $pv, integer  $start, integer  $end, integer  $type) : float

CUMPRINC

Returns the cumulative principal paid on a loan between the start and end periods.

Excel Function: CUMPRINC(rate,nper,pv,start,end[,type])

Parameters

float $rate

The Interest rate

integer $nper

The total number of payment periods

float $pv

Present Value

integer $start

The first period in the calculation. Payment periods are numbered beginning with 1.

integer $end

The last period in the calculation.

integer $type

A number 0 or 1 and indicates when payments are due: 0 or omitted At the end of the period. 1 At the beginning of the period.

Returns

float

DB()

DB(  $cost,   $salvage,   $life,   $period,   $month = 12) : float

DB

Returns the depreciation of an asset for a specified period using the fixed-declining balance method. This form of depreciation is used if you want to get a higher depreciation value at the beginning of the depreciation (as opposed to linear depreciation). The depreciation value is reduced with every depreciation period by the depreciation already deducted from the initial cost.

Excel Function: DB(cost,salvage,life,period[,month])

Parameters

$cost
$salvage
$life
$period
$month

Returns

float

DDB()

DDB(  $cost,   $salvage,   $life,   $period,   $factor = 2.0) : float

DDB

Returns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify.

Excel Function: DDB(cost,salvage,life,period[,factor])

Parameters

$cost
$salvage
$life
$period
$factor

Returns

float

DISC()

DISC(  $settlement,   $maturity,   $price,   $redemption,   $basis) : float

DISC

Returns the discount rate for a security.

Excel Function: DISC(settlement,maturity,price,redemption[,basis])

Parameters

$settlement
$maturity
$price
$redemption
$basis

Returns

float

DOLLARDE()

DOLLARDE(float  $fractional_dollar = null, integer  $fraction) : float

DOLLARDE

Converts a dollar price expressed as an integer part and a fraction part into a dollar price expressed as a decimal number. Fractional dollar numbers are sometimes used for security prices.

Excel Function: DOLLARDE(fractional_dollar,fraction)

Parameters

float $fractional_dollar

Fractional Dollar

integer $fraction

Fraction

Returns

float

DOLLARFR()

DOLLARFR(float  $decimal_dollar = null, integer  $fraction) : float

DOLLARFR

Converts a dollar price expressed as a decimal number into a dollar price expressed as a fraction. Fractional dollar numbers are sometimes used for security prices.

Excel Function: DOLLARFR(decimal_dollar,fraction)

Parameters

float $decimal_dollar

Decimal Dollar

integer $fraction

Fraction

Returns

float

EFFECT()

EFFECT(float  $nominal_rate, integer  $npery) : float

EFFECT

Returns the effective interest rate given the nominal rate and the number of compounding payments per year.

Excel Function: EFFECT(nominal_rate,npery)

Parameters

float $nominal_rate

Nominal interest rate

integer $npery

Number of compounding payments per year

Returns

float

FV()

FV(float  $rate, integer  $nper, float  $pmt, float  $pv, integer  $type) : float

FV

Returns the Future Value of a cash flow with constant payments and interest rate (annuities).

Excel Function: FV(rate,nper,pmt[,pv[,type]])

Parameters

float $rate

The interest rate per period

integer $nper

Total number of payment periods in an annuity

float $pmt

The payment made each period: it cannot change over the life of the annuity. Typically, pmt contains principal and interest but no other fees or taxes.

float $pv

Present Value, or the lump-sum amount that a series of future payments is worth right now.

integer $type

A number 0 or 1 and indicates when payments are due: 0 or omitted At the end of the period. 1 At the beginning of the period.

Returns

float

FVSCHEDULE()

FVSCHEDULE(float  $principal, array<mixed,float>  $schedule) : float

FVSCHEDULE

Returns the future value of an initial principal after applying a series of compound interest rates. Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate.

Excel Function: FVSCHEDULE(principal,schedule)

Parameters

float $principal

The present value.

array<mixed,float> $schedule

An array of interest rates to apply.

Returns

float

INTRATE()

INTRATE(mixed  $settlement, mixed  $maturity, integer  $investment, integer  $redemption, integer  $basis) : float

INTRATE

Returns the interest rate for a fully invested security.

Excel Function: INTRATE(settlement,maturity,investment,redemption[,basis])

Parameters

mixed $settlement

The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.

mixed $maturity

The security's maturity date. The maturity date is the date when the security expires.

integer $investment

The amount invested in the security.

integer $redemption

The amount to be received at maturity.

integer $basis

The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360

Returns

float

IPMT()

IPMT(float  $rate, integer  $per, integer  $nper, float  $pv, float  $fv, integer  $type) : float

IPMT

Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.

Excel Function: IPMT(rate,per,nper,pv[,fv][,type])

Parameters

float $rate

Interest rate per period

integer $per

Period for which we want to find the interest

integer $nper

Number of periods

float $pv

Present Value

float $fv

Future Value

integer $type

Payment type: 0 = at the end of each period, 1 = at the beginning of each period

Returns

float

IRR()

IRR(array<mixed,float>  $values, float  $guess = 0.1) : float

IRR

Returns the internal rate of return for a series of cash flows represented by the numbers in values. These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received for an investment consisting of payments (negative values) and income (positive values) that occur at regular periods.

Excel Function: IRR(values[,guess])

Parameters

array<mixed,float> $values

An array or a reference to cells that contain numbers for which you want to calculate the internal rate of return. Values must contain at least one positive value and one negative value to calculate the internal rate of return.

float $guess

A number that you guess is close to the result of IRR

Returns

float

ISPMT()

ISPMT() 

ISPMT

Returns the interest payment for an investment based on an interest rate and a constant payment schedule.

Excel Function: =ISPMT(interest_rate, period, number_payments, PV)

interest_rate is the interest rate for the investment

period is the period to calculate the interest rate. It must be betweeen 1 and number_payments.

number_payments is the number of payments for the annuity

PV is the loan amount or present value of the payments

MIRR()

MIRR(array<mixed,float>  $values, float  $finance_rate, float  $reinvestment_rate) : float

MIRR

Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both the cost of the investment and the interest received on reinvestment of cash.

Excel Function: MIRR(values,finance_rate, reinvestment_rate)

Parameters

array<mixed,float> $values

An array or a reference to cells that contain a series of payments and income occurring at regular intervals. Payments are negative value, income is positive values.

float $finance_rate

The interest rate you pay on the money used in the cash flows

float $reinvestment_rate

The interest rate you receive on the cash flows as you reinvest them

Returns

float

NOMINAL()

NOMINAL(float  $effect_rate, integer  $npery) : float

NOMINAL

Returns the nominal interest rate given the effective rate and the number of compounding payments per year.

Parameters

float $effect_rate

Effective interest rate

integer $npery

Number of compounding payments per year

Returns

float

NPER()

NPER(float  $rate, integer  $pmt, float  $pv, float  $fv, integer  $type) : float

NPER

Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate.

Parameters

float $rate

Interest rate per period

integer $pmt

Periodic payment (annuity)

float $pv

Present Value

float $fv

Future Value

integer $type

Payment type: 0 = at the end of each period, 1 = at the beginning of each period

Returns

float

NPV()

NPV() : float

NPV

Returns the Net Present Value of a cash flow series given a discount rate.

Returns

float

PMT()

PMT(float  $rate, integer  $nper, float  $pv, float  $fv, integer  $type) : float

PMT

Returns the constant payment (annuity) for a cash flow with a constant interest rate.

Parameters

float $rate

Interest rate per period

integer $nper

Number of periods

float $pv

Present Value

float $fv

Future Value

integer $type

Payment type: 0 = at the end of each period, 1 = at the beginning of each period

Returns

float

PPMT()

PPMT(float  $rate, integer  $per, integer  $nper, float  $pv, float  $fv, integer  $type) : float

PPMT

Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.

Parameters

float $rate

Interest rate per period

integer $per

Period for which we want to find the interest

integer $nper

Number of periods

float $pv

Present Value

float $fv

Future Value

integer $type

Payment type: 0 = at the end of each period, 1 = at the beginning of each period

Returns

float

PRICE()

PRICE(  $settlement,   $maturity,   $rate,   $yield,   $redemption,   $frequency,   $basis) 

Parameters

$settlement
$maturity
$rate
$yield
$redemption
$frequency
$basis

PRICEDISC()

PRICEDISC(  $settlement,   $maturity,   $discount,   $redemption,   $basis) : float

PRICEDISC

Returns the price per $100 face value of a discounted security.

Parameters

$settlement
$maturity
$discount
$redemption
$basis

Returns

float

PRICEMAT()

PRICEMAT(  $settlement,   $maturity,   $issue,   $rate,   $yield,   $basis) : float

PRICEMAT

Returns the price per $100 face value of a security that pays interest at maturity.

Parameters

$settlement
$maturity
$issue
$rate
$yield
$basis

Returns

float

PV()

PV(float  $rate, integer  $nper, float  $pmt, float  $fv, integer  $type) : float

PV

Returns the Present Value of a cash flow with constant payments and interest rate (annuities).

Parameters

float $rate

Interest rate per period

integer $nper

Number of periods

float $pmt

Periodic payment (annuity)

float $fv

Future Value

integer $type

Payment type: 0 = at the end of each period, 1 = at the beginning of each period

Returns

float

RATE()

RATE(  $nper,   $pmt,   $pv,   $fv = 0.0,   $type,   $guess = 0.1) : float

RATE

Returns the interest rate per period of an annuity. RATE is calculated by iteration and can have zero or more solutions. If the successive results of RATE do not converge to within 0.0000001 after 20 iterations, RATE returns the #NUM! error value.

Excel Function: RATE(nper,pmt,pv[,fv[,type[,guess]]])

Parameters

$nper
$pmt
$pv
$fv
$type
$guess

Returns

float

RECEIVED()

RECEIVED(  $settlement,   $maturity,   $investment,   $discount,   $basis) : float

RECEIVED

Returns the price per $100 face value of a discounted security.

Parameters

$settlement
$maturity
$investment
$discount
$basis

Returns

float

SLN()

SLN(  $cost,   $salvage,   $life) : float

SLN

Returns the straight-line depreciation of an asset for one period

Parameters

$cost
$salvage
$life

Returns

float

SYD()

SYD(  $cost,   $salvage,   $life,   $period) : float

SYD

Returns the sum-of-years' digits depreciation of an asset for a specified period.

Parameters

$cost
$salvage
$life
$period

Returns

float

TBILLEQ()

TBILLEQ(  $settlement,   $maturity,   $discount) : float

TBILLEQ

Returns the bond-equivalent yield for a Treasury bill.

Parameters

$settlement
$maturity
$discount

Returns

float

TBILLPRICE()

TBILLPRICE(  $settlement,   $maturity,   $discount) : float

TBILLPRICE

Returns the yield for a Treasury bill.

Parameters

$settlement
$maturity
$discount

Returns

float

TBILLYIELD()

TBILLYIELD(  $settlement,   $maturity,   $price) : float

TBILLYIELD

Returns the yield for a Treasury bill.

Parameters

$settlement
$maturity
$price

Returns

float

XIRR()

XIRR(  $values,   $dates,   $guess = 0.1) 

Parameters

$values
$dates
$guess

XNPV()

XNPV(float  $rate,   $values,   $dates) : float

XNPV

Returns the net present value for a schedule of cash flows that is not necessarily periodic. To calculate the net present value for a series of cash flows that is periodic, use the NPV function.

Excel Function: =XNPV(rate,values,dates)

Parameters

float $rate

The discount rate to apply to the cash flows.

$values
$dates

Returns

float

YIELDDISC()

YIELDDISC(  $settlement,   $maturity,   $price,   $redemption,   $basis) : float

YIELDDISC

Returns the annual yield of a security that pays interest at maturity.

Parameters

$settlement
$maturity
$price
$redemption
$basis

Returns

float

YIELDMAT()

YIELDMAT(  $settlement,   $maturity,   $issue,   $rate,   $price,   $basis) : float

YIELDMAT

Returns the annual yield of a security that pays interest at maturity.

Parameters

$settlement
$maturity
$issue
$rate
$price
$basis

Returns

float

isLastDayOfMonth()

isLastDayOfMonth(\DateTime  $testDate) : boolean

isLastDayOfMonth

Returns a boolean TRUE/FALSE indicating if this date is the last date of the month

Parameters

\DateTime $testDate

The date for testing

Returns

boolean

isFirstDayOfMonth()

isFirstDayOfMonth(\DateTime  $testDate) : boolean

isFirstDayOfMonth

Returns a boolean TRUE/FALSE indicating if this date is the first date of the month

Parameters

\DateTime $testDate

The date for testing

Returns

boolean

couponFirstPeriodDate()

couponFirstPeriodDate(  $settlement,   $maturity,   $frequency,   $next) 

Parameters

$settlement
$maturity
$frequency
$next

isValidFrequency()

isValidFrequency(  $frequency) 

Parameters

$frequency

daysPerYear()

daysPerYear(integer  $year, integer  $basis) : integer

daysPerYear

Returns the number of days in a specified year, as defined by the "basis" value

Parameters

integer $year

The year against which we're testing

integer $basis

The type of day count: 0 or omitted US (NASD) 360 1 Actual (365 or 366 in a leap year) 2 360 3 365 4 European 360

Returns

integer

interestAndPrincipal()

interestAndPrincipal(  $rate,   $per,   $nper,   $pv,   $fv,   $type) 

Parameters

$rate
$per
$nper
$pv
$fv
$type