# Mortgage Formula is not working for me

**URL:** <https://community.glideapps.com/t/mortgage-formula-is-not-working-for-me/70525>\
**Category:** Ask for Help\
**Created:** [February 5, 2024, 6:51pm UTC](https://community.glideapps.com/t/mortgage-formula-is-not-working-for-me/70525 "2024-02-05T18:51:21Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Isaiah\_Harvey](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/isaiah_harvey/32/70471_2.png) [@Isaiah\_Harvey](https://community.glideapps.com/u/Isaiah_Harvey)\
**Post date:** [February 6, 2024, 2:28am UTC](https://community.glideapps.com/t/mortgage-formula-is-not-working-for-me/70525/21 "2024-02-06T02:28:52Z")

</div>

> [@Jeff\_Hager](#):
>
> ```auto
> function calculateMonthlyPayment(interestRate, numberOfPayments, loanAmount) {
> const monthlyInterestRate = interestRate / 12;
> const compoundFactor = Math.pow(1 + monthlyInterestRate, numberOfPayments);
> const monthlyPayment = (loanAmount * monthlyInterestRate * compoundFactor) / (compoundFactor - 1);
> 
> return monthlyPayment;
> }
> 
> const interestRate = p1.toFixed(5); 
> const numberOfPayments = p2.toFixed(5)*12;
> const loanAmount = p3.toFixed(5);
> 
> return calculateMonthlyPayment(interestRate, numberOfPayments, loanAmount);
> 
> ```

I really don’t know if it is me but I received this error message "Function Error

TypeError: p1.toFixed is not a function"

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 6, 2024, 3:15am UTC](https://community.glideapps.com/t/mortgage-formula-is-not-working-for-me/70525/22 "2024-02-06T03:15:42Z")

</div>

> [@Isaiah\_Harvey](#):
>
> TypeError: p1.toFixed is not a function

Can you show a screenshot of your javascript column configuration?

---

<div class="post-metadata">

**Author:** ![Isaiah\_Harvey](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/isaiah_harvey/32/70471_2.png) [@Isaiah\_Harvey](https://community.glideapps.com/u/Isaiah_Harvey)\
**Post date:** [February 6, 2024, 3:22am UTC](https://community.glideapps.com/t/mortgage-formula-is-not-working-for-me/70525/23 "2024-02-06T03:22:30Z")

</div>

> [@Jeff\_Hager](#):
>
> ```auto
> function calculateMonthlyPayment(interestRate, numberOfPayments, loanAmount) {
> const monthlyInterestRate = interestRate / 12;
> const compoundFactor = Math.pow(1 + monthlyInterestRate, numberOfPayments);
> const monthlyPayment = (loanAmount * monthlyInterestRate * compoundFactor) / (compoundFactor - 1);
> 
> return monthlyPayment;
> }
> 
> const interestRate = p1.toFixed(5); 
> const numberOfPayments = p2.toFixed(5)*12;
> const loanAmount = p3.toFixed(5);
> 
> return calculateMonthlyPayment(interestRate, numberOfPayments, loanAmount);
> 
> ```

 ![New Formula](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/0/4077fef4dbeb9f0fc20a82f8c0b7a6fa1f2591eb.png)

Here is the Configuration.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 6, 2024, 4:06am UTC](https://community.glideapps.com/t/mortgage-formula-is-not-working-for-me/70525/24 "2024-02-06T04:06:24Z")

</div>

Is the calculation working otherwise, or not at all? Is there any chance that one of your values are empty in any of the rows in the table?

I can get the same error to pop up briefly, but only if I’m messing around with the values.

Sometimes the javascript column will show unhandled errors, or delayed errors that are no longer a problem.

I’m honestly not seeing anything wrong with your setup unless it’s something to do with your input values,but seeing that they are all numeric, I’m not sure what could be wrong.

---

<div class="post-metadata">

**Author:** ![Isaiah\_Harvey](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/isaiah_harvey/32/70471_2.png) [@Isaiah\_Harvey](https://community.glideapps.com/u/Isaiah_Harvey)\
**Post date:** [February 6, 2024, 2:38pm UTC](https://community.glideapps.com/t/mortgage-formula-is-not-working-for-me/70525/25 "2024-02-06T14:38:41Z")

</div>

Yes, Unfortunately I can not figure it out. Thank you for you assistance and your time.

[Previous page](https://community.glideapps.com/t/mortgage-formula-is-not-working-for-me/70525.md?page=1)
