curatedapi

Excel RATE function: interest rate per period

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

Total number of payment periods. A ratio of two decimals such as "0.08/12" is accepted.
Payment made each period. A ratio of two decimals such as "0.08/12" is accepted.
Present value. A ratio of two decimals such as "0.08/12" is accepted.
Future value. A ratio of two decimals such as "0.08/12" is accepted.
When payments are due: 0 at the end of each period, 1 at the beginning.
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.
More options: rounding and decimals
Precision and rounding
Rounding mode applied once to each result. Default half_even.
Round results to this many digits after the decimal point.
Round results to this many significant digits.

Examples

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

Rate
Rate per period, as a decimal (0.0077 is 0.77%).
0.0077 rounded
All rates
Every rate found, lowest first.
0.0077

Rounding: Half even, 4 decimal places. Calculator excel/rate@1.

How it is calculated

pv·(1+r)^nper + pmt·(1 + r·type)·((1+r)^nper − 1)/r + fv = 0

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.

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

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.

Use it from your code

POST /v1/calc/excel/rateVersion 1
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}
  }'
The same call in Python
import os

import requests

payload = {
    "nper": "48",
    "pmt": "-200",
    "pv": "8000",
    "options": {
        "decimals": 4,
    },
}
response = requests.post(
    "https://api.curatedapi.com/v1/calc/excel/rate",
    headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
    json=payload,
    timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
    "nper": "48",
    "pmt": "-200",
    "pv": "8000",
    "options": {
        "decimals": 4,
    },
};
const response = await fetch("https://api.curatedapi.com/v1/calc/excel/rate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});
console.log((await response.json()).result);

MCP tool calc_excel_rate at https://mcp.curatedapi.com. Inputs, outputs and errors in the API reference.

Put it on your website

<div data-curatedapi-widget="excel/rate" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>

Use a public key registered for your site. Calculations are billed like API calls. How widgets work.

Related calculators

Get Excel's answer in your own code

Moving a spreadsheet model into an app? The API returns what Excel returns for the same inputs, so your users see the same numbers in both.

Free for up to 1,000 calculations a month. 50,000 calculations a month cost $9.00 on the Starter plan.