PDF Editing Issues

Calculate Total Points per Player in an Adobe Acrobat PDF Form

Natalie TaylorNatalie Taylor Nov 18, 2026 868 views

Question details

Calculate each player's total points by matching their name to corresponding score fields in a PDF form.

Calculate Total Points per Player in an Acrobat PDF Form
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A single-elimination scoresheet contains player names and point fields for multiple games.
Observed behavior
The total field should add the scores associated with every occurrence of the selected player's name.
Before you start

Open the form in Acrobat's Prepare a Form tool and check the exact names of the player, score, and total fields. The example below assumes player fields p1 through p16 and corresponding score fields p1s through p16s.

Solution 1Recommended

Add a custom calculation script to the total field in Acrobat

Use this method when player and score fields follow a consistent naming pattern.

1
Open the form editor

Open the PDF in Adobe Acrobat and select Prepare a Form from the tools. Identify or create the text field that will display the player's total.

2
Open calculation settings

Double-click the total field, open the Calculate tab, and select Custom calculation script. Click Edit to open the script editor.

3
Enter the calculation

Paste this script, replacing Bob with the exact player name and adjusting the field names and loop range to match your form: var playerName = "Bob"; var total = 0; for (var i = 1; i <= 16; i++) { if (this.getField("p" + i).valueAsString == playerName) { total += Number(this.getField("p" + i + "s").valueAsString); } } event.value = total;

4
Save and test the form

Close the script editor, save the PDF, and enter matching player names and numeric scores in several rows. Check that the total field updates to their sum.

Add a custom calculation script to the total field in Acrobat
Check field names and scores: The script requires every referenced field to exist. Names must match exactly, and nonnumeric score values can produce an invalid total. Use a PDF viewer that supports Acrobat form JavaScript to run the calculation.
Free Microsoft Office alternative

Work with scoresheets and documents in WPS Office

WPS Office is a free, lightweight alternative with familiar editing tools and support for common Office formats, making it easy to move existing files into your workflow. It does not replace Acrobat's custom PDF form JavaScript editor.

Use spreadsheet tools to organize player names and scores.Open and edit compatible Microsoft Excel, Word, and PowerPoint formats.View PDF scoresheets alongside other documents.Navigate a familiar interface for a smoother move from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Can the script use a name entered in another form field?

Yes. Replace the first line with a field reference such as var playerName = this.getField("targetPlayer").valueAsString; and change targetPlayer to the actual field name.

Why is the total not updating?

In Acrobat, check the total field's Calculate tab and confirm that the script references existing fields with the correct names. Also check that form calculations and JavaScript are enabled in the PDF viewer.

What if my scoresheet has more than 16 player fields?

Change the loop limit in the script from i <= 16 to the last numbered player field. Ensure each player field has a corresponding score field using the naming pattern in the script.

Does the player name have to match exactly?

Yes. The example compares the entered name with Bob exactly, including capitalization and spaces. Enter names consistently or modify the comparison to normalize them.