curatedapi

Excel MIRR function: modified internal rate of return

The modified IRR of periodic cash flows with separate finance and reinvestment rates, as Excel's MIRR.

Periodic cash flows, the first at the start. 2 to 1000 items. One per line, or separated by commas.
Rate paid on money borrowed (negative flows). A ratio of two decimals such as "0.08/12" is accepted.
Rate earned on money reinvested (positive flows). 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

Result: Microsoft's example: three years

Mirr
Modified IRR per period, as a decimal.
-0.05 rounded

Rounding: Half even, 2 decimal places. Calculator excel/mirr@1.

How it is calculated

MIRR = (−NPV(rrate, positive)·(1+rrate)ⁿ / (NPV(frate, negative)·(1+frate)))^(1/(n−1)) − 1

MIRR(values, finance_rate, reinvest_rate): negative flows are discounted at finance_rate, positive flows compounded at reinvest_rate, and the rate linking the two over n − 1 periods is returned.

  • 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/mirrVersion 1
curl https://api.curatedapi.com/v1/calc/excel/mirr \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "values": ["-120000", "39000", "30000", "21000"],
    "finance_rate": "0.1",
    "reinvest_rate": "0.12",
    "options": {"decimals": 2}
  }'
The same call in Python
import os

import requests

payload = {
    "values": ["-120000", "39000", "30000", "21000"],
    "finance_rate": "0.1",
    "reinvest_rate": "0.12",
    "options": {
        "decimals": 2,
    },
}
response = requests.post(
    "https://api.curatedapi.com/v1/calc/excel/mirr",
    headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
    json=payload,
    timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
    "values": ["-120000", "39000", "30000", "21000"],
    "finance_rate": "0.1",
    "reinvest_rate": "0.12",
    "options": {
        "decimals": 2,
    },
};
const response = await fetch("https://api.curatedapi.com/v1/calc/excel/mirr", {
  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_mirr at https://mcp.curatedapi.com. Inputs, outputs and errors in the API reference.

Put it on your website

<div data-curatedapi-widget="excel/mirr" 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.