Solved

Amortization of a loan in VBA

Posted on 1997-11-29
7
1,173 Views
Last Modified: 2008-03-04
Could someone give me a web page address were I can find a code on VBA regarding Loan Amortization Calculation. If you already  have a code please post. Thank you.
0
Comment
Question by:gima
  • 3
  • 3
7 Comments
 
LVL 5

Expert Comment

by:dirtdart
ID: 1442874
VBA contains several financial functions.  FV is the one I use most.  It returns the future value of a loan based on the information given.

FV(rate,nper,pmt,pv,type)

Rate   is the interest rate per period.
Nper   is the total number of payment periods in an annuity.
Pmt   is 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.
Pv   is the present value, or the lump-sum amount that a series of future payments is worth right now. If pv is omitted, it is assumed to be 0 (zero).
Type   is the number 0 or 1 and indicates when payments are due. If type is omitted, it is assumed to be 0.
PMT will figure the monthly payment on a loan given the requested information.

PMT(rate,nper,pv,fv,type)

Rate   is the interest rate for the loan.
Nper   is the total number of payments for the loan.
Pv   is the present value, or the total amount that a series of future payments is worth now; also known as the principal.
Fv   is the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
Type   is the number 0 (zero) or 1 and indicates when payments are due.

There is also PV, IPMT, NPER, PPMT, RATE, and several others.  The documentation for them can be found in vb help, or Excel help, and I'm sure it's in the other Office help files too.
0
 

Author Comment

by:gima
ID: 1442875
Can you be a more specific. I need to get a vba code for amortization of a loan. Thank you.
0
 
LVL 8

Accepted Solution

by:
mrmick earned 50 total points
ID: 1442876
The following code will display what you're looking for in your immediate window.

'Play the following constants
Const AnnualIntRate = 9.25 'Percentage
Const AnnualPayments = 12
Const TotalPeriods = 48 '4 Year Loan
Const LoanAmount = 20000

Dim r As Double
Dim l As Long

   r = (AnnualIntRate / 100) / AnnualPayments
   For l = 1 To TotalPeriods
      Debug.Print "PMT# "; CStr(l); ")  "; Format(pmt(r, TotalPeriods, -LoanAmount), "##0.00"); "    ";
      Debug.Print "Int: "; Format(IPmt(r, l, TotalPeriods, -LoanAmount), "##0.00"); "  ";
      Debug.Print "Prn: "; Format(PPmt(r, l, TotalPeriods, -LoanAmount), "##0.00"); "  "
  Next


0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 8

Expert Comment

by:mrmick
ID: 1442877
Depending on where you intend to run the code, the "Debug.Print" may need to be changed to reflect where you'd like to see the output of this example.

0
 

Author Comment

by:gima
ID: 1442878
But The person can choose to pay biweekly(26),weekly(52) or
Twice a month. Can you change a code?
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1442879
Just make the changes in the following:

Const AnnualPayments = 12
Const TotalPeriods = 48 '4 Year Loan

For example:
Const AnnualPayments = 52 'Weekly
Const TotalPeriods =  AnnualPayments * 5 'Number of Years Here

'TotalPeriods = AnnualPayments * ? (Years) assumes all loans will be in Years only, Just set TotalPeriods for any fraction of year(s).
0
 

Author Comment

by:gima
ID: 1442880
Thank you.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now