2 Replies Latest reply on May 1, 2013 5:08 PM by wowiemaui

# How to convert an Excel Formula to a Custom Calculation Script in a Adobe Acrobat 9 Form?

Hello,

I am not familiar whatsoever with Javascript and need some help in converting the following Excel Formula so that I can enter it into a Custom Calculation Script in a Adobe PDF Form. Here is the formula:

=IF(E15<25.01,9.95,IF(E15<50.01,11.95,IF(E15<75.01,13.95,IF(E15<100.01,16.95,IF(E15<150.01 ,19.95,IF(E15<200.01,24.95,IF(E15>200.00,E15*0.125)))))))

Where "E15" will be the text field named "Subtotal" on my Adobe PDF Form.

• ###### 1. Re: How to convert an Excel Formula to a Custom Calculation Script in a Adobe Acrobat 9 Form?

Fortunately JavaScript has the 'switch' statement so nested if statements can be avoided.

var E15 = this.getField("Subtotal").value;

switch(true) {

case (E15 < 25.01) :

event.value = 9.95;

break;

case (E15 < 50.01) :

event.value = 11.95;

break;

case (E15 < 75.01) :

event.value = 13.95;13

break;

case (E15 < 100.01) :

event.value = 16.95;

break;

case (E15 < 150.01) :

event.value = 19.95;

break;

case (E15 < 200.01) :

event.value = 24.95;

break;

case (E15 > 200) :

event.value = E15 * 0.125;

break;

default:

event.value = "";

break;

} // end switch;