Financial.NPer(Double, Double, Double, Double, DueDate) 方法

定義

傳回值,指定根據定期、定額付款及固定利率所計算的年金期數。

public static double NPer (double Rate, double Pmt, double PV, double FV = 0, Microsoft.VisualBasic.DueDate Due = Microsoft.VisualBasic.DueDate.EndOfPeriod);
static member NPer : double * double * double * double * Microsoft.VisualBasic.DueDate -> double
Public Function NPer (Rate As Double, Pmt As Double, PV As Double, Optional FV As Double = 0, Optional Due As DueDate = Microsoft.VisualBasic.DueDate.EndOfPeriod) As Double

參數

Rate
Double

必要。 每期利率。 例如,如果您的汽車貸款年利率 (APR) 為 10% 並採月付方式償還,則每期的利率為 0.1/12,也就是 0.0083。

Pmt
Double

必要。 每一期所要付的款項。 款項通常包含本金,以及不會隨著年金的有效期間而變更的利息。

PV
Double

必要。 一系列未來付款或收款之現值或今天的價值。 例如,當您貸款買車時,貸款金額就是您要以每月支付方式付給貸方的車款金額現值。

FV
Double

選擇性。 您在最後一次付款之後想要的未來價值或現金餘額。 例如,貸款的未來值為 $0,因為是代表最後一期付款之後的值。 然而,如果您想在 18 年內存下美金 $50,000 元做為子女教育費用,那麼美金 $50,000 元就是未來值。 如果省略,則假設為 0。

Due
DueDate

選擇性。 DueDate 類型的物件,指定付款何時到期。 這個引數必須是 DueDate.EndOfPeriod (若付款期限是付款期間的結束日),或 DueDate.BegOfPeriod (若付款期限是付款期間的開始日)。 如果省略,則假設為 DueDate.EndOfPeriod

傳回

根據定期、定額付款及固定利率所計算的年金期數。

例外狀況

Rate = 0 和 Pmt = 0

範例

此範例會使用 函 NPer 式傳回必須付款的期間數,以支付其值包含在 中的 PVal貸款。 此外,也提供每個期間 APR / 12 (利率) 、付款 () Payment 、貸款 FVal () 的未來值,以及指出付款是在付款 (PayType 期間開頭或結尾) 的數位。

Sub TestNPer()
    Dim TotPmts As Double
    Dim PVal, APR, Payment As Double
    Dim PayType As DueDate
    Dim Response As MsgBoxResult

    ' Usually 0 for a loan.
    Dim Fval As Double = 0
    PVal = CDbl(InputBox("How much do you want to borrow?"))
    APR = CDbl(InputBox("What is the annual percentage rate of your loan?"))
    ' Usually 0 for a loan.
    If APR > 1 Then APR = APR / 100
    Payment = CDbl(InputBox("How much do you want to pay each month?"))
    Response = MsgBox("Do you make payments at the end of month?", MsgBoxStyle.YesNo)
    If Response = MsgBoxResult.No Then
        PayType = DueDate.BegOfPeriod
    Else
        PayType = DueDate.EndOfPeriod
    End If
    TotPmts = NPer(APR / 12, -Payment, PVal, FVal, PayType)
    If Int(TotPmts) <> TotPmts Then TotPmts = Int(TotPmts) + 1

    MsgBox("It will take you " & TotPmts & " months to pay off your loan.")
End Sub

備註

年金是一系列在一段時間內進行的固定現金付款。 年金可以是貸款 (,例如家庭貸款) 或投資 (,例如每月節省方案) 。

針對所有自變數,支付的現金 (,例如儲存) 的金額會以負數表示;收到 (的現金,例如正數表示) 的除數檢查。

適用於

另請參閱