How to write the formula for a minimum repayment credit card calculator?

23 Views Asked by At

I have a web developer creating a minimum repayment credit card calculator and need a formula to use for calculating the time to clear debt based on inputs of balance, APR, minimum repayment per month (%) and minimum repayment per month (£).

I currently have the below formula but need to adjust it to account for the check to see which minimum repayment to use (£ or %) to occur every month rather than just at the start of the calculation.

We are trying to replicate the minimum repayment calculators seen on MSE and Which.

Please help!

a = credit card balance

b = repayment amount per month

c = credit card APR

e = current credit card monthly rate

h = total interest paid

k = minimum % required per month

m = minimum amount required per month

p = amount payable based on %

q = time to clear debt

e = (POWER(((c/100)+1),0.08333)-1)x100)%

p=k x a

Using minimum payment:

Formula for time to clear debt (q):

IF(p>m, q = log (-p/ea-p)/log(1+e)), q = log (-m/ea-m)/log(1+e)))