Solved

Amortization of a loan in VBA

Posted on 1997-11-29
7
1,175 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help in WHSCRIPT 9 47
MS Access Form Control Background Color Change Depending On How Long The String Text Length Is 18 72
VBA filters 2 51
using web browser with BING 40 111
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

867 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

21 Experts available now in Live!

Get 1:1 Help Now