4 Replies Latest reply on Feb 11, 2016 11:36 AM by johnr84070315

    Trying to multiply two cells, then round the result.

    johnr84070315

      Using Acrobat Pro- Creative Cloud.


      I'm setting up a fillable PDF form. I think I need a custom calculation script to accomplish my goal. I'm trying to have two fields multiply, then round the result (up or down) to two decimals. My fields are formatted for currency, at 2 decimal places.

       

      In excel it would be the equivalent (I believe) to something like =ROUND(MULTIPLY(Line4, Line5);2). With "Line4" and "Line5" being the names of the fields I'm trying to query. In Javascript, though, I have know idea how to pull that off. I've found pieces of what I want to do in other discussions, but I don't know enough syntax to parse them together.

       

      Any help would be greatly appreciated!

       

       

      -John

       

      [EDIT] Just realized I might need to clarify a bit. My initial simple calculation was giving my client unexpected results. In my example above, "Line4" is a currency amount (let's say $50.45). The input of "Line5" is formatted as a percentage (let's say 10%). The field I'm trying to set up would calculate 10% of $50.00. That's all fine and easy with the built in scripts to multiply fields. In practice, the resulting sum was off by .01. In trouble shooting, I expanded the field to show 3 decimal places. The result was .045. I'm trying to get that total to round to .05.