Login     Register

        Contact Us     Search

XLeratorDB/financial Documentation

SQL Server PPMT Function for odd-first period annuities


ODDFPPMT

Updated: 16 November 2014


Use the scalar function ODDFPPMT to calculate the principal portion of a periodic payment for an annuity where the first period is either longer or shorter than the other periods. The principal portion of the payment is the payment amount minus the periodic interest amount.
Syntax
SELECT [wct].[ODDFPPMT](
  <@Rate, float,>
 ,<@Per, int,>
 ,<@Nper, int,>
 ,<@PV, float,>
 ,<@FV, float,>
 ,<@FirstPeriod, float,>)
Arguments
@Rate
the periodic interest rate. @Rate is an expression of type float or of a type that can be implicitly converted to float.
@Per
the period of interest. @Per is an expression of type int or of a type that can be implicitly converted to int.
@Nper
the number of annuity payments. @Nper is an expression of type int or of a type that can be implicitly converted to int.
@PV
the present value of the annuity. @PV is an expression of type float or of a type that can be implicitly converted to float.
@FV
the future value as at the end of the annuity. @FV is an expression of type float or of a type that can be implicitly converted to float.
@FirstPeriod
the length of the first period. @FirstPeriod is an expression of type float or of a type that can be implicitly converted to float.
Return Type
float
Remarks
·         If @Rate <= -1 then NULL is returned.
·         If @Nper < 1 then NULL is returned.
·         If @FirstPeriod <= 0 then NULL is returned.
·         If @Per < 1 Then NULL is returned.
·         If @Per > @Nper Then NULL is returned
·         If @Nper is NULL then @Nper = 0
·         If @Rate is NULL then @Rate = 0
·         If @PV is NULL then @PV = 0
·         If @FV is NULL then @FV = 0
·         If @Per is NULL then @Per = 0
·         If @FirstPeriod is NULL then @FirstPeriod = 1
·         When @Per = @Nper then the result includes the @FV.
·         ODDFPPMT uses the same conventions for the sign of the inputs and the results as Excel and Google spreadsheets; generally @PV and @FV should have opposite signs and the ODDFPPMT result will have the opposite sign of @PV.
Examples
Calculate the principal portion for the first period of an annuity assuming a periodic rate of 0.5%, with 36 periodic payments. The price of the annuity is 11,500 and there is no cash value at the end of the annuity. The first period is 1 and 5/6th longer than the other periods.
SELECT
   wct.ODDFPPMT(
        .005      --@Rate
       ,1         --@Per
       ,36        --@Nper
       ,-11500    --@PV
       ,0         --@FV
       ,1+5/6e+00 --@FirstPeriod
   ) as PPMT
This produces the following result.
PPMT
----------------------
245.673168518522
 
Using the same basic information in this SQL, we calculate the periodic principal payment for each of the first 10 payments.
SELECT
    x.Per
   ,wct.ODDFPPMT(
        .005      --@Rate
       ,x.Per     --@Per
       ,36        --@Nper
       ,-11500    --@PV
       ,0         --@FV
       ,1+5/6e+00 --@FirstPeriod
   ) as PPMT
FROM (
   VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
   )x(Per)
This produces the following result.
Per         PPMT
----------- ----------------------
1           245.673168518522
2           295.037758167102
3           296.512946957935
4           297.995511692719
5           299.485489251187
6           300.982916697443
7           302.487831280929
8           304.000270437344
9           305.520271789514
10          307.047873148465
Calculate the principal portion of the first periodic payment for an annuity assuming a periodic rate of 0.5%, with 180 periodic payments. The price of the annuity is 250,000 and there is a 50,000 cash value at the end of the annuity. The first period is one-half as long as the other periods.
SELECT
   wct.ODDFPPMT(
        .005     --@Rate
       ,1        --@Per
       ,180      --@Nper
       ,-250000  --@PV
       ,50000    --@FV
       ,0.5      --@FirstPeriod
   ) as PPMT
This produces the following result.
PPMT
----------------------
1308.23854972428
Using the same basic information in this SQL, we calculate the periodic principal amount for each of the last 10 payments.
SELECT
    x.Per
   ,wct.ODDFPPMT(
        .005         --@Rate
       ,x.Per        --@Per
       ,180          --@Nper
       ,-250000      --@PV
       ,50000        --@FV
       ,0.5          --@FirstPeriod
   ) as PPMT
FROM (
   VALUES (171),(172),(173),(174),(175),(176),(177),(178),(179),(180)
       )x(Per)
This produces the following result.
Per         PPMT
----------- ----------------------
171         1600.6041397169
172         1608.60716041541
173         1616.65019621753
174         1624.73344719861
175         1632.85711443466
176         1641.02140000676
177         1649.22650700682
178         1657.47263954185
179         1665.76000273953
180         51674.0888027533
Calculate the principal portion of the first weekly payment for an automobile lease with a term of 3 years and an annual interest rate of 25%. The amount to be financed is 11,000 and the residual value at the end of the lease is 3,500. The first payment is due 2014-11-25.
SELECT
   wct.ODDFPPMT(
        .25 * 7/365e+00     --@Rate
       ,1                   --@Per
       ,156                 --@Nper
       ,-11000              --@PV
       ,3500                --@FV
       ,DATEDIFF(d,'2014-11-13','2014-11-25')/7e+00    --@FirstPeriod
   ) as PPMT
This produces the following result.
PPMT
----------------------
-5.0546399988707
Using the same basic information in this SQL, we calculate the periodic principal amount for each of the first 10 payments.
SELECT
    x.Per
   ,wct.ODDFPPMT(
        .25 * 7/365e+00     --@Rate
       ,x.Per               --@Per
       ,156                 --@Nper
       ,-11000              --@PV
       ,3500                --@FV
       ,DATEDIFF(d,'2014-11-13','2014-11-25')/7e+00    --@FirstPeriod
   ) as PPMT
FROM (
   VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
   )x(Per)
This produces the following result.
Per         PPMT
----------- ----------------------
1           -5.0546399988707
2           32.7471010059999
3           32.90410765466
4           33.0618670749227
5           33.2203828759684
6           33.3796586842745
7           33.5396981437207
8           33.7005049156433
9           33.8620826789393
10          34.0244351301371

 

See Also

 



Copyright 2008-2017 Westclintech LLC         Privacy Policy        Terms of Service