# Amortization Calculator Formula With JS

**URL:** <https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161>\
**Category:** Resources & Tutorials\
**Created:** [July 6, 2022, 8:04pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161 "2022-07-06T20:04:21Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 6, 2022, 8:04pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/1 "2022-07-06T20:04:21Z")

</div>

Hello Everyone 👋

Thought to share this with you’ll that I posted for [another user’s question](https://forum.adalo.com/t/this-is-over-my-head/28693)!

This script calculates the Monthly Payment with amount , term and interest rate.

Made a video : [Loom | Free Screen & Video Recording Software | Loom](https://www.loom.com/share/4282e2414d4e4467855c3428e8c6cd44)

And the JS :

```auto
var Rate = "5" / 100;
var Term = "48";
var Price = "67890";
var value = Price * (Rate/12) * (Math.pow((1 + (Rate/12)), Term))/ ((Math.pow((1 + (Rate/12)), Term)) - 1);
var value = Math.round(100*value)/100;
return value;

```

In here change the rate inside double quotes with the drop down’s rate and for the term, term drop-down value and for the price add the input that user type the amount.

Instructions to download components from Pragmaflow website : [PragmaFlow's Adalo Marketplace Reopened - YouTube](https://www.youtube.com/watch?v=4mo_u5EdEWw)

Pragmaflow website : [https://adalo.pragmaflowservers.com/install-component](https://adalo.pragmaflowservers.com/install-component)

The component you need :

![image](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/2/7/27091a946a15503e54fd4dadb73ddccc9f6a72cf.png)

And also you can hide the inputs and the JS component!

Hope this helps!

Thank you

---

<div class="post-metadata">

**Author:** ![peterkilaba](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@peterkilaba](https://forum.adalo.com/u/peterkilaba)\
**Post date:** [July 8, 2022, 3:05pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/2 "2022-07-08T15:05:20Z")

</div>

Hi every one, lots of thanks to @Dilon for taking time to do this, I recently implemented this to my PWA and it works perfectly, @Dilon how can I have user enter loan down payment, instead of the loan amount and second how do I format the result.  
Here the link to the app.  
[https://www.motokaa.app/?target=576wdn4w9wjvo7c7kvd5bkxrz&params={"bnknx6sh0w4jmj9xciskgi1uf.t\_5dfnpet6b2s1b6rzq8ezw1wlr"%3A5%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_acen80tob88ol44797vpc55su"%3A9%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_f232b6d2d321404195993aeb6aadd14e"%3A22%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_6swqslb6dt1a0uiwghuxvbuld"%3A18%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_bv2vdwijzwbgcd80f2vkgqpjb"%3A1%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_ehb6hs32s4uuvd2m4ibp4bv29"%3A1%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_3d0cyao0up168kn5m3g7rhfff"%3A7%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_0yu4001c3l8sztvthw23oq7dj"%3A1%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_5vdwf5cxexr6vxhvabn103azx"%3A13%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_duco5u9wqimrtq633bhxh9n2z"%3A119%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_bsamhjddmgn5s1qz38nvscl79"%3A38%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_eehktcshlvhnqy0d6s6vhb191"%3A85}](https://www.motokaa.app/?target=576wdn4w9wjvo7c7kvd5bkxrz&params=%7B%22bnknx6sh0w4jmj9xciskgi1uf.t_5dfnpet6b2s1b6rzq8ezw1wlr%22%3A5%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_acen80tob88ol44797vpc55su%22%3A9%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_f232b6d2d321404195993aeb6aadd14e%22%3A22%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_6swqslb6dt1a0uiwghuxvbuld%22%3A18%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_bv2vdwijzwbgcd80f2vkgqpjb%22%3A1%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_ehb6hs32s4uuvd2m4ibp4bv29%22%3A1%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_3d0cyao0up168kn5m3g7rhfff%22%3A7%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_0yu4001c3l8sztvthw23oq7dj%22%3A1%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_5vdwf5cxexr6vxhvabn103azx%22%3A13%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_duco5u9wqimrtq633bhxh9n2z%22%3A119%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_bsamhjddmgn5s1qz38nvscl79%22%3A38%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_eehktcshlvhnqy0d6s6vhb191%22%3A85%7D)

Thanks

---

<div class="post-metadata">

**Author:** ![peterkilaba](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@peterkilaba](https://forum.adalo.com/u/peterkilaba)\
**Post date:** [July 8, 2022, 3:07pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/3 "2022-07-08T15:07:19Z")

</div>

[https://www.motokaa.app/?target=2y45vgoc063h6glkdd4ab8p63&params={"bnknx6sh0w4jmj9xciskgi1uf.t\_5dfnpet6b2s1b6rzq8ezw1wlr"%3A5%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_acen80tob88ol44797vpc55su"%3A9%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_f232b6d2d321404195993aeb6aadd14e"%3A22%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_6swqslb6dt1a0uiwghuxvbuld"%3A18%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_bv2vdwijzwbgcd80f2vkgqpjb"%3A1%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_ehb6hs32s4uuvd2m4ibp4bv29"%3A1%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_3d0cyao0up168kn5m3g7rhfff"%3A7%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_0yu4001c3l8sztvthw23oq7dj"%3A1%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_5vdwf5cxexr6vxhvabn103azx"%3A13%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_duco5u9wqimrtq633bhxh9n2z"%3A119%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_bsamhjddmgn5s1qz38nvscl79"%3A38%2C"bnknx6sh0w4jmj9xciskgi1uf.t\_eehktcshlvhnqy0d6s6vhb191"%3A85}](https://www.motokaa.app/?target=2y45vgoc063h6glkdd4ab8p63&params=%7B%22bnknx6sh0w4jmj9xciskgi1uf.t_5dfnpet6b2s1b6rzq8ezw1wlr%22%3A5%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_acen80tob88ol44797vpc55su%22%3A9%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_f232b6d2d321404195993aeb6aadd14e%22%3A22%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_6swqslb6dt1a0uiwghuxvbuld%22%3A18%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_bv2vdwijzwbgcd80f2vkgqpjb%22%3A1%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_ehb6hs32s4uuvd2m4ibp4bv29%22%3A1%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_3d0cyao0up168kn5m3g7rhfff%22%3A7%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_0yu4001c3l8sztvthw23oq7dj%22%3A1%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_5vdwf5cxexr6vxhvabn103azx%22%3A13%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_duco5u9wqimrtq633bhxh9n2z%22%3A119%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_bsamhjddmgn5s1qz38nvscl79%22%3A38%2C%22bnknx6sh0w4jmj9xciskgi1uf.t_eehktcshlvhnqy0d6s6vhb191%22%3A85%7D)

---

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 8, 2022, 3:53pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/4 "2022-07-08T15:53:39Z")

</div>

> [@peterkilaba](#):
>
> how can I have user enter loan down payment, instead of the loan amount

Can you give me an example?

> [@peterkilaba](#):
>
> second how do I format the result.

In your text component select custom formula from the options when you click the magic text and then add the input inside the custom formula and then you can format it to the currency. Or I can add that to the JS code if you tell me which format you need!

And also nice app Peter! Good luck with your app!

---

<div class="post-metadata">

**Author:** ![peterkilaba](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@peterkilaba](https://forum.adalo.com/u/peterkilaba)\
**Post date:** [July 8, 2022, 4:48pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/5 "2022-07-08T16:48:39Z")

</div>

Hi @Dilon ,  
Thank you for your help. When you click under the car photo you will link to listing detail where there is “buy this” button, click it and will take you to how to pay. So here I need the price of a car to be default loan amount so user just enter what down payment they going to put down so the loan amount is car price minus downpayment the user entered.

The format for results I can’t follow how to do it, could you add it to the formula please,  
Thanks @Dilon  
Appreciated.

---

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 8, 2022, 4:53pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/6 "2022-07-08T16:53:14Z")

</div>

> [@peterkilaba](#):
>
> Thank you for your help. When you click under the car photo you will link to listing detail where there is “buy this” button, click it and will take you to how to pay. So here I need the price of a car to be default loan amount so user just enter what down payment they going to put down so the loan amount is car price minus downpayment the user entered.

Is it possible to give an example calculation with the results?

> [@peterkilaba](#):
>
> The format for results I can’t follow how to do it, could you add it to the formula please,

I have shown this on that video! What’s the format you need?

---

<div class="post-metadata">

**Author:** ![peterkilaba](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@peterkilaba](https://forum.adalo.com/u/peterkilaba)\
**Post date:** [July 8, 2022, 5:58pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/7 "2022-07-08T17:58:42Z")

</div>

The format is the number punctuated by comma without the decimal places like this,  
123,345,678

---

<div class="post-metadata">

**Author:** ![peterkilaba](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@peterkilaba](https://forum.adalo.com/u/peterkilaba)\
**Post date:** [July 8, 2022, 6:20pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/8 "2022-07-08T18:20:54Z")

</div>



---

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 8, 2022, 7:16pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/9 "2022-07-08T19:16:08Z")

</div>

Something like this? : [Loom | Free Screen & Video Recording Software | Loom](https://www.loom.com/share/28e326e719894d8c995b08d3291af699) ( I’m sorry that I said Paul to you and you are Peter 🤦‍♂️ 😅 )

Or **round** that number?

---

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 8, 2022, 7:22pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/10 "2022-07-08T19:22:38Z")

</div>

Thanks for the video! Nicely explained!

Need to confirm the result! 🙂

Based on your values does your result would be this?

![image](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/c/3/c3dfb331c49c30bb70774ec3fcae81335d4d837d.png)

---

<div class="post-metadata">

**Author:** ![peterkilaba](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@peterkilaba](https://forum.adalo.com/u/peterkilaba)\
**Post date:** [July 8, 2022, 8:03pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/11 "2022-07-08T20:03:43Z")

</div>

🤣Thats ok, no problem.  
So let me put it this way.

The car price is 10,000  
Buyer has to deposit 2,000 so he has to enter 2,000 into downpayment input  
So bank gives buyer a 8,000 loan which become the loan amount

So the formula should take 8,000 as the loan amount which comes from deducting 2,000 from 10,000 . So the formula take has the price of a car, wait user to enter amount he wants to put down and the formular take that number and deduct from the car price before it calculate monthly payment for loan of 8,000. I hope that help

---

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 8, 2022, 8:29pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/12 "2022-07-08T20:29:32Z")

</div>

Correct?

> **[formula test.mp4](https://drive.google.com/file/d/1Zm5JO0kr2PhXru6Y9qp_gyaWBK7lDduZ/view?usp=sharing)**
>
> Google Drive file.

```auto
var Rate = "rate from dropdown" / 100;
var Term = "term from dropdown";
var Price = "car price"-"downpayment input";
var value = Price * (Rate/12) * (Math.pow((1 + (Rate/12)), Term))/ ((Math.pow((1 + (Rate/12)), Term)) - 1);
var value = Math.round(100*value)/100;
var formatvalue = Math.trunc(value).toLocaleString();
return formatvalue;

```

---

<div class="post-metadata">

**Author:** ![peterkilaba](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@peterkilaba](https://forum.adalo.com/u/peterkilaba)\
**Post date:** [July 9, 2022, 6:19am UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/13 "2022-07-09T06:19:01Z")

</div>

Hi @Dilon,  
I just implemented the new formula and it works exactly the way I wanted.  
thank you so much.  
Check it out and share if you want  
www.motokaa.app

---

<div class="post-metadata">

**Author:** ![Dilon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dilon/32/39815_2.png) [@Dilon](https://forum.adalo.com/u/Dilon)\
**Post date:** [July 10, 2022, 4:55pm UTC](https://forum.adalo.com/t/amortization-calculator-formula-with-js/29161/14 "2022-07-10T16:55:56Z")

</div>

Awesome @peterkilaba!

Wishing you the best of luck with your app!
