Calculate interest on a loan formula

calculate interest on a loan formula

I'd like to calculate average interest rate in a way that allows me to manipulate the monthly payment. So, for example, the borrower would be able to pay back more in the beginning months, and less in the end months, but still pay back the same amount cumulatively. Does anyone know any formulas I can use or have any ideas?