Calculate PDF Form Totals While Excluding N/A Answers
Question details
Calculate survey section scores without including N/A answers in the applicable maximum or average denominator.

- Product
- PDF forms
- Device & OS
- not provided
- Scenario
- A survey uses scored radio buttons and an N/A option for each question.
- Observed behavior
- The desired result is a section total and denominator that include only applicable, scored responses.
Check each radio button group's field name, numeric export values, N/A export value, and maximum score. To calculate inside the PDF, use a form editor and PDF viewer that support Acrobat JavaScript.
Use PDF Form JavaScript to Exclude N/A Responses
Use this approach when the PDF needs to calculate scores automatically as respondents answer.
This example calculates a total, an applicable maximum, and an average. It excludes N/A, unanswered, and nonnumeric values; a numeric zero is included. Replace the example field names and maximums with those in your form.
The example assumes the radio button groups have numeric export values for scored answers and an export value of N/A for the excluded option.
In Adobe Acrobat, open All tools > Prepare a form. Open the properties for each radio button and check the group name and each option's export value.
In Prepare a form, add three text fields named ScoreTotal, ScoreMax, and ScoreAverage. Set them to read-only if respondents should not edit the results.
Open each result field's Properties > Calculate, select Custom calculation script, and click Edit. Paste the following script into all three fields. Replace Q1 and Q2 and their maximums with your own question field names and maximum scores: var questions = [{name: "Q1", max: 5}, {name: "Q2", max: 3}]; var total = 0, maximum = 0, count = 0; for (var i = 0; i < questions.length; i++) { var field = this.getField(questions[i].name); if (!field) continue; var value = String(field.valueAsString).replace(/^\s+|\s+$/g, ""); if (value === "" || value === "Off" || value.toUpperCase() === "N/A") continue; var score = Number(value); if (!isFinite(score)) continue; total += score; maximum += questions[i].max; count++; } if (count === 0) event.value = ""; else if (event.target.name === "ScoreTotal") event.value = total; else if (event.target.name === "ScoreMax") event.value = maximum; else if (event.target.name === "ScoreAverage") event.value = total / count;
Save the PDF, then select scored answers, N/A, and a zero-score answer in the form. Confirm that ScoreMax includes only answered scored questions and that ScoreAverage divides by their count.

Calculate Applicable Survey Scores in WPS Spreadsheets
Transfer the PDF responses to a worksheet to calculate totals and applicable maximums without counting N/A answers. This calculates the results in the spreadsheet rather than adding live calculations to the PDF.
- 1. Create a worksheet: Open WPS Spreadsheets and create a blank workbook. Add headers for Question, Response, Maximum, and Applicable Maximum in cells A1 through D1.
- 2. Enter survey responses: Enter each question in column A, its numeric score or N/A in column B, and its maximum possible score in column C. Leave unanswered responses blank.
- 3. Calculate applicable maximums: In D2, enter =IF(ISNUMBER(B2),C2,0), then drag the fill handle down through the remaining question rows.
- 4. Calculate the results: Below the data, use =SUM(B2:B10) for the total and =SUM(D2:D10) for the applicable maximum. Use =IF(COUNT(B2:B10)=0,"",AVERAGE(B2:B10)) for the average, adjusting each range to match your rows.
- 5. Save the workbook: Choose File > Save As and save the results as an XLSX workbook.

Frequently Asked Questions
Should an N/A answer count as zero?
No. Exclude it from both the score total and the applicable maximum or average count. A genuine numeric zero, however, should remain in the calculation.
How do I calculate a percentage of the applicable maximum?
Divide the total score by the applicable maximum and multiply by 100. Check that the maximum is greater than zero before dividing.
Why doesn't my PDF calculation update in a browser?
The browser's PDF viewer may not support form JavaScript. Open the file in a viewer that supports Acrobat JavaScript and test the same fields there.
Can I calculate results without editing the PDF?
Yes. Transfer the responses and question maximums to WPS Spreadsheets, then use SUM for the score and an IF(ISNUMBER(...)) formula to include only scored answers in the maximum.




