AMORTIZE (amortize loan for specific number of payments)

Top  Previous  Next

 

AMORTIZE(balance,rate,payment,totalpayments,principal,interest,endbalance)

 

AMORTIZE

Calculates principal, interest, and remaining balance for a payment or payments.

balance

A numeric constant or variable containing the loan balance.

rate

A numeric constant or variable containing the periodic interest rate applied for a single period.

payment

A numeric constant or variable containing the desired payment (a negative number).

totalpayments

A numeric constant or variable containing the number of payments to amortize.

principal

The label of a DECIMAL variable to receive the portion of the payment(s) applied to pay back the loan (a negative number).

interest

The label of a DECIMAL variable to receive the portion of the payment(s) applied towards loan interest (a negative number).

endbalance

The label of a DECIMAL variable to receive the remaining loan balance.

 

The AMORTIZE procedure shows precisely which portion of a loan payment, or payments, constitutes interest and which portion constitutes repayment of the principal amount borrowed. The computed amounts are based upon a loan balance (balance), a periodic interest rate (rate), the payment amount (payment) and the number of payments (totalpayments). The remaining balance (endbalance) is also calculated.

Periodic rate may be calculated as follows:

PeriodicRate = AnnualInterestRate / (PeriodsPerYear * 100)

 

The return parameters principal, interest, and endbalance must be DECIMAL values (passed by value).

Internal Formulas:

 

Example:

 

Principal     DECIMAL(18,2)

Interest      DECIMAL(18,2)

EndingBalance DECIMAL(18,2)

 

CODE

 

BeginningBalance = LoanAmount             !Set first beginning balance

Period# = 1                               !Begin with the first period

LOOP Ptr# = Period# TO TotalPeriods       !Loop through the periods

AMORTIZE(BeginningBalance,MonthlyRate,Payment,1, |

Principal,InterestAmount,EndingBalance)  !Amortize 1 payment

Q:Balance = BeginningBalance             !Show the beginning balance

Q:Payment = Payment * (-1)               !..the payment amount

Q:Principal = Principal * (-1)           !..amount applied to principal

Q:Interest = InterestAmount * (-1)       !..amount applied to interest

Q:NewBalance = EndingBalance             !...ending balance

IF Ptr# = TotalPeriods|                  !If last period

 AND EndingBalance < 0                   !and balance went negative

 Q:Principal += EndingBalance            !adjust principal downard

 Q:Payment += EndingBalance              !and also the payment

 Q:NewBalance = 0.0                      !and make the balance zero.

END

EndingBalance = Q:NewBalance             !Save the ending balance

ADD(AmortizeQue)                         !Add all period values to Q

BeginningBalance = EndingBalance         !Make a new beginning balance

TotalInterest += Q:Interest              !Add up total interest

END                                       !End loop