Skip to main content
Participating Frequently
August 12, 2020
Question

if then statement help

  • August 12, 2020
  • 2 replies
  • 2131 views

Hello all,

I am trying to create an if /then statement on a sales agreement that needs to calculate different amounts of tax based on the amount of the sale. I don't know if I am using the wrong field names or what but I keep getting syntax errors.

We have a 6% sales tax with an additional Education tax of .5% up to $5000. Everything over $5000 is a 6% tax. The name of the cell that has the value of the subtotal of the sale in it is called SubTotal, the "Tool tip" name is "$_Row_1"

Here is my equation description:

I want to calculate the amount of tax to charge based on the amount in the "SubTotal" cell.

If statement: If cell named SubTotal is < $5000

If True:  then SubTotal * 6.5% (.065)

If False (greater than $5000):  then subtract $5000 from the SubTotal amount and multiply it by 6% (.06) and add $325 ($325 is 6.5% of the first $5000)

 

Here is what I put in the calculation field for "Sale Tax":

 

if(SubTotal<5000, SubTotal*.065,
((SubTotal-5000)*.06)+325)

 

What am I doing wrong? Thanks in advance for your help.

This topic has been closed for replies.

2 replies

JamesboAuthor
Participating Frequently
August 12, 2020

I updated the equation to the following that lets me enter it without errors but it does nothing.

 

if (SubTotal<5000) {SubTotal*.065} else
{((SubTotal-5000)*.06)+325}

try67
Community Expert
Community Expert
August 12, 2020

You're missing a bunch of important stuff... Read this tutorial, too: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

Bernd Alheit
Community Expert
Community Expert
August 12, 2020

You must use Javascript code for this.

JamesboAuthor
Participating Frequently
August 12, 2020

Thanks for your reply. I'm used to formulas in Excel.  What would the Javascript code be entered to do the same thing?

Bernd Alheit
Community Expert
Community Expert
August 12, 2020