Loan amortization

Recommended Posts

I need some help with this and it is driving me crazy. I know there are probably about 50 different ways to make this but i really would like this way to work. When it is ran it starts out with 208.82 for the Interest paid and it should be 208.81 so it throws all the calculations off and it ends up giving a -4.06 balance at the end.

If someone would please take a look and see if i have done something completely wrong or if the rounding needs to be done in a specific spot. I have tried just about everything i can think of.

Thanks for any help

B

```;Found formula here http://www.hughchou.org/calc/formula.html

\$TA = 200000  ;Total loan amount
\$I = 5.75     ;Interest percent
\$L = 30      ;Length in years

\$N = \$L*12          ;chages length from years to months
\$J = \$I/(12*100)    ;Changes interest to decimal
;MsgBox(0,"",\$J)
\$M = \$TA * ( \$J / ( 1 - (( 1 + \$J ) ^ -\$N)))
;MsgBox(0,"",\$M)

For \$s = \$N to 1 Step -1        ;tells total number of payments based on length \$L
\$IP = Round(\$TA * \$J, 2)        ;Interest paid
\$PP = Round(\$M - \$IP, 2)        ;Principal Paid
\$RB = Round(\$TA - \$PP, 2)       ;Remaining Balance
FileWrite("test.txt", \$PP & "   |   " & \$IP & " |   " & \$RB & @CRLF)
\$TA = \$RB                      ;Sets original loan amount to RB for next calculation
Next```

Share on other sites

```\$TA = 200000  ;Total loan amount
\$I = 5.75     ;Interest percent
\$L = 30      ;Length in years

\$N = \$L*12          ;chages length from years to months
\$J = \$I/(12*100)    ;Changes interest to decimal
;MsgBox(0,"",\$J)
\$M = \$TA * ( \$J / ( 1 - (( 1 + \$J ) ^ -\$N)))
;MsgBox(0,"",\$M)

For \$s = \$N to 1 Step -1        ;tells total number of payments based on length \$L
\$IP = (\$TA * \$J)        ;Interest paid
\$PP = Round(\$M - \$IP, 2)        ;Principal Paid
\$RB = Round(\$TA - \$PP, 2)       ;Remaining Balance
FileWrite("test.txt", \$PP & "   |   " & \$IP & " |   " & \$RB & @CRLF)
\$TA = \$RB                      ;Sets original loan amount to RB for next calculation
Next```

Monkey's are, like, natures humans.

Share on other sites

```\$TA = 200000  ;Total loan amount
\$I = 5.75     ;Interest percent
\$L = 30      ;Length in years

\$N = \$L*12          ;chages length from years to months
\$J = \$I/(12*100)    ;Changes interest to decimal
;MsgBox(0,"",\$J)
\$M = \$TA * ( \$J / ( 1 - (( 1 + \$J ) ^ -\$N)))
;MsgBox(0,"",\$M)

For \$s = \$N to 1 Step -1        ;tells total number of payments based on length \$L
\$IP = (\$TA * \$J)        ;Interest paid
\$PP = Round(\$M - \$IP, 2)        ;Principal Paid
\$RB = Round(\$TA - \$PP, 2)       ;Remaining Balance
FileWrite("test.txt", \$PP & "   |   " & \$IP & " |   " & \$RB & @CRLF)
\$TA = \$RB                      ;Sets original loan amount to RB for next calculation
Next```

So is there a way to make the interest rate round out when it writes to a file without messing up the final result? Was hoping there was a opt that made all the numbers go 2 decimal places but no such thing.

Share on other sites

So is there a way to make the interest rate round out when it writes to a file without messing up the final result? Was hoping there was a opt that made all the numbers go 2 decimal places but no such thing.

Share on other sites

But did you see what the first post did it comes out with a -4.06 instead of 0.00 so you cant round it out without getting a bogus answer. That is why i was asking if there is a way around it. I guess you will have to take the number and round it after the calculation is performed to get it to work and give the correct balance of 0.00

I would really like it to round out to the 2 decimal place on everything but it just appears it si not going to happen in autoit unless im missing something...

Share on other sites

Use Round() in the FileWrite, not in the calculation

Thanks man i have just being tearing my hair out working on this and was about ready to throw a monitor or keyboard out the window for fun

Create an account

Register a new account