Business Functions Library for Excel

    1. Introduction
      1. Introduction
      2. DYear
      3. DMonth
      4. DateYMD
      5. DateSeqNum
      6. IsSeqDate
      7. DayName
      8. MonthName
      9. IsLeap
      10. DaysInMonth
      11. IsAnniversary
      12. WeekNumber
      13. WeekNumberToDate
      14. MonthStart
      15. MonthEnd
      16. NumPers
      17. MostRecent
      18. MostImminent
      19. TimeBaseLengths
      20. AnnSeq
      21. CreateTimeBase
      1. Introduction
      2. DiffY
      3. DiffM
      4. DiffD
      5. DiffP
      1. Introduction
      2. DpY
      3. DpM
      4. DpD
      5. DpP
      6. PrevDateSeq
      7. NextDateSeq
      8. PrevDateList
      9. NextDateList
      10. NextDateCombine
      11. DatePer
      12. EDateBF
      13. DateSeq
      14. DateSeqCombine
      1. Introduction
      2. TpY
      3. TpM
      4. TpD
      5. Occurs
    1. Introduction
      1. Introduction
      2. DpYBD
      3. DpMBD
      4. DpDBD
      5. NextBD
      6. PrevBD
      7. NextDateSeqBD
      8. PrevDateSeqBD
      9. IsBD
      10. NetWorkDaysBF
      11. NextDateListBD
      12. PrevDateListBD
      1. Introduction
      2. Holiday
      3. DescribeHol
      4. WhatHol
      5. IsHol
      6. IsWE
      7. WesternEaster
      8. CreateDate
    1. Introduction
      1. Introduction
      2. MkPmtsSeq
      3. MkPmts
      4. MkPmtsGrow
      5. MkPmtsFcst
      6. MkPmtsSF
      7. MkPmtsLim
      8. MkPmtsLag
      9. MkPmtsLagProf
      10. RePhasePmts
      11. TotPmts
      12. TotPmtsSF
      13. SumBetween
      14. DoBetween
      15. MatchPmts
      16. CarryNeg
      17. CarryPos
      18. MkPmtsX
      19. MkPmtsLagX
      20. MkPmtsIdx
      21. MkPmtsCats
      22. MkPmtsGroup
      1. Introduction
      2. MkPmtsPer
      3. MkPmtsPerGrow
      4. MkPmtsPerFcst
      5. MkPmtsIdxPer
      1. Introduction
      2. MkPmtsGrowMkt
      3. MkPmtsFcstMkt
      4. MkPmtsPerGrowMkt
      5. MkPmtsPerFcstMkt
    1. Introduction
      1. Introduction
      2. GSpread
      3. UniSpread
      4. UniSpreadGrow
      5. SCurve
      6. SCurveGrow
      7. DistSpread
      8. FStepSpread
      9. TStepSpread
      10. MkPmtsWeighted
      11. SCumCurve
      1. Introduction
      2. UniSpreadPer
      3. SCurvePer
      4. SCurveGrowPer
      5. UniSpreadGrowPer
      1. Introduction
      2. WeightSpread
      3. FWeightSpread
      4. TWeightSpread
      1. Introduction
      2. UniSpreadH
      3. SCurveH
      4. WeightSpreadH
      5. FWeightSpreadH
      6. TWeightSpreadH
      7. DistSpreadH
      8. GSpreadH
      9. UniSpreadAdj
      10. SCurveAdj
      11. WeightSpreadAdj
      12. FWeightSpreadAdj
      13. TWeightSpreadAdj
      14. DistSpreadAdj
      15. GSpreadAdj
    1. Introduction
      1. Introduction
      2. Con
      3. ConGrow
      4. AnnGrow
      5. RePhaseCon
      6. AnnRate
      7. ConSF
      8. ConIdx
      9. ConEvent
      1. Introduction
      2. ConPer
      3. AnnGrowPer
      4. ConGrowPer
      1. Introduction
      2. ConGrowMkt
      3. ConFcstMkt
      4. ConFcstGrowMkt
      1. Introduction
      2. ConRevGrow2
      3. ConRev
      4. ConRevGrow
      5. ConRevFcst
    1. Introduction
      1. Introduction
      2. FStep
      3. FStepGrow
      4. FStepGrowX
      5. FStepThenGrow
      6. FStepFcst
      7. FStepGrown
      8. FStepSF
      9. FStepCombine
      10. MultiFStep
      1. Introduction
      2. TStep
      3. TStepGrow
      4. TStepGrowX
      5. TStepThenGrow
      6. TStepFcst
      7. TStepGrown
      8. TStepSF
      9. TStepCombine
      10. MultiTStep
      1. Introduction
      2. FStepGrowMkt
      3. FStepFcstMkt
      4. TStepGrowMkt
      5. TStepFcstMkt
      1. Introduction
      2. FStepRev
      3. TStepRev
      4. FStepRevGrow
      5. FStepRevFcst
      6. TStepRevGrow
      7. TStepRevFcst
      8. FStepThenGrowRev
      9. TStepThenGrowRev
    1. Introduction
      1. Introduction
      2. FittedRate
      3. Ramp
      1. Introduction
      2. InterpedLevel
      3. FittedLevel
    1. Introduction
      1. Introduction
      2. Bal
      3. Level
      4. FLevels
      5. TLevels
      6. FLevelsGrow
      7. TLevelsGrow
      8. FLevelsFcst
      9. TLevelsFcst
      10. FLevelsCombine
      11. FLevelsThenGrow
      12. TLevelsThenGrow
      1. Introduction
      2. FLevelsGrowMkt
      3. TLevelsGrowMkt
      4. FLevelsFcstMkt
      5. TLevelsFcstMkt
      1. Introduction
      2. Grow
      3. GrowFromTo
      4. FGrowStep
      5. TGrowStep
      6. FGrowStepMkt
      7. TGrowStepMkt
      8. GrowMkt
      9. GrowLin
      1. Introduction
      2. Fcst
      3. FcstGrow
      4. FcstCollar
      5. SumFcst
      6. FFcstStep
      7. TFcstStep
      8. IdxFromTo
      1. Introduction
      2. FcstT
      3. TFcstT
    1. Introduction
      1. Introduction
      2. ALevel
      3. FALevels
      4. TALevels
      5. FALevelsGrow
      6. TALevelsGrow
      7. FALevelsFcst
      8. TALevelsFcst
      9. FALevelsThenGrow
      10. TALevelsThenGrow
      11. ALevelGrow
      1. Introduction
      2. FALevelsGrowMkt
      3. TALevelsGrowMkt
      4. FALevelsFcstMkt
      5. TALevelsFcstMkt
      1. Introduction
      2. AGrow
    1. Introduction
      1. Introduction
      2. PVCon
      3. PVAnnGrow
      4. PVConGrow
      5. PVConQ
      1. Introduction
      2. PVTStep
      3. PVTStepQ
      4. PVTStepIC
      5. PVTStepICQ
      6. PVFStep
      7. PVFStepIC
      8. PVFStepQ
      9. PVFStepICQ
      1. Introduction
      2. PVMkPmtsSF
      3. PVMkPmts
      1. Introduction
      2. PVGSpread
      3. PVUniSpread
      4. PVSCurve
      5. PVSCurveGrow
      6. PVDistSpread
      7. PVFStepSpread
      8. PVTStepSpread
      9. PVMkPmtsWeighted
      10. PVSCumCurve
    1. Introduction
      1. Introduction
      2. SimpleToSimple
      3. SimpleToAER
      4. SimpleToCont
      5. SimpleToDF
      6. AERToSimple
      7. AERToCont
      8. AERToDF
      9. ContToSimple
      10. ContToAER
      11. ContToDF
      12. DFToSimple
      13. DFToAER
      14. DFToCont
      1. Introduction
      2. SimpleToSimpleX
      3. SimpleToAERX
      4. SimpleToContX
      5. SimpleToDFX
      6. AERToSimpleX
      7. ContToSimpleX
      8. DFToSimpleX
      9. RateConvert
      1. Introduction
      2. FVM
      3. PVM
      4. PmtM
      5. TermM
      6. IntRateM
      7. PVEGAnn
      8. PVEGAnnM
      9. PVEGPerAnn
      10. PVEGPerp
      11. PVEGPerpM
      12. PVEGPerPerp
      13. SumEGAnn
      14. SumEGAnnM
      15. SumEGAnnCont
      16. SumLGAnn
      17. SumLGAnnM
      18. SumLGAnnCont
      1. Introduction
      2. PVBF
      3. PMTBF
      4. RateBF
      1. Introduction
      2. APRToQuoted
      3. QuotedToAPR
    1. Introduction
      1. Introduction
      2. PVOne
      3. FPVOne
      4. TPVOne
      5. PVOneQ
      1. Introduction
      2. PVA
      3. IRRA
      4. PayBackA
      5. PayBackDiscA
      6. DurationA
      7. AvLifeA
      1. Introduction
      2. PVE
      3. IRRE
      4. PaybackE
      5. PayBackDiscE
      6. DurationE
      7. AvLifeE
      1. Introduction
      2. PVT
      3. IRRT
      4. PayBackT
      5. PayBackDiscT
      6. DurationT
      7. AvLifeT
      8. PVTIC
      9. IRRTIC
      10. PVTX
      11. IRRTX
      12. PVTCX
      13. IRRTCX
      14. PVTR
      15. IRRTR
      1. Introduction
      2. NPVM
      3. IRRM
      4. CorrectionM
      5. CorrectionCont
      6. CorrectionDC
      7. DurationM
      8. AvLifeM
      9. EffTimeM
    1. Introduction
      1. Introduction
      2. Depreciate
      3. DepreciatedValue
      4. DepPoolWIP
      5. DepPoolRatio
      6. DepPool
      7. DepreciatePer
      8. DepreciateGrowPer
      9. DepreciateFcstPer
      10. DepreciateIdxPer
      11. LIFOPrice
      12. LIFOCalc
      1. Introduction
      2. FAvRate
      3. TAvRate
      4. FAvRateTD
      5. TAvRateTD
    1. Introduction
      1. Introduction
      2. LinReg
      3. BestPoly
      4. SignChanges
      5. RSqrdPoly
      6. PolyEqn
      7. CalcPoly
      8. PolyReg
    1. Introduction
      1. Introduction
      2. LookupNum
      3. LookupN
      4. SeekNum
      5. PickNum
      6. SortPick
      7. LookUpNum2D
      8. PickMatrix
      9. LookupNIndex
      10. Seek
      11. SeekList
      12. SortNum
      13. FindIf
      1. Introduction
      2. DoBetweenX
      3. SumCat
      4. SumCats
      5. SumPos
      6. SumNeg
      7. SumDiv
      8. SumBounds
      9. SumSubRange
      10. SumCombine
      11. SelCats
      1. Introduction
      2. Coordinates
      3. WorkSheetName
      4. RefPlus
      5. GetRef
      1. Introduction
      2. MinBetween
      3. MaxBetween
      4. MeanNZ
      5. WeightAv
      1. Introduction
      2. RangeDir
      1. Introduction
      2. SortText
      3. ApplyToList
      4. CombineLists
      5. TransposeNum
      6. Unique
      1. Introduction
      2. Interp
      3. Interpolate
      4. InterpDate
      5. InterpolateDate
      6. Intersection
    1. Introduction
      1. Introduction
      2. Distribution
      3. PartialDependency
      4. DistCumulative
      5. DistUniform
      6. DistTriangular
      7. DistDoubleTri
      8. DistNormal
      9. DistLogNormal
      10. RandNum
      11. NRandom
      12. PickRandom
      13. DescribeDistType
      14. CumProb
    1. Introduction
      1. Introduction
      2. RentGrow
      3. RentFcst
      1. Introduction
      2. FStepRent
      3. FStepRentGrow
      4. FStepRentFcst
      5. FStepRentFcstCollar
      1. Introduction
      2. TStepRent
      3. TStepRentGrow
      4. TStepRentFcst
      5. TStepRentGrowCollar
      6. TStepRentFcstCollar
      1. Introduction
      2. RentFcstR
      3. RentGrowR
      4. FStepRentGrowR
      5. FStepRentFcstR
      6. TStepRentGrowR
      7. TStepRentFcstR
      8. TStepRentGrowSFR
      9. FStepRentGrowSFR
      10. TStepRentFcstSFR
      11. FStepRentFcstSFR
      1. Introduction
      2. CapValue
      3. EqYield
      4. CapValueG
      5. EqYieldG
      6. CapValueGD
      7. EqYieldGD
      8. NomToTrue
      9. TrueToNom
      10. YPP
      11. YPPDef
      12. YPA
      13. YPADef
      14. CapValueGrowGD
      15. CapValueFcstGD
      16. EqYieldGrowGD
      17. EqYieldFcstGD
      1. Introduction
      2. CapValueDCF
      3. EqYieldDCF
      4. CapValueDCFG
      5. EqYieldDCFG
      6. CapValueDCFGD
      7. EqYieldDCFGD
      8. NomToTrueDCF
      9. TrueToNomDCF
      10. YPADefDCF
      11. YPPDefDCF
      12. TheorYield
      13. ImpGrowth
      14. ImpDiscRate
      15. PVRent
      16. TWRR
      1. Introduction
      2. PVRentGrow
      3. PVRentFcst
      4. PVTStepRent
      5. PVTStepRentGrow
      6. PVTStepRentFcst
      7. PVTStepRentGrowR
      8. PVTStepRentFcstR
      9. PVTStepRentGrowIC
      10. PVTStepRentGrowRIC
      11. PVTStepIdxRentGrowR
      12. PVTStepIdxRentFcstR
      1. Introduction
      2. TStepGTurnRentGrow
      3. TStepGTurnRentGrowR
      1. Introduction
      2. IdxRentGrowR
      3. IdxRentFcstR
      4. IdxRentGrowMktR
      5. IdxRentFcstMktR
      6. TStepIdxRentGrowR
      7. TStepIdxRentFcstR
      1. Introduction
      2. LetCostR
      3. LetCostRQ
      4. LeasingFeeGrowR
      5. FServChargeR
      6. ServChargeGrowR
      7. ServChargeFcstR
      8. FServChargeGrowR
      9. FVacServChargeR
      10. VacServChargeGrowR
      11. VacServChargeFcstR
      12. LeasingFeeFcstR
      1. Introduction
      2. UKRatesGrow
      3. UKRatesFcst
      4. UKRatesGrowR
      5. UKRatesFcstR
      6. UKEmptyRatesFcstR
      7. UKEmptyRatesGrowR
      1. Introduction
      2. LeaseEnd
      3. ReletOccurs
      4. RentDateInfo
      5. RentEventOccurs
      6. RentEvent
      7. LastReview
      8. NextReview
      9. LastReviewR
      10. NextReviewR
      11. LeaseInfo
      12. Occupancy
      13. LeaseDates
    1. Introduction
      1. Introduction
      2. Interest
      3. FInterest
      4. TInterest
      5. TotInterestSF
      6. InterestX
      7. PVFInterest
      8. PVInterestX
      9. PVInterest
      1. Introduction
      2. ZeroCoupon
      3. FutureToSpot
      4. SpotToSpot
      1. Introduction
      2. Loan
      3. LoanX
      4. LoanLin
      5. LoanLinX
      6. Mortgage
      7. MortgageQ
      8. LoanPool
      9. MortgagePool
      10. IdxBondGrow
      11. IdxBondFcst
      1. Introduction
      2. Overdraft
      3. CashAcct
      4. FlexAcct
      5. CurrentAcct
      6. STDAcct
      7. LoanAcct
      8. LoanAcctEM
      1. Introduction
      2. BetaIndex
      3. BetaReturns
      4. DescribeReturn
      5. TotalReturn
      1. Introduction
      2. OptionBS
      3. OptionBinom
      4. OptionMonte
    1. Introduction
      1. Introduction
      2. STOIIP
      1. Introduction
      2. Decline
      3. DeclineRate
      4. DescribeDecline
      5. ProdProf
      6. AbandonDate
      7. StartDecline
    1. Introduction
      1. Introduction
      2. MoneyText
      1. Introduction
      2. GetToken
      3. GetTokens
      4. InString
      5. ExInt
      6. ExFl
    1. Introduction
      1. Introduction
      2. StdEq
      3. DiffGaps
      4. AddGaps
      1. Introduction
      2. SRound
      3. SFloor
      4. SCeiling
      5. RoundWeekDay
      6. RoundMonthDay
      7. RoundMD
      8. RoundDateSeq
      9. DateRound
      10. DateFloor
      11. DateCeiling
      12. Disperse
      13. RoundList
      1. Introduction
      2. BFVer
      3. DescribeLoanAcctOutput
      4. DescribeCombineSwitch
      5. DescribePmtsPerYear
      6. DescribeLevelSwitch
      7. DescribeBD
      8. DescribeDayCount
      9. DescribePeriods
      10. DescribeLookup
      11. DescribeRounding
      12. DescribeLoanOutput
      13. DescribeShape
      14. ArgValues
      1. Introduction
      2. Switch
      3. SwitchR
      4. SwitchT
      5. SwitchRT
      6. IfElse
      7. IfElseR
      8. IfElseT
      9. IfElseRT
      1. Introduction
      2. CollarDate
      3. InBetween
      4. Collar
      1. Introduction
      2. Ev
Note: In order to use the spreadsheet examples, you need to download Business Functions
PolyReg (Degree, YValues, XValues, [MinRSqrdOpt], [MaxDegPoly])
Polynomial Regression. Fit a polynomial to a set of data. Will detect the best order of polynomial if required (if Degree=0).
Fits a set of Coefficients using Least Squares to a polynomial of degree Degree, to a maximum of 20 (a+bx^0 ... ux^20).
Key Points

We advise bit of care when fitting a polynomial. The algorithm we use is not the state of the art in polynomial fitting. Mathematicians will note that an algorithm using orthogonal reduction or singular value decomposition would perhaps be more robust than our Gaussian solver. Nonetheless, our experience with this function is that the issue is really with the problem you are asking the algorithm to solve. It generally WILL provide a polynomial that fits pretty well your input data, but the algorithm is not responsible for what happens to the curve inbetween your data points! Sometimes, for example, the 2nd and 3rd coefficients might be very large but of opposite sign, meaning that the algorithm has successfully fitted the data but may have come up with a wildly oscillating equation. The answer to this problem is to specify more input data, so as to define the curve a bit more in order that the function is less likely to get led astray.

Key Points

Our recommendations would be:

  • Use the lowest order of degree.
  • Have good look at the output equation, perhaps chart it, to test for "sensibleness".
  • It"s a good idea to set a value of MinRSqrdOpt (e.g. 90%), so you can deliberately force the function to throw an error if it can"t find a good enough fit.

Formula Derivation

The algorithm uses the Least Squares method. To solve the matrix for the coefficients a Gauss algorithm is used.

Application

This function is always used as an array function, because you need an array of parameters returned. In fact, you need as many parameters as you have coefficients. The coefficients are the "powers" of the polynomial. For example, for a second order polynomial y=a+bx+cx^2, the coefficients are a,b and c. The maximum degree of polynomial allowed is 20 (a+bx...ux^20).

Tip

Set MinRSqrdOpt to something like 0.9 (90%) to force the function to throw an error if it can"t find a good enough fit. You don"t really want it to give you an equation if the goodness if fit is simply appalling!

Tip

Setting a Degree of zero means that the function will return the best fit it can using a Degree that can vary between 1 and 20.

Example
PolyReg.xls  
Templates
This function features in the following downloadable spreadsheet template(s):

curve_poly.xls  

Business Functions Ltd, London, UK Website Design: Webpure