Extract the First Four Digits of a Form Calculation in Adobe Acrobat
Question details
Display the first four characters of a form field value multiplied by 150 in another Acrobat form field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form needs a destination field that calculates a value from a source field and displays only the beginning of the result.
- Observed behavior
- The destination field should show up to the first four characters of the calculated result.
Open the PDF in Adobe Acrobat and confirm that it has a source field and a separate text field for the result. Check the source field's exact name in its properties; the example below uses Text1.0.1.
Add a Custom Calculation Script to the Destination Field
Use an Acrobat form calculation to multiply the source value by 150 and display the first four characters.
In Acrobat, open the PDF and choose All tools > Prepare a form.
Double-click the source field to open its properties. Confirm its name on the General tab and select Number on the Format tab.
Double-click the destination text field, open the Calculate tab, select Custom calculation script, and click Edit. Enter: event.value = (this.getField("Text1.0.1").value * 150).toString().substr(0, 4); Replace Text1.0.1 with the exact source field name if needed.
In the destination field's Format tab, select None, then close the properties dialog.
Exit form editing or select Preview, enter a number in the source field, and move to another field to check the result.

Work With PDF Forms and Office Files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. It can help you move between common file formats, but it does not replace the Acrobat-specific calculation script described above.

Frequently Asked Questions
Where do I put the Acrobat calculation script?
Open All tools > Prepare a form, double-click the destination field, and select Calculate > Custom calculation script > Edit.
How do I use a different source field name?
Check the source field's name on its General properties tab, then replace Text1.0.1 inside this.getField("Text1.0.1") with that exact name.
Does the script always return four digits?
No. It returns up to four characters from the calculated value. A minus sign or decimal point counts as a character, and shorter results are not padded with zeros.
What format should I use for the result field?
In the destination text field's properties, open the Format tab and select None so Acrobat does not apply number formatting to the extracted text.




