How to use basic calculations in PDF forms

Learn how to calculate PDF forms using Adobe Acrobat X or XI.

By February 6, 2012

 



Follow these steps to set calculations in text fields and drop-down boxes that appear in your PDF forms:

To add text fields

  1. Double-click the field where you want to display the result to open the Properties dialog box.
  2. Click the Calculate tab.
  3. To add the values entered into fields, click the Value Is The radio button.
  4. Pick Sum from the popup menu.
  5. Click Pick to open a list of the fields in your form, select the fields you want to add, and click OK to list the fields in the dialog box.

To multiply values

  1. Double-click the field where you want to display the result to open the Properties dialog box.
  2. Click the Calculate tab.
  3. To multiply the values entered into fields, click the Value Is The radio button.
  4. Pick Product from the popup menu.
  5. Click Pick to open a list of the fields in your form, select the fields you want to multiply, and click OK to list the fields in the dialog box.

Subtraction and division are a bit harder since you don't have a simple option to pick.

To subtract one field from another

  1. Open the Properties for the results field.
  2. Click the Calculate tab.
  3. Now click the Simplified Field Notation radio button.
  4. click Edit to open the Javascript Editor.
  5. Type the expression in the editor, such as Field1-Field2. Make sure not to add any spaces.
  6. Click OK and you'll see the expression show on the dialog box.

To divide two fields

  1. In the Calculate tab for the results field, choose Simplified Field Notation, and click Edit.
  2. In the JavaScript Editor, type FieldB/FieldA. Again, make sure you don't have any spaces. Click OK and you'll see the expression on the Properties dialog box.
  3. Click Preview to toggle the Preview mode to test your work. You won't have any surprises with adding, subtracting, or multiplying, but a division calculation can cause display problems.

If you leave the default settings for the field as unformatted content, the field shows NaN—which means Not a Number. If you open the Format tab and choose Number from the Format category, you'll see an error message. The only way to guarantee a seamless division operation is to use a JavaScript IF statement to define conditions for the field when it's blank. Unless you write the JavaScript, leave the field unformatted as Acrobat will still calculate the proper value.

So now your form not only looks great, it also gives you and your users immediate information.


Was this tutorial helpful?

Please Log in to provide feedback on this tutorial.

Rate this tutorial

Please Log in to rate this tutorial.

Rating:

Did you know?

  • You can ask a question and get an answer from one of our experts.
  • You can search our database of over 800 tutorials by product and/or topic.
  • You can leave a comment below for the author of this tutorial.

Products covered:

Acrobat X ProAcrobat X StandardAcrobat X SuiteAcrobat XI ProAcrobat XI Standard

Related topics:

Create and analyze forms

Top Searches:

HTML forms, Online forms, Web forms, Online form builder


35 comments

Lori Kassuba

1 month ago

Hi Kristin,

Here is a tip on how to suppress the zero from one of our Experts:
http://answers.acrobatusers.com/Want-form-field-blank-shows-zero-q99254.aspx

Thanks,
Lori

Kristin

1 month ago

I have a field to enter a value and then that is multiplied times a set value, which in turn figures a total. The Total column shows zeros in each row until a value is entered into the first column. How can I make the Total column blank until a value is entered?

Lori Kassuba

10, 2014-05-19 19, 2014

Hi Daniel Burge,

Have set the field calculation order? You’ll find this in the Forms panel under Other Tasks > Set Field Calculation Order.

Thanks,
Lori

Daniel Burge

2, 2014-05-13 13, 2014

Lori,
I created a declining balance form. I have the Columns calculating correctly, but the total pre populates down the rest of the total column…. Do you have any ideas on how to make it so you see the last total once and not down the rest of the column?
Dan

Lori Kassuba

9, 2014-05-06 06, 2014

Hi Cynthia MOtt,

This particular discussion should help you:
http://answers.acrobatusers.com/Logic-percentage-format-text-box-q40903.aspx

Thanks,
Lori

Lori Kassuba

9, 2014-05-06 06, 2014

Hi Shannon,

Percentage fields are bit different in Acrobat. They only have a value between 0 and 1, which means that when you use them in a calculation, you would use a value of 0.15 for 15%.

Thanks,
Lori

Cynthia MOtt

1, 2014-04-30 30, 2014

I have a form that shows current salary, IncreaseDecrease amount, new amount and percentage.  I have the format for the percentage set to none, and I have selected teh radio button: simplfied field notation.  The calculation is new amount/IncreaseDecrease.  This works fine when I have test amounts in the fields but then I get those errors when the form is empty and you are trying to fill it out.  I understand that I need to put something in the Custom Calculation script - would it be possible for you to share this?

Shannon

11, 2014-04-28 28, 2014

I am having troubles incorporating a percentage into a multiplication equation. The percentages (which I am trying to display as numbers with decimal points) don’t carry the decimal points over into the equation, or change when a new field is entered. Any suggestions?

Lisa

2, 2014-04-25 25, 2014

Whoopee!  I thought maybe it was because it was numbers.  I renamed them aa and bb, and it calculated!!  All set!

Lisa

2, 2014-04-25 25, 2014

Lori, thanks for responding, but it didn’t help, I have tried that video.  I even tried naming the fields 1 & 2, but they total to the actual math problem with a number 1 when it should calculate out to $992.92.  I don’t need to do any updates, so I am at a loss.

Lori Kassuba

1, 2014-04-25 25, 2014

Hi lisa nickerson,

This tutorial should help you with your subtraction problem:
acrobatusers.com/tutorials/using-subtraction-in-a-form-field

Thanks,
Lori

lisa nickerson

9, 2014-04-23 23, 2014

I need help with a subtraction function.  I have one field that I need to either subtract three other field from or a field that I have the three tallied.  I can’t figure this out!  Please help!

Lori Kassuba

9, 2014-04-04 04, 2014

Hi Simon,

Thanks for letting us know you got everything working.

Lori

Simon

8, 2014-04-01 01, 2014

Thanks once again Lori. In Acrobat 9 it was under, Advanced menu, Extend features in Adobe Reader. But your clue was enough to put me on the right track. All fixed and working as intended now. Thank you.

Lori Kassuba

1, 2014-04-01 01, 2014

Hi Simon,

So glad to hear you got things working. To allow others to save the form data your recipient with either need to use Reader XI (this specific version) or you’ll need to reader-enable the PDF. This command is found under File > Save As Other > Reader Extended PDF.

Thanks,
Lori

Simon

5, 2014-03-26 26, 2014

So now I have my beautiful price list all completed and functioning. Works great if you’re running adobe pro. But if I send it to somebody else that is only running Adobe reader, it does not allow them to save any information entered into the form. It will allow them only to save a blank copy. Is there any solution to make this form work with Adobe Reader, or have I gone about this the wrong way from the start?

Simon

3, 2014-02-12 12, 2014

That was it. Thank you very much Lori for saving me hours of further frustration. I’m using Acrobat Pro 9 and it was under Forms > Edit Fields > Set Field Calculation Order.

Lori Kassuba

2, 2014-02-12 12, 2014

Hi Simon,

Just make sure you have the calculation order set properly. You’ll find this in the Forms panel under Other Tasks > Set Field Calculation Order.

Thanks,
Lori

Simon

12, 2014-02-12 12, 2014

Hi and thanks in advance for any help you can give me. Trying to do a price list form. I have a field which is a fixed price. I have nominated the value by using by entering it as a value in the Simplified Field Notation field. I have a row of user entered boxes to enter how many items of each size. Numerical values. Then a total box which totals the quantity of items and finally a Sub Total box for the Dollar value. As soon as I enter a value in the quantity the total quantity calculation immediately updates. (sum of all the orders) but the dollar value in the sub total (product of Nominated dollar value X quantity total) will not update until i enter another order value in another row? how do i get the secondary calculation to auto update immediately?

Lori Kassuba

9, 2014-02-06 06, 2014

Hi Leon,

Can you please post your question here and select the JavaScript category so that one of our Experts can assist you with your question?
http://answers.acrobatusers.com/AskQuestion.aspx

Thanks,
Lori

Leon

12, 2014-02-05 05, 2014

Hi Donna, I am hoping you can help me. I am using ‘X Pro’.

I have developed multiple dropdown boxes each with a value of 1-5. The default option in each dropdown is a blank with the export value “” so that the custom calculation for getting average works.

Problem is - the dropdowns are in Document Javascipts as required fields (a selection of 1-5 is required).

This function however will not work as JS assumes data in the boxes and will not alert. If I remove the export value “” then I will recieve the alert. Of course, if I remove the value, the calculation for average is off because it counts everything.

Is there a way to rectify this?

donna baker

1, 2014-01-25 25, 2014

Hi Barb -

Yes, you can definitely do that. When you’re setting up the field, you’ll specify a returned value for a range rather than the actual input. Can you please post your question to the Forms or JavaScript forums?

donna.

donna baker

4, 2014-01-21 21, 2014

Hi Tracey -

Could you please post your question to the JavaScript forum? It’s located here:

http://forums.adobe.com/community/acrobat/acrobat_scripting

donna.

Barb

1, 2014-01-21 21, 2014

I would like to perform a calculation and return the value of a user entered field based upon the result set.  So for example, if the calculation value is between 5 and 10, it should render the value of field 1, between 11-15 - the value of field 2, between 16-20 - the value of field 3 and so on.  Has anyone ever done this?  Thanks!

Tracy B

3, 2014-01-12 12, 2014

Hello, I read your responses.  I have a similar issue with summation of numeric fields using Javascript for Adobe.  I build this formula and it works but assumes all fields are “not null.”  As you add values, the sum concatenates instead of adds to the total.  All of the fields are defined as “Number”. What is the issue?

var a=this.getField(“Advertising 1”);
var b=this.getField(“Bank Fee 1”);
var c=this.getField(“Buildout 1”);
var d=this.getField(“Insurance 1”);
var e=this.getField(“License 1”);
var f=this.getField(“CC 1”);
var g=this.getField(“Computer 1”);
var h=this.getField(“Copyright 1”);
var i=this.getField(“Dues 1”);
var j=this.getField(“Fixtures 1”);
var k=this.getField(“Incorporation 1”);
var l=this.getField(“Internet 1”);
var m=this.getField(“Inventory 1”);
var n=this.getField(“Permits 1”);
var o=this.getField(“Application Fee 1”);
var p=this.getField(“Marketing 1”);var q=this.getField(“Furniture 1”);
var r=this.getField(“Supplies 1”);
var s=this.getField(“Payroll 1”);
var t=this.getField(“Printing 1”);
var u=this.getField(“Professional 1”);
var v=this.getField(“Rent 1”);
var w=this.getField(“Signage 1”);
var x=this.getField(“Sales Tax 1”);
var y=this.getField(“Telephone 1”);
var z=this.getField(“Utility 1”);
var aa=this.getField(“Other 1_1”);
var bb=this.getField(“Other 2_1”);
event.value=a.value+b.value+c.value+d.value+e.value+f.value+g.value+h.value+i.value+j.value+k.value+l.value+m.value+n.value+o.value+p.value+q.value+r.value+s.value+t.value+u.value+v.value+w.value+x.value+y.value+z.value+aa.value+bb.value

Lori Kassuba

11, 2013-12-31 31, 2013

Hi Randy Solis,

Thanks for posting your suggestion.

Lori

Randy Solis

11, 2013-12-26 26, 2013

Donna,

I was also having the same problem as Cindy and Susan, not be able to select individual forms to calculate, even after doing the advice you gave. I found the problem, at least it worked for me. Make sure that the forms you want are obviously set to numerical as stated and that the JavaScript is on. When you go to click the check box, click slightly to the left of the actual box, and it worked for me! Looks like just a button alignment issue within the program. Hopefully this can help you guys correct the error. Thank you for your all your help!

donna baker

1, 2013-11-29 29, 2013

Hi Ron -

Yes, you can do that. When you add a check box, open the Properties dialog, and click the Options tab. Type a value into the Export Value field. When you’re done, make a text field for the total, and select the individual check boxes. As you click each checkbox, the value is exported directly to your Total field. Neat idea, isn’t it?

donna.

Ron

5, 2013-11-20 20, 2013

Hi Donna, hopefully you can help me and I am sure some other people could use this feature.

I have an simple order form with items listed and their prices.  Next to each price I have Check Boxes.  How do I assign a value (in Dollars) to the check boxes so if a customer checks a box I can perform a simple mathematical addition of the check Box vales and display the Total of the selected check boxes.

donna baker

1, 2013-11-14 14, 2013

Hi Bob -

Thanks very much for posting your script—I’m sure it’s going to come in handy for others in the future.

donna.

Bob

10, 2013-11-13 13, 2013

I went on vacation for a couple of weeks and am just now seeing the response to my query “I have a form that requires simple multiplication and addition using both default numbers and user input data.”

Between posting my query and then going on vacation, I experimented with a number of methods. This included recreating the form, multiple times, from scratch, with ONLY the required fields that had calculations. Reviewing those files, all of them are in proper sequence. Each time I tried this the error did not occur until adding the fouth set of fields and it ALWAYS occured.

I finally found a simple Javascript online that I was able to modify. This was only used for the final TOTAL (all the sub-total fields used the built in SUM function).

The script I used:

// Custom Calculate script for text field to add two field values
(function () {

  // Get the field values, as numbers
  var v1 = +getField(“ST01”).value;
  var v2 = +getField(“ST02”).value;
  var v3 = +getField(“ST03”).value;
  var v4 = +getField(“ST04”).value;
  var v5 = +getField(“ST05”).value;
  var v6 = +getField(“ST06”).value;
  var v7 = +getField(“ST07”).value;
  var v8 = +getField(“ST08”).value;
  var v9 = +getField(“ST09”).value;
  var v10 = +getField(“ST10”).value;
  var v11 = +getField(“ST11”).value;
  var v12 = +getField(“ST12”).value;

  // Set the value of this field to the sum
  event.value = v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12;

})();

donna baker

1, 2013-10-31 31, 2013

Hi Cindy -

I’m glad it worked. I don’t have much experience with spaces in field names as I’ve always used a single string of characters, using _ instead of a space. That prevents problems in all sorts of scripting, including JavaScript.

donna.

Cindy Warmbrodt

2, 2013-10-30 30, 2013

Hi Donna,

Thank you for your reply.  I did format the fields as numbers; I was certain that would solve the problem but it did not. 
I was able to get it to work via the Simplified Field Notation.  I was informed of the \ symbol to accomodate the space in my field names.
When I get a moment, I will see if this issue happens on other forms.  This was an imported Excel doc; I wonder if I can isolate it down so I can provide more specific feedback to the Adobe folks.  I found a couple of other people siting the same issue so it seems to be something that needs addressed in a future update.

Thanks,
Cindy

donna baker

5, 2013-10-29 29, 2013

Hi Cindy -

Make sure all your fields that you intend to calculate are defined as numerical fields in the Format tab of the properties dialog box. By default, the field content is alphanumeric, and Acrobat ignores those fields in producing calculations.

donna.

donna baker

5, 2013-10-29 29, 2013

Hi Bob -

Hopefully there’s an easy fix. When you added the extra fields you disrupted the field calculation order. Use the tools in the Forms panel to make sure the fields are in sequence. If you had a new user that is calculated after a final total, for example, you won’t have the correct outcome.

donna.

Cindy Warmbrodt

6, 2013-10-28 28, 2013

I have the same issue as Susan.  Enable JavaScript is enabled.  It simply won’t let me check/select any fields to calculate.  I can select all or deselect all but cannot do anything individually.  Any thoughts?
Cindy

Bob

4, 2013-10-24 24, 2013

I have a form that requires simple multiplication and addition using both default numbers and user input data.

Originally, the form required three Quantity fields, each multiplied by a default Rate value, and then one Quantity field multiplied by a user input Rate value to provide a Sub Total, and finally, all the Sub Totals were added up to create a Grand Total.

All was well…. and then I was told to add eight more User Input fields. After adding those fields, all the Sub Totals functioned properly, but, the Grand Total is entirely erratic with the displayed results. The Grand Total most often indicates zero, but sometimes displays odd combinations from apparently random fields. More oddly, sometimes, AFTER I delete a Quantity or a user input Rate the sum shows up (even though it was just deleted). Once, just once, it actually gave a correct sum with the first four fields.

Any suggestions would be appreciated.

Lori Kassuba

9, 2013-10-11 11, 2013

Hi Marie Lauer,

Can you post your question here (and select the forms category) so our experts can help?
http://answers.acrobatusers.com/AskQuestion.aspx

Thanks,
Lori

Lori Kassuba

9, 2013-10-11 11, 2013

Hi susan Roudebush,

Try making sure that “Enable JavaScript” is turned on under Edit > Preferences > JavaScript.

Thanks,
Lori

Marie Lauer

3, 2013-10-09 09, 2013

I wonder if you can help me with a calculation quandry.  I have 3 subtotals that I need to add and then multiply by 5%. I have a box for each subtotal and I want to have the fourth box to be the total x 5%.  Can you assist?

It looks like this
Subtotal
Subtotal2
Subtotal3
GST Tax

Thanks!

susan Roudebush

11, 2013-10-08 08, 2013

I installed Acrobat Pro XI and now my forms won’t calculate.  I can make the same pdf calculate on my laptop version X of acrobat, and my boss can make the same form calculate on her desktop but when I try to “check” the boxes of the cells I want to calculate in XI, the boxes won’t check.  I simply can’t check them. I’ve tried multiple documents, none allow checking.  I worked with an adobe tech using chat; he had me run a repair program found under the help pulldown. No luck.  Any ideas about what’s going on?  I need this to work!  I make forms that calculate as my job! And I need to do this on my desktop!!!

tiffani

9, 2013-09-25 25, 2013

Thank you for this great video! really awesome! was wondering, ill be using these forms to calculate revenue, is it possible to add $ signs to these calculations?

Hi tiffani,

You can automatically add the $ sign under the Form Properties under the Format tab and select Number from the format category the select a currency symbol.

Thanks,
Lori

donna baker

11, 2013-07-25 25, 2013

Hi Radika -

I’m glad you liked the infographic!

You’re not going to find the total field update its value until you click another field as the calculation isn’t performed until the field where you entered data passes through the OnBlur event.

donna.

Radika

7, 2013-07-16 16, 2013

Hey,

hHave a simple summation in a PDF.I am passing the field values through code to their respective fields.Once its done i want to perform the summation of those fields to an another total field.The calculation is performed only after i click on other fields.Is there any way to display the total during the PDF display itself rather than me clicking on some other fields and calculation being performed.
And Thanks for the tutorial that was helpful

Thanks

Radika.

donna baker

12, 2013-04-25 25, 2013

Hi Angela -

Yes you could do this, but you’d need to add a JavaScript for each field that would call the results from the previous field and add 1 hr.

Please check out the JavaScript forum at acrobatusers.com for solutions and assistance.

donna.

Angela

6, 2013-04-24 24, 2013

I want to create a form that is a schedule beginning at whatever time the user specifies.  Is there a way to put a time in the first field (like 6:30 AM) and have each successive hour be one hour later than the previous one?  I don’t mind using a 24 hour time format (i.e., 13:30 as opposed to 1:30 PM).
Thanks!

donna baker

9, 2013-04-03 03, 2013

Hi Allesandro -

If you’ve assigned the numbers to have no decimal places, then you won’t have a 5.5 value showing, and rounding is always going to be up, not down without decimals.

Perhaps you should post your question to the Adobe forums. I think you’ll have to use JavaScript to produce the rounding down.

donna.

Alessandro

5, 2013-03-28 28, 2013

Hi and thank you for your work…
I am trying to find a way to round down the values I obtain as a result of a calculation I made in simple notation.
put simply:
field 1 has a value, in field 2 I am trying to obtain
field1 / 2 rounded down so as not to have any decimals (I selected 0 decimals when assigning the number format to field2)
right now I have written in field 2:
field1/2.. which works wonderfully with even numbers.
10/2 gives 5, as it should
however, 11/2 gives 6..which I am trying to avoid.. (the result of course being 5,5)
I tried floor(field1/2)
which did nothing
so..is there a way for people who don’t know Java and really wouldn’t know where to start with that to round down the decimals in simple notation?
thank you
A.

Patty Friesen

12, 2013-03-12 12, 2013

Hi Sue,

Thanks for taking the time to leave feedback. Glad to hear the tip was helpful!

Patty

Sue

11, 2013-03-07 07, 2013

Just wanted to thank you for the obvious tip of “using no spaces”.  I have been pounding my head for a couple of hours, and that made the light bulb go off.  Thanks! (Also just a reminder to folks to count their parenthesis and make sure they match if you have a multi-part equation)

donna baker

1, 2013-01-28 28, 2013

Hi Pierre -

There are a few ways you can calculate a percentage. If either value is a constant, set that as a default value in a field, as a decimal, ie: 38% would be shown as .38. Then use a field to input the company worth, ie. 2,600,300. To calculate the percentage, add another field, then in the Properties, click Calculate. Click the Value is the radio button and choose Product from the dropdown list. Click Pick and choose your two fields for calculation. For all three fields, make sure you have specified their format as Number on the Format category.

You may want to have one of the fields hidden. For example, if your shareholders hold different percentages, leave that visible to enter the data, but set the field holding the total company worth as hidden. The calculations will work the same way, and you won’t risk users making changes.

In order for the form to be saved, it has to be enabled for use in Adobe Reader.

donna.

Pierre

9, 2013-01-20 20, 2013

1- How to calculate a percentage? (Using Acrobat X Pro or Acrobat XI Pro)  For example, a shoreholder of a company has 38% of a company that worth $2,600,300.00

2-I already created a form (with fields to be completed by my clients) However, the form works nicely but each time we try to save the form with the input data a message in Adobe reader shows up telling us the the data cannot be save. How can I made my form(s) saveble?
Thanks

Pierre

Leave a reply:

Have an urgent question? Post your question to our Ask an Expert forum for a faster response.

Fields marked with * are required.

Download
Acrobat XI trial

Get the trial now

Learn how to
edit PDF.

Get started