function calculateIRR() {
var lowRate = document.getElementById('lowRate').value;
var npvLow = document.getElementById('npvLow').value;
var highRate = document.getElementById('highRate').value;
var npvHigh = document.getElementById('npvHigh').value;
var resultBox = document.getElementById('result');
var irrDisplay = document.getElementById('irrResult');
var formulaDisplay = document.getElementById('formulaUsed');
// Validation
if (lowRate === "" || npvLow === "" || highRate === "" || npvHigh === "") {
alert("Please fill in all fields correctly.");
return;
}
var r1 = parseFloat(lowRate);
var npv1 = parseFloat(npvLow);
var r2 = parseFloat(highRate);
var npv2 = parseFloat(npvHigh);
if (isNaN(r1) || isNaN(npv1) || isNaN(r2) || isNaN(npv2)) {
alert("Please enter valid numbers.");
return;
}
// Warning for logic (Optional but helpful for user context)
if (npv1 0) {
// Usually r1 has positive NPV and r2 has negative NPV for standard interpolation explanation
// However, the math works regardless, but let's just proceed.
}
// Calculation: IRR = r1 + [ (NPV1 * (r2 – r1)) / (NPV1 – NPV2) ]
// Note: If NPV2 is negative, (NPV1 – NPV2) becomes (NPV1 + |NPV2|)
var rateDiff = r2 – r1;
var npvDiff = npv1 – npv2;
// Prevent division by zero
if (npvDiff === 0) {
alert("NPV values cannot be identical for interpolation.");
return;
}
var fraction = npv1 / npvDiff;
var irrValue = r1 + (fraction * rateDiff);
// Display results
resultBox.style.display = "block";
irrDisplay.innerHTML = irrValue.toFixed(4) + "%";
formulaDisplay.innerHTML = "IRR ≈ " + r1 + " + [ (" + npv1 + " × (" + r2 + " – " + r1 + ")) / (" + npv1 + " – (" + npv2 + ")) ]";
}
How to Calculate Internal Rate of Return Using Interpolation Method
The Internal Rate of Return (IRR) is a critical metric in financial analysis, used to estimate the profitability of potential investments. While modern software like Excel can calculate IRR instantly using iterative algorithms, understanding how to calculate it manually using the Interpolation Method is essential for financial students and analysts requiring a quick estimation without complex tools.
What is the Interpolation Method?
The IRR is mathematically the discount rate at which the Net Present Value (NPV) of a project equals zero. Since the relationship between the discount rate and NPV is non-linear, there is no simple algebraic formula to solve for IRR directly.
The interpolation method assumes a linear relationship between two points close to the zero-NPV crossing. By calculating the NPV at two different discount rates—one yielding a positive NPV and one yielding a negative NPV—you can draw a straight line between them to estimate where the line crosses the X-axis (where NPV = 0).
The Formula
To use this method, you need two trial rates:
r1 (Lower Rate): A discount rate that results in a positive NPV.
r2 (Higher Rate): A discount rate that results in a negative NPV.
The formula for linear interpolation is:
IRR ≈ r1 + [ (NPV1 × (r2 – r1)) / (NPV1 – NPV2) ]
Where:
NPV1 = Net Present Value at the lower rate (Positive)
NPV2 = Net Present Value at the higher rate (Negative)
Step-by-Step Calculation Guide
Follow these steps to perform the calculation:
Calculate NPV at a guessed lower rate: Pick a rate (e.g., 10%) and calculate the project's NPV. If the result is positive, this is your r1.
Calculate NPV at a guessed higher rate: Pick a higher rate (e.g., 15%) to drive the NPV down. If the result is negative, this is your r2.
Ensure the straddle: You must have one positive NPV and one negative NPV. If both are positive, choose a higher second rate. If both are negative, choose a lower first rate.
Apply the formula: Plug your variables into the calculator above or the formula provided.
Practical Example
Scenario: You are evaluating a machinery purchase.
At a discount rate of 10% (Low Rate), the NPV is $5,000 (Positive).
At a discount rate of 14% (High Rate), the NPV is -$2,000 (Negative).
Calculation:
Difference in Rates = 14% – 10% = 4%
Total NPV Range = $5,000 – (-$2,000) = $7,000
Fraction = $5,000 / $7,000 ≈ 0.714
Adjustment = 0.714 × 4% ≈ 2.857%
IRR ≈ 10% + 2.857% = 12.857%
Accuracy and Limitations
It is important to note that the interpolation method provides an approximation. The actual curve of NPV against discount rates is convex, not straight. Therefore:
The closer your two guess rates (r1 and r2) are to each other, the more accurate the result.
The calculated IRR via interpolation is usually slightly higher than the true IRR due to the convexity of the NPV curve.
This method works best for conventional cash flows (initial outflow followed by inflows).