NPer Function

   
NPer Function

Class

Microsoft.VisualBasic.Financial

Syntax

 NPer(   rate   ,   pmt   ,   pv   [,   fv   [,   due   ]]) 
rate (required; Double)

The interest rate per period.

pmt (required; Double)

The payment to be made each period.

pv (required; Double)

The present value of the series of future payments or receipts.

fv (optional; Double)

The future value of the series of payments or receipts. If omitted, the default value is 0.

due (optional; DueDate enumeration)

A value indicating when payments are due. DueDate.EndOfPeriod (0) indicates that payments are due at the end of the payment period, and DueDate. BegOfPeriod (1) indicates that payments are due at the beginning of the period. If omitted, the default value is 0.

Return Value

A Double indicating the number of payments

Description

Determines the number of payment periods for an annuity based on fixed periodic payments and a fixed interest rate

Rules at a Glance

  • rate is a percentage expressed as a decimal. For example, a monthly interest rate of 1% is expressed as 0.01.

  • For pv and fv , cash paid out is represented by negative numbers; cash received is represented by positive numbers .

Example

Typically, the amount of time required to repay credit-card debt is never explicitly stated. The following program uses the NPer function to determine how much time is required to repay credit-card debt:

 Private Sub HowLongToPay(  ) Try    Dim dblRate, dblPV, dblPmt As Double    Dim lngNPer As Long    dblPV = InputBox("Enter the Credit Card balance: ")    dblPmt = InputBox("Enter the monthly payment: ")    dblRate = InputBox("Enter the monthly interest rate (.xxxx): ")    lngNPer = NPer(dblRate, -dblPmt, dblPV, 0, 1)    MsgBox("Your credit card balance will be paid in " & _           lngNPer & " months." & vbCrLf & "That's " & _           Int(lngNPer / 12) & " years and " & _           Math.Round(lngNPer Mod 12, 2) & " months.") Catch e As System.Exception    MsgBox("Unable to compute period because of error " & e.Message) End Try End Sub 

Programming Tips and Gotchas

  • Both 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.

  • NPer is useful in calculating the number of payment periods required to repay a loan when the monthly loan payment is fixed or when an approximate amount of a monthly payment is known. In this case, pv reflects the amount of the loan, and fv is usually 0, reflecting the fact that the loan is to be entirely repaid.

  • NPer is useful in determining the length of time required to meet some future financial goal. In this case, pv represents the current level of savings, and fv represents the desired level of savings.

See Also

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

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

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