Enter as a positive number. The calculator treats this as the negative year 0 cash flow.
Enter net income for each period separated by commas. Do not include currency symbols.
Helps the formula converge. Default is 0.1 (10%).
Calculated Internal Rate of Return
0.00%
Equivalent Excel Formula:
=IRR({…})
This rate represents the annualized effective compounded return rate that makes the Net Present Value (NPV) of all cash flows equal to zero.
Understanding the Excel Internal Rate of Return Calculation Formula
The Internal Rate of Return (IRR) is a critical financial metric used to estimate the profitability of potential investments. In the context of Microsoft Excel, the =IRR() function automates the complex iterative process required to solve for this rate.
Unlike simple interest calculations, IRR is the discount rate that makes the Net Present Value (NPV) of all cash flows from a particular project equal to zero. It essentially tells you the break-even growth rate of an investment.
The Math Behind the Excel Formula
Excel calculates IRR by solving the following equation for r:
0 = P0 + P1/(1+r) + P2/(1+r)2 + … + Pn/(1+r)n
P0: The initial investment (represented as a negative number).
Pn: The cash flow in period n.
r: The Internal Rate of Return.
n: The number of periods.
Excel Syntax and Arguments
The standard syntax used in spreadsheet software is:
=IRR(values, [guess])
Argument
Description
values
Required. A reference to cells containing numbers for which you want to calculate the internal rate of return. These must include at least one positive value and one negative value to calculate a result.
guess
Optional. A number that you guess is close to the result of IRR. Excel uses an iterative technique starting with the guess (default is 0.1 or 10%) and cycles through calculations until the result is accurate within 0.00001%.
Example Calculation
Imagine you are evaluating a project with the following cash flows:
Year 0 (Start): -$10,000 (Initial Investment)
Year 1: $2,000
Year 2: $4,000
Year 3: $3,000
Year 4: $5,000
Using the calculator above or Excel, the IRR for this series of cash flows is approximately 14.5%. This means that the project generates an annual return roughly equivalent to earning a 14.5% interest rate on the invested capital.
When to Use IRR
The Excel IRR formula is most effective when comparing multiple projects. Generally, if the IRR of a project exceeds the company's required rate of return (often called the Hurdle Rate) or the Weighted Average Cost of Capital (WACC), the project is considered financially viable.
function calculateIRR() {
// 1. Get Inputs using var
var initialInvInput = document.getElementById('initialInvestment').value;
var cashFlowsInput = document.getElementById('cashFlows').value;
var guessInput = document.getElementById('estimatedGuess').value;
var resultBox = document.getElementById('irrResult');
var resultValue = document.getElementById('irrValueDisplay');
var formulaDisplay = document.getElementById('excelFormulaDisplay');
// 2. Validate Initial Investment
if (!initialInvInput || isNaN(parseFloat(initialInvInput))) {
alert("Please enter a valid Initial Investment amount.");
return;
}
// 3. Parse Cash Flows
// Remove spaces and non-relevant chars (allow digits, dots, commas, minus)
// Split by comma
if (!cashFlowsInput.trim()) {
alert("Please enter at least one subsequent cash flow.");
return;
}
var flowsArray = cashFlowsInput.split(',');
var cleanFlows = [];
// Add initial investment as negative (Year 0)
// Note: The input is "Investment", so we negate it for the calculation
cleanFlows.push(-1 * parseFloat(initialInvInput));
var cleanFlowsText = []; // For display in formula text
cleanFlowsText.push(-1 * parseFloat(initialInvInput));
for (var i = 0; i < flowsArray.length; i++) {
var valStr = flowsArray[i].trim();
if (valStr !== "") {
var val = parseFloat(valStr);
if (!isNaN(val)) {
cleanFlows.push(val);
cleanFlowsText.push(val);
}
}
}
if (cleanFlows.length 5) {
formulaStr += cleanFlowsText.slice(0, 5).join(", ") + ", …";
} else {
formulaStr += cleanFlowsText.join(", ");
}
formulaStr += "})";
formulaDisplay.textContent = formulaStr;
}
}
// Newton-Raphson implementation
function computeIRR(values, guess) {
var maxIter = 10000;
var precision = 0.0000001;
var r = guess;
for (var i = 0; i < maxIter; i++) {
var npv = 0;
var d_npv = 0; // derivative of NPV with respect to r
for (var t = 0; t < values.length; t++) {
var flow = values[t];
// NPV += flow / (1+r)^t
npv += flow / Math.pow(1 + r, t);
// Derivative: d/dr [flow * (1+r)^-t] = flow * -t * (1+r)^(-t-1)
d_npv += -t * flow / Math.pow(1 + r, t + 1);
}
// If derivative is too close to 0, we can't divide (flat slope)
if (Math.abs(d_npv) < precision) {
return null;
}
var new_r = r – (npv / d_npv);
// Check convergence
if (Math.abs(new_r – r) < precision) {
return new_r;
}
r = new_r;
}
return null; // Did not converge
}