This calculator helps you determine the rate of return on an investment. The rate of return (RoR) is a metric that quantifies the gain or loss on an investment over a specific period, expressed as a percentage of the initial investment's cost. It's a fundamental tool for evaluating the profitability of various investments.
function calculateRateOfReturn() {
var initialInvestment = parseFloat(document.getElementById("initialInvestment").value);
var finalValue = parseFloat(document.getElementById("finalValue").value);
var timePeriod = parseFloat(document.getElementById("timePeriod").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(initialInvestment) || isNaN(finalValue) || isNaN(timePeriod)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (initialInvestment <= 0) {
resultDiv.innerHTML = "Initial Investment must be greater than zero.";
return;
}
if (timePeriod 1) {
annualizedRoR = (Math.pow((finalValue / initialInvestment), (1 / timePeriod)) – 1) * 100;
}
var resultHTML = "