傳回 Double,指定根據定期、定額款項及固定利率所計算的年金在給定之期間內的本金付款款項。
命名空間: Microsoft.VisualBasic
組件: Microsoft.VisualBasic (在 microsoft.visualbasic.dll 中)
語法
'宣告
Public Shared Function PPmt ( _
Rate As Double, _
Per As Double, _
NPer As Double, _
PV As Double, _
<OptionalAttribute> Optional FV As Double = 0, _
<OptionalAttribute> Optional Due As DueDate = DueDate.EndOfPeriod _
) As Double
'用途
Dim Rate As Double
Dim Per As Double
Dim NPer As Double
Dim PV As Double
Dim FV As Double
Dim Due As DueDate
Dim returnValue As Double
returnValue = Financial.PPmt(Rate, Per, NPer, PV, FV, Due)
public static double PPmt (
double Rate,
double Per,
double NPer,
double PV,
[OptionalAttribute] double FV,
[OptionalAttribute] DueDate Due
)
public:
static double PPmt (
double Rate,
double Per,
double NPer,
double PV,
[OptionalAttribute] double FV,
[OptionalAttribute] DueDate Due
)
public static double PPmt (
double Rate,
double Per,
double NPer,
double PV,
/** @attribute OptionalAttribute() */ double FV,
/** @attribute OptionalAttribute() */ DueDate Due
)
public static function PPmt (
Rate : double,
Per : double,
NPer : double,
PV : double,
FV : double,
Due : DueDate
) : double
參數
- Rate
必要項。Double 可指定每期利率。例如,如果您的汽車貸款年利率 (APR) 為 10% 並採月付方式償還,則每期的利率為 0.1/12,也就是 0.0083。
- Per
必要項。Double 可指定在 1 到 NPer 範圍內的付款期間。
- NPer
必要項。Double 指定年金保險投資中付款的總期數。例如,如果您的四年期汽車貸款是採月付方式償還,則付款總期數就是 4 x 12 (即 48) 期。
- PV
必要項。Double 可指定一系列的未來付款或收到款項的現值。例如,當您貸款買車時,貸款金額就是您要以每月支付方式付給貸方的車款金額現值。
- FV
選擇項。Double,指定您在最後一次付款之後想要的未來值或現金結存。例如,貸款的未來值為 $0,因為是代表最後一期付款之後的值。然而,如果您想在 18 年內存下美金 $50,000 元做為子女教育費用,那麼美金 $50,000 元就是未來值。如果省略,則假設為 0。
- Due
選擇項。DueDate 列舉型別 型別的物件,指定付款何時到期。這個引數必須是DueDate.EndOfPeriod(若付款期限是付款期間的結束日),或DueDate.BegOfPeriod(若付款期限是付款期間的開始日)。如果省略,則假設為DueDate.EndOfPeriod。
傳回值
傳回 Double,指定根據定期、定額款項及固定利率所計算的年金在給定之期間內的本金付款款項。
備註
如需詳細資訊,請參閱 Visual Basic 的主題 PPmt 函式。
年金是在約定期間內一連串的固定現金付款。年金可以是借貸 (例如房屋抵押貸款),也可以是投資 (例如每月定存存單)。
Rate 和 NPer 引數必須使用以相同單位表示的付款週期計算。例如,如果 Rate 是以月計算,則 NPer 也必須以月來計算。
凡是引數,現金支出 (例如存款) 都以負數來表示,現金收入 (例如股息支票) 則以正數來表示。
範例
此範例使用 PPmt 函式計算當所有付款的價值都相同時,特定期間的付款中有多少為本金部分。給定的項目包括每一期的百分比利率 (APR / 12)、在希望支付的本金部分下所需的付款期間 (Period)、付款總期數 (TotPmts)、貸款的現值或本金 (PVal)、貸款的未來值 (FVal) 以及指出付款要在付款期間的開頭或結尾到期的數字 (PayType)。
Sub TestPPMT()
Dim PVal, APR, TotPmts, Payment, Period, P, I As Double
Dim PayType As DueDate
Dim Msg As String
Dim Response As MsgBoxResult
' Define money format.
Dim Fmt As String = "###,###,##0.00"
' 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?"))
' Ensure proper form.
If APR > 1 Then APR = APR / 100
TotPmts = CDbl(InputBox("How many monthly payments do you have to make?"))
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
Payment = Math.Abs(-Pmt(APR / 12, TotPmts, PVal, FVal, PayType))
Msg = "Your monthly payment is " & Format(Payment, Fmt) & ". "
Msg = Msg & "Would you like a breakdown of your principal and "
Msg = Msg & "interest per period?"
' See if chart is desired.
Response = MsgBox(Msg, MsgBoxStyle.YesNo)
If Response <> MsgBoxResult.No Then
If TotPmts > 12 Then MsgBox("Only first year will be shown.")
Msg = "Month Payment Principal Interest" & vbNewLine
For Period = 1 To TotPmts
' Show only first 12.
If Period > 12 Then Exit For
P = PPmt(APR / 12, Period, TotPmts, -PVal, FVal, PayType)
' Round principal.
P = (Int((P + 0.005) * 100) / 100)
I = Payment - P
' Round interest.
I = (Int((I + 0.005) * 100) / 100)
Msg = Msg & Period & vbTab & Format(Payment, Fmt)
Msg = Msg & vbTab & Format(P, Fmt) & vbTab & Format(I, Fmt) & vbNewLine
Next Period
' Display amortization table.
MsgBox(Msg)
End If
End Sub
平台
Windows 98、 Windows 2000 SP4、 Windows CE、 Windows Millennium Edition、 Windows Mobile for Pocket PC、 Windows Mobile for Smartphone、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition
.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。
版本資訊
.NET Framework
支援版本:2.0、1.1、1.0
.NET Compact Framework
支援版本:2.0、1.0
請參閱
參考
Financial 類別
Financial 成員
Microsoft.VisualBasic 命名空間
ArgumentException