# Rate 函數

rate ( nper， pmt， pv [， fv ] [ ，type ][， guess ])

Rate 函數語法具有這些引數：

nper

pmt

fv

type

guess

Rate 是按照反覆運算計算。 從 guess 值開始，Rate會迴圈計算，直到結果正確到 0.00001% 之內。 如果 Rate 在嘗試 20 次之後找不到結果，會失敗。 如果您的 guess 為 10%， 且 Rate 失敗，請嘗試不同的 guess

## 查詢範例

SELECT FinancialSample.*, (Rate ([TermInYears]*12,-[MonthlyRePayment],[LoanAmount],0,0,0.1) *12) AS InterestRate FROM FinancialSample;

## VBA 範例

``` Dim Fmt, FVal, Guess, PValDim Payment, TotPmts, PayType, APR' When payments are made.Const ENDPERIOD = 0, BEGINPERIOD = 1 Fmt = "##0.00" ' Define percentage format.FVal = 0 ' Usually 0 for a loan.Guess = .1 ' Guess of 10 percent.PVal = InputBox("How much did you borrow?")Payment = InputBox("What's your monthly payment?")TotPmts = InputBox("How many monthly payments do " & _ "you have to make?")PayType = MsgBox("Do you make payments at the end " & _ "of the month?", vbYesNo)If PayType = vbNo Then PayType = BEGINPERIOD Else PayType = ENDPERIODEnd IfAPR = (Rate(TotPmts, -Payment, PVal, _ FVal, PayType, Guess) * 12) * 100MsgBox "Your interest rate is " & _ Format(CInt(APR), Fmt) & " percent." ```

×