Calculate Yes, No, and NA Radio Button Totals in Adobe Acrobat
Question details
Calculate separate totals for Yes, No, and NA selections across radio-button groups in an Acrobat PDF form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form contains radio-button groups named Group1 through Group48 and needs a total for each response.
- Observed behavior
- Each total field should count groups whose selected export value matches Yes, No, or NA.
Open the PDF in Acrobat and use Prepare a form to check that the groups are named Group1 through Group48. Verify that their radio-button export values are exactly Yes, No, and NA.
Count each response with an Acrobat custom calculation script
Use a calculation script in each total field to count the selected value of every radio-button group.
The script reads the value of each parent radio-button group directly. Do not call getField("Yes") on the group field object.
In Acrobat, open the PDF and select All tools > Prepare a form. Add three text fields for the Yes, No, and NA totals if they do not already exist.
Open the Yes total field's Properties, select Calculate, choose Custom calculation script, and click Edit. Enter: var total = 0; for (var i = 1; i <= 48; i++) { if (this.getField("Group" + i).valueAsString == "Yes") total++; } event.value = total;
Open the Calculate tab for the No total field and add the same script, replacing "Yes" with "No". Repeat for the NA total field, replacing "Yes" with "NA".
Close the field properties, preview the form, and select different responses in several groups. Confirm that each total changes to match the selections.

Use WPS Office for PDF and spreadsheet workflows
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office files. It does not fix Acrobat calculation scripts, but you can use WPS Spreadsheets to count responses recorded in a worksheet.

Frequently Asked Questions
Why does calling getField("Yes") on the radio group fail?
The parent radio group is already a field object. Read this.getField("Group" + i).valueAsString and compare it with "Yes" instead of calling getField on that object.
How do I count No or NA instead of Yes?
In each total field's Properties > Calculate > Custom calculation script, use the same loop and replace "Yes" with the exact export value "No" or "NA".
What if my form has fewer than 48 groups?
Change the loop limit from 48 to the number of consecutively named groups in your form. Also change the "Group" prefix if your field names use a different prefix.
Why is a selected response missing from the total?
In Prepare a form, check the radio button's export value and its group name. The script compares the export value exactly, so a different spelling or capitalization will not match.




