Acrobat Form Calculation: Add 0.05 and Cap a Field
Question details
Calculate field C by adding 0.05 to field A, limiting the result to 0.1795, and leaving C blank when A is empty.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form needs a calculated field with an upper limit and a blank result for an empty input.
- Observed behavior
- Field C should show the calculated value up to 0.1795 and remain blank when field A has no value.
Open the form in an Acrobat version that can edit PDF forms. Check that the input field is named A and the calculated field is named C, or adjust the field name in the script.
Add a custom calculation script to field C
Use this method to calculate and cap the value automatically in an interactive Acrobat PDF form.
In Acrobat, open the PDF and select Prepare a Form from the tools menu.
Double-click field C and select the Calculate tab. Confirm that the input field is named A.
Select Custom calculation script, click Edit, and enter: var input = this.getField("A").valueAsString; if (input.replace(/\s/g, "") === "") { event.value = ""; } else { var n = Number(input); event.value = isFinite(n) ? Math.min(n + 0.05, 0.1795) : ""; }
Confirm the script, close the field properties, and save the PDF. Enter 0.1 in A to check that C shows 0.15; enter 0.2 to check the cap, then clear A to check that C becomes blank. Also test 0 in A.

Calculate the same capped value in WPS Spreadsheets
Use a formula in WPS Spreadsheets to add 0.05, apply the cap, and leave the result blank for an empty input. You can export the result to PDF, but the exported PDF is not an interactive Acrobat form calculation.
- 1. Open a spreadsheet: Open WPS Spreadsheets and create a blank workbook or open an existing one.
- 2. Enter the formula: Select cell C1 and enter =IF(A1="","",MIN(A1+0.05,0.1795)).
- 3. Test the calculation: Enter a number in A1 and check C1. Clear A1 to confirm that C1 appears blank.
- 4. Export if needed: Use the PDF export option in the File menu to create a PDF showing the current result.

Frequently Asked Questions
Where do I put the Acrobat calculation script?
Open Prepare a Form, double-click field C, and choose Calculate > Custom calculation script > Edit.
Does an input of zero leave field C blank?
No. The script checks for an empty value separately, so entering 0 in A produces 0.05 in C.
Why does the capped value display with fewer than four decimal places?
Open field C's Properties and check the Format tab. Adjust the number format and decimal places so that 0.1795 can be displayed.
Will a PDF exported from WPS Spreadsheets recalculate when someone edits it?
No. The exported PDF shows the spreadsheet result at export time; it does not contain the Acrobat custom calculation script.




