# Help with a formula calculation

• RogerYelvington01
Asked on January 08, 2014 at 03:30 PM

Hey guys!

Currently I have this formula in the "remaining balance" field:

[({remainingPayments}*{memberDues})+{remainingPayments}*{tanningDues104}]

There are currently two problems:

1.  If nothing is entered into the "tanning dues rate" field, then it shows an inaccurately high balance

2.  If 0 or 0.00 is entered into the "tanning dues rate" field, no calculation will result or show in the remaining balance field

If a client does select to add tanning, and you type in the amount, 15.00 - then the calculation is accurate.

• Cesar
Answered on January 08, 2014 at 05:17 PM

It appears this is due to the fact you are multiplying a zero thus making the total a zero. If in case you would need to calculate {remainingPayments}*{tanningDues104} with no {tanningDues104} payment, then adding a 1 to the {tanningDues104} field should not modify the price.

I would suggest to leave that fields minimum/default amount value to 1 instead of zero.

Example Form:
http://form.jotformpro.com/form/40076137364957

Do let us know if you need further assistance, thank you.

• RogerYelvington01
Answered on January 09, 2014 at 01:27 AM

Thank you for the suggestion!  That helps a little - however with the following current formula, the Remaining Balance amount will still be inaccurate for clients that opt out, and do not want to pay for tanning:

[({Remaining}*{memberDues})+{Remaining}*{tanningDues104}]

Example:

Remaining Payments: 23
Member Dues: \$39.99
Tanning Dues: \$1 (Default Value, even when does not want tanning)
Remaining Balance: \$919.77

However our calculation currently results as \$942.77, which is adding the tanning amount 1x23, making the balance \$23 too high (and the client unhappy, as they do not want any charge for the service unless the opt-in).  The calculation works when the client opts in for tanning, but increases the balance by the number of payments even when they opt out of tanning.

Roger

• jonathan
Answered on January 09, 2014 at 06:06 AM

Hi Roger,

Unfortuantely, you cannot use condition logic within the calculation fields.

Like in your case, the condition

IF {tanningDues104} = 0

THEN [({Remaining}*{memberDues})+{Remaining}]

IF {tanningDues104} > 0

THEN [({Remaining}*{memberDues})+{Remaining}+{tanningDues104}]

Can you please tell us if my sample condition above is applicable to your desired computation?

I think we can do this on the form by using 2 tanningDues field.. and use it in computation.

It can be a lot of work if we can only use the form builder for all the custom computation.

BUT it can be a lot easeir if you can use the form's source code embed because you can easily create a custom javascript computation code to work in your form. This will require embedding of the form's source code into a website.

Inform us of your feedback on this.

Thank.s