Reverse Score PDF Assessment Responses with Acrobat JavaScript
Question details
The user needs a copy-and-paste Acrobat form calculation script to reverse score selected assessment responses on a 0-to-4 scale.

- Product
- Adobe Acrobat form JavaScript
- Device & OS
- not provided
- Scenario
- An assessment form contains selected questions whose responses must be reverse scored and added to a total.
- Observed behavior
- The desired conversion is 0 to 4, 1 to 3, 2 to 2, 3 to 1, and 4 to 0.
Identify the exact Acrobat form field names for the questions that need reverse scoring and confirm that their stored values are numbers from 0 to 4. Create or identify a separate field to display the calculated total.
Add a reverse-scoring calculation script in Adobe Acrobat
Use a custom calculation script to convert selected responses and display their total in an Acrobat form field.
The formula 4 minus the response reverses every value on the 0-to-4 scale. The script skips blank responses and writes the sum to the calculation field.
Open the PDF in Adobe Acrobat and select Prepare a form from the tools or All tools menu.
Double-click the field that should display the reverse-scored total, then select the Calculate tab.
Select Custom calculation script, click Edit, and paste: var fields = ["Field1", "Field2", "Field3"]; var total = 0; for (var i = 0; i < fields.length; i++) { var value = this.getField(fields[i]).valueAsString; if (value !== "") total += 4 - Number(value); } event.value = total;
Replace Field1, Field2, and Field3 with the exact names of the response fields, adding more names to the array as needed. Save the PDF and test responses from 0 through 4.

Reverse Score Assessment Responses in WPS Spreadsheets
If you can work with assessment responses in a spreadsheet, WPS Spreadsheets can reverse score and total them with formulas. This is an alternative scoring workflow, not a way to add the Acrobat JavaScript calculation to the PDF form.
- 1. Enter responses: Open WPS Spreadsheets, create a workbook, and enter the responses to reverse-score questions in cells A2 through A10.
- 2. Add the scoring formula: Select cell B2 and enter =IF(A2="","",4-A2) to reverse score the response while leaving blank responses empty.
- 3. Fill the formula down: Drag the fill handle from B2 down through B10 to calculate the remaining reverse scores.
- 4. Calculate the total: Select a separate cell and enter =SUM(B2:B10) to add the converted scores.

Frequently Asked Questions
Why does subtracting the response from 4 reverse the score?
For a scale from 0 to 4, subtracting each response from 4 swaps the endpoints and leaves 2 unchanged: 0 becomes 4, 1 becomes 3, 2 stays 2, 3 becomes 1, and 4 becomes 0.
Where do I find the field names for the script?
In Acrobat, open Prepare a form and inspect each response field's properties. Use the exact field name in the script's fields array, including capitalization.
What happens if a response is blank?
The script skips blank response fields. If every listed field is blank, the total field displays 0.
Will the calculation work in every PDF viewer?
No. The viewer must support Acrobat form JavaScript and allow it to run. Test the saved form in the PDF viewer that respondents will use.




