O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required