How to Calculate Rate of Growth

Rate of Growth Calculator

This calculator helps you determine the rate of growth between two points in time. It's useful for tracking the progress of populations, investments, or any quantity that changes over a period.

function calculateGrowthRate() { var initialValue = parseFloat(document.getElementById("initialValue").value); var finalValue = parseFloat(document.getElementById("finalValue").value); var timePeriod = parseFloat(document.getElementById("timePeriod").value); var resultDiv = document.getElementById("result"); if (isNaN(initialValue) || isNaN(finalValue) || isNaN(timePeriod) || initialValue <= 0 || timePeriod <= 0) { resultDiv.innerHTML = "Please enter valid positive numbers for all fields."; return; } // Formula for Absolute Growth: Final Value – Initial Value var absoluteGrowth = finalValue – initialValue; // Formula for Percentage Growth: ((Final Value – Initial Value) / Initial Value) * 100 var percentageGrowth = (absoluteGrowth / initialValue) * 100; // Formula for Average Annual Growth Rate (AAGR): (Percentage Growth / Time Period) var averageAnnualGrowthRate = percentageGrowth / timePeriod; resultDiv.innerHTML = "

Results:

" + "Absolute Growth: " + absoluteGrowth.toFixed(2) + "" + "Percentage Growth: " + percentageGrowth.toFixed(2) + "%" + "Average Annual Growth Rate: " + averageAnnualGrowthRate.toFixed(2) + "% per year"; } #growth-rate-calculator { font-family: sans-serif; border: 1px solid #ccc; padding: 20px; border-radius: 8px; max-width: 400px; margin: 20px auto; background-color: #f9f9f9; } #growth-rate-calculator h2 { text-align: center; margin-bottom: 20px; color: #333; } .input-section { margin-bottom: 15px; } .input-section label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; } .input-section input[type="number"] { width: calc(100% – 12px); padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } button { width: 100%; padding: 10px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; } button:hover { background-color: #45a049; } #result { margin-top: 20px; padding: 15px; border: 1px solid #eee; background-color: #fff; border-radius: 4px; } #result h3 { margin-top: 0; color: #4CAF50; } #result p { margin-bottom: 5px; color: #333; }

Leave a Comment