2 Replies Latest reply on Jun 27, 2016 12:44 PM by George_Johnson

    Excel If Statement


      Need to convert the below excel formula to use in in a PDF Form.  The "I18" field in the formula will be a text box in the form labeled Total.




      Thank you

        • 1. Re: Excel If Statement
          Karl Heinz Kremer Adobe Community Professional

          In Acrobat, you will have to use JavaScript to express this type of "formulas". In this case, we are looking at something that will return the value of the cell I18 if that cell's value is less than 500,000 and will return 500,000 if it's greater than 500,000. We can express that in JavaScript using the if/else construct:


          // get the value of the field I18
          var i18Value = this.getField("I18").value;
          if (i18Value < 500000) {
            event.value = i18Value;
          else {
            event.value = 500000;

          I am using the "event.value" construct here, which is how we set the value of the current field in a custom calculation script.

          • 2. Re: Excel If Statement
            George_Johnson MVP & Adobe Community Professional

            Karl's answer is very clear, but here's an alternative that somewhat resembles the Excel formula syntax:


            // Custom calculation script

            event.value = getField("I18").value < 500000 ? getField("I18").value : 500000;


            This uses JavaScript's conditional/ternary operator: Conditional (ternary) Operator - JavaScript | MDN