Solved

Amortization of a loan in VBA

Posted on 1997-11-29
7
1,177 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

816 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

10 Experts available now in Live!

Get 1:1 Help Now