Home Loan Prepayment Calculator Excel India

Home Loan Prepayment Calculator (Excel India)

Home Loan Prepayment Calculator

function calculateLoan() { const loanAmount = parseFloat(document.getElementById(“loanAmount”).value); const interestRate = parseFloat(document.getElementById(“interestRate”).value) / 100 / 12; const loanTerm = parseFloat(document.getElementById(“loanTerm”).value) * 12; const prepaymentAmount = parseFloat(document.getElementById(“prepaymentAmount”).value); const remainingTerm = parseFloat(document.getElementById(“remainingTerm”).value) * 12; if (isNaN(loanAmount) || isNaN(interestRate) || isNaN(loanTerm) || isNaN(prepaymentAmount) || isNaN(remainingTerm)) { alert(“Please enter valid values for all fields.”); return; } const EMI = (loanAmount * interestRate) / (1 – Math.pow(1 + interestRate, -loanTerm)); const newLoanAmount = loanAmount – prepaymentAmount; const newEMI = (newLoanAmount * interestRate) / (1 – Math.pow(1 + interestRate, -remainingTerm)); const totalInterestSavings = EMI * loanTerm – newEMI * remainingTerm; document.getElementById(“monthlyEMI”).value = EMI.toFixed(2); document.getElementById(“newEMI”).value = newEMI.toFixed(2); document.getElementById(“totalInterest”).value = totalInterestSavings.toFixed(2); } function resetLoan() { document.querySelectorAll(“#homeLoanPrepaymentCalculator input”).forEach(el => el.value = “”); }

Leave a Reply

Your email address will not be published. Required fields are marked *