How to Calculate Geometric Rate of Return

Geometric Rate of Return Calculator

The Geometric Rate of Return (also known as the Compound Annual Growth Rate or CAGR) measures the average annual growth rate of an investment over a period longer than one year, assuming that profits are reinvested.

Results:

function calculateGeometricRateOfReturn() { var initialInvestment = parseFloat(document.getElementById("initialInvestment").value); var finalInvestment = document.getElementById("finalInvestment").value; var numberOfYears = document.getElementById("numberOfYears").value; var resultDiv = document.getElementById("result"); if (isNaN(initialInvestment) || isNaN(finalInvestment) || isNaN(numberOfYears) || initialInvestment <= 0 || finalInvestment <= 0 || numberOfYears <= 0) { resultDiv.innerHTML = "Please enter valid positive numbers for all fields."; return; } var geometricRate = Math.pow((finalInvestment / initialInvestment), (1 / numberOfYears)) – 1; var percentageRate = geometricRate * 100; resultDiv.innerHTML = "The Geometric Rate of Return is: " + percentageRate.toFixed(2) + "%"; } .calculator-wrapper { font-family: sans-serif; max-width: 600px; margin: 20px auto; padding: 20px; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .calculator-inputs h2, .calculator-results h3 { text-align: center; color: #333; margin-bottom: 20px; } .input-group { margin-bottom: 15px; } .input-group label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; } .input-group input[type="number"] { width: calc(100% – 12px); padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } .calculator-inputs button { display: block; width: 100%; padding: 10px; background-color: #007bff; color: white; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; transition: background-color 0.3s ease; } .calculator-inputs button:hover { background-color: #0056b3; } .calculator-results { margin-top: 20px; padding-top: 15px; border-top: 1px solid #eee; } #result { font-size: 1.1em; text-align: center; color: #28a745; font-weight: bold; }

Leave a Comment