Solved

Amortization of a loan in VBA

Posted on 1997-11-29
7
1,186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

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