NPer Function


NPer Function

Class

Microsoft.VisualBasic.Financial

Syntax

     Dim result As Double = NPer(rate, pmt, pv [, fv [, due]]) 


rate (required; Double)

The interest rate per period.


per (required; Double)

The period for which a payment is to be computed.


pv (required; Double)

The present value of a series of future payments.


fv (optional; Double)

The future value or cash balance after the final payment. If omitted, the default value is 0.


due (optional; DueDate enumeration)

A value indicating when payments are due, from the Microsoft.VisualBasic.DueDate enumeration. DueDate.EndOfPeriod indicates that payments are due at the end of the payment period; DueDate.BegOfPeriod indicates that payments are due at the beginning of the period. If omitted, the default value is DueDate.EndOfPeriod.

Description

The NPer function determines the number of payment periods for an annuity, based on regular fixed payments and a fixed interest rate. An annuity is a series of fixed cash payments made over a period of time. It can be either a loan or an investment.

Usage at a Glance

  • If pv and fv represent liabilities, their value is negative; if they represent assets, their value is positive.

  • rate and pmt must be expressed in the same time unit. That is, if pmt reflects the monthly payment amount, rate must be the monthly interest rate.

  • The rate is supplied as a decimal percent. For example, 10% is stated as 0.1.

Example

This sample displays the amount of time needed to pay off a credit card. It uses the NPer function to determine the length of time required.

     Public Sub HowLongToPay(  )        ' ----- Detail the extent of a debt.        Dim interestRate As Double        Dim currentBalance As Double        Dim monthlyPayment As Double        Dim totalPeriods As Integer        Try           currentBalance = CDbl(InputBox("Credit card balance."))           monthlyPayment = CDbl(InputBox("Monthly payment."))           interestRate = CDbl(InputBox("Monthly interest rate " & _              "(use 0.05 for 5%)."))           totalPeriods = CInt(NPer(interestRate, -monthlyPayment, _              currentBalance, 0#, DueDate.BegOfPeriod))           MsgBox("Your credit card balance will be paid in " & _              totalPeriods & " months. That's " & _              Int(totalPeriods / 12) & " years and " & _              (totalPeriods Mod 12) & " months.")        Catch e As System.Exception           MsgBox("Unable to compute period because of error " & _              e.Message)        End Try     End Sub 

See Also

FV Function, IPmt Function, NPV Function, Pmt Function, PPmt Function, PV Function, Rate Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net