curatedapi
Browse the docs

Guides

Finance

Excel functions

Late payments

E-invoices

Accounting

Number checks

VAT and GST

Billing and pricing

Money and currencies

Dates and time

Math

Unit conversion

Everyday

Health

Excel RATE function: interest rate per period API

The interest rate per period of a loan or annuity, as Excel's RATE, proven correct to the last digit.

POST https://api.curatedapi.com/v1/calc/excel/rate

RATE(nper, pmt, pv, [fv], [type], [guess]): the rate that solves the annuity equation. Excel iterates up to 20 times and can fail with #NUM!; here every rate above −100% is found and the one closest to guess is returned.

Formula

pv·(1+r)^nper + pmt·(1 + r·type)·((1+r)^nper − 1)/r + fv = 0
  • Excel finds this value by iterating from a guess until it stops changing. Here the root of the same equation is pinned between two proven bounds, so the result is correctly rounded. When the equation has several roots, the one closest to guess is returned (Excel's iteration usually ends there) and all are listed.
  • Arguments are named and ordered as in Excel. Excel computes in binary floating point; this API computes the exact value of the same formula and rounds it once, so it agrees with Excel to the digits Excel can show, and where Excel's own rounding error reaches the 15th digit this answer is the correct one.

Inputs

Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).

InputTypeDescription
nper required decimal (string) Total number of payment periods. A ratio of two decimals such as "0.08/12" is accepted. Allowed: > 0 and <= 12000.
pmt required decimal (string) Payment made each period. A ratio of two decimals such as "0.08/12" is accepted. Allowed: >= -1000000000000000 and <= 1000000000000000.
pv required decimal (string) Present value. A ratio of two decimals such as "0.08/12" is accepted. Allowed: >= -1000000000000000 and <= 1000000000000000.
fv decimal (string)
default 0
Future value. A ratio of two decimals such as "0.08/12" is accepted. Allowed: >= -1000000000000000 and <= 1000000000000000.
type integer
default 0
When payments are due: 0 at the end of each period, 1 at the beginning. Allowed: >= 0 and <= 1.
guess decimal (string)
default 0.1
Your guess for the rate (Excel's default 0.1). Only used to choose between several solutions. A ratio of two decimals such as "0.08/12" is accepted. Allowed: > -1 and <= 1000.
options.rounding half_even | half_up | half_down | up | down | ceiling | floor Rounding mode applied once to each result. Default half_even.
options.decimals integer Round results to this many digits after the decimal point.
options.significant_digits integer Round results to this many significant digits.

Result

Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.

ResultTypeDescription
ratedecimal (string)Rate per period, as a decimal (0.0077 is 0.77%).
all_rateslist of stringEvery rate found, lowest first.

Examples

Microsoft's example: 4-year $8,000 loan, $200 a month

Requestcurl
curl https://api.curatedapi.com/v1/calc/excel/rate \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "nper": "48",
    "pmt": "-200",
    "pv": "8000",
    "options": {"decimals": 4}
  }'
200 OKResponse
{
  "calculator": "excel/rate@1",
  "result": {
    "rate": "0.0077",
    "all_rates": [
      "0.0077"
    ]
  },
  "exactness": {
    "rate": "rounded"
  },
  "precision": {
    "rounding": "half_even",
    "decimals": 4
  },
  "inputs": {
    "nper": "48",
    "pmt": "-200",
    "pv": "8000",
    "fv": "0",
    "type": 0,
    "guess": "0.1"
  },
  "formula": "pv·(1+r)^nper + pmt·(1 + r·type)·((1+r)^nper − 1)/r + fv = 0",
  "references": [
    {
      "title": "Microsoft Excel RATE function",
      "url": "https://support.microsoft.com/en-us/excel/functions/rate-function"
    }
  ],
  "warnings": []
}

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.