PDF Editing Issues

Calculate PDF Form Totals with Radio Buttons in Adobe Acrobat

Elise WilliamsElise Williams Nov 18, 2026 868 views

Question details

Calculate a PDF form total by adding or subtracting amount fields according to the selected radio button.

Calculate PDF Form Totals with Radio Buttons in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form contains multiple amount fields and a radio button group that selects the calculation to apply.
Observed behavior
The Total field should show the sum or the subtraction result based on the selected radio button.
Before you start

Open the PDF in Adobe Acrobat and enter Prepare a form. Check the exact names of the amount fields and radio button group, as well as the export value assigned to each radio button.

Solution 1Recommended

Add a custom calculation script to the Total field

Use this method when a radio button selection determines whether the form adds or subtracts its amount fields.

The example assumes three numeric fields named Amount.0, Amount.1, and Amount.2, plus a radio button group named Group1 with export values sum and subtract. Subtraction is performed in field order: Amount.0 minus Amount.1 minus Amount.2.

1
Open the form editor

In Adobe Acrobat, open the PDF and select All tools > Prepare a form. Create a text field for the total if the form does not already have one.

2
Check the radio button values

In Prepare a form, open each radio button's Properties and check its group name and Options export value. This example uses the group name Group1 and export values sum and subtract.

3
Open the calculation editor

Open the Total text field's Properties, select the Calculate tab, choose Custom calculation script, and click Edit.

4
Enter the script

In the JavaScript editor, enter: var a = Number(this.getField("Amount.0").value); var b = Number(this.getField("Amount.1").value); var c = Number(this.getField("Amount.2").value); var choice = this.getField("Group1").valueAsString; if (choice == "sum") event.value = a + b + c; else if (choice == "subtract") event.value = a - b - c; else event.value = ""; Replace the field names and export values with those in your form, then click OK and close Properties.

5
Test both choices

Use Preview in Prepare a form, enter numeric amounts, and select each radio button. Confirm that Total shows the expected result, then save the PDF.

Add a custom calculation script to the Total field
Check viewer support: The calculation relies on Acrobat JavaScript. Some PDF viewers do not support these scripts, so test the saved form in the viewer your recipients will use.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility helps you move existing files into your workflow; use Adobe Acrobat to author the custom calculation script described above.

Open and work with PDF forms alongside other documentsCompatible with Microsoft Office formats including DOCX and XLSXFamiliar interface makes it easy to move from Microsoft OfficeFree core tools in a lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Where do I find the radio button export values?

In Acrobat's Prepare a form tool, open each radio button's Properties and check the export value on the Options tab. Use those exact values in the script's comparisons.

Why is the Total field blank?

The example leaves Total blank when the selected value is neither sum nor subtract. Check the group name and export values in the radio buttons' Properties, then verify the names used in the Total field's Calculate script.

Can I change the subtraction order?

Yes. In the Total field's custom calculation script, change the expression after event.value. For example, b - a - c subtracts Amount.0 and Amount.2 from Amount.1.

Will the calculation work in every PDF viewer?

Not necessarily. The calculation uses Acrobat JavaScript, which some PDF viewers do not support. Save the form and test it in the viewer intended for recipients.