Sum Leave Drop-Down Export Values by Selection in an Acrobat Form
Question details
Calculate separate PTO and unpaid leave totals from drop-down selections in an Acrobat timesheet form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A timesheet uses drop-down choices for PTO, unpaid leave, and no leave, with separate total fields required for each leave type.
- Observed behavior
- PTO and unpaid leave both export the value 8, so a calculation based on that value cannot distinguish between them.
Open the PDF in Acrobat and choose All tools > Prepare a form. Check the names of the leave drop-downs and the fields that will display the totals.
Use distinct export values and calculate each leave total
Use this method to keep one leave drop-down per day and calculate separate eight-hour totals.
Both leave choices currently export 8, so the calculation cannot tell which one was selected. Give each choice a distinct export value, then count matching selections and multiply by 8.
The example below assumes three drop-down fields named Leave1, Leave2, and Leave3. Replace these names with all the actual leave field names in your form.
In Prepare a form, open each leave drop-down's Properties and select the Options tab. Set the PTO choice's export value to PTO, the Unpaid choice's export value to Unpaid, and the blank or no-leave choice's export value to 0.
Open the PTO total field's Properties, select Calculate > Custom calculation script, and click Edit. Enter: var names = ["Leave1", "Leave2", "Leave3"]; var count = 0; for (var i = 0; i < names.length; i++) { if (this.getField(names[i]).valueAsString === "PTO") count++; } event.value = count * 8;
Open the unpaid total field's Properties and choose Calculate > Custom calculation script > Edit. Use the same script, but replace "PTO" in the comparison with "Unpaid".
Exit form editing and select PTO, Unpaid, and the blank or no-leave choice in the drop-downs. Confirm that each leave total increases by 8 only for its matching selection.

Track PTO and unpaid leave in WPS Spreadsheets
For a spreadsheet-based timesheet, use a leave selection column and COUNTIF formulas to calculate separate eight-hour totals. This creates an alternative timesheet; it does not modify the Acrobat form.
- 1. Create the timesheet: Open WPS Spreadsheets, create a workbook, and enter dates in column A and a Leave Type heading in cell B1.
- 2. Add leave selections: Select cells B2:B32, open Data > Data Validation, and create a list containing PTO and Unpaid. Leave cells blank when no leave applies.
- 3. Calculate PTO hours: In a PTO total cell, enter =COUNTIF(B2:B32,"PTO")*8.
- 4. Calculate unpaid hours: In an unpaid total cell, enter =COUNTIF(B2:B32,"Unpaid")*8. Adjust the ranges if your timesheet uses different rows.

Frequently Asked Questions
Why can't Acrobat separate PTO and unpaid leave when both export 8?
A calculation reading the export value receives the same value for both choices. Assign distinct values such as PTO and Unpaid in each drop-down's Properties > Options.
Where do I add a custom calculation in Acrobat?
Choose All tools > Prepare a form, open the total field's Properties, and select Calculate > Custom calculation script > Edit.
What if each leave selection is not always eight hours?
The example script assumes eight hours per selection. For variable hours, add hour-entry fields and update the calculation to sum the hours associated with each selected leave type.
Will the calculations work in every PDF viewer?
Not necessarily. The custom scripts require support for Acrobat form JavaScript, so test the form in the intended viewer before distributing it.




