PDF Editing Issues

Add Age to a PDF Form Calculation in Adobe Acrobat

John WilsonJohn Wilson Nov 25, 2026 868 views

Question details

Add age as an input to an existing Acrobat PDF form calculation.

Add Age to a PDF Form Calculation in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form calculates a body-fat estimate or another health value, and the user wants to include age.
Observed behavior
The desired calculation reads an age field and applies the rules of the chosen formula.
Before you start

Identify the exact formula, applicable age ranges, and names of the existing form fields. Standard adult BMI uses weight and height, not age; age may be relevant to a separate body-fat formula or to interpreting BMI for children.

Solution 1Recommended

Add the Age Field to the Acrobat Calculation Script

Use this approach when you have an existing calculated field and know how the selected formula uses age.

1
Open the form editor

Open the PDF in Acrobat and choose All tools > Prepare a form. Select the existing age field, or add a text field and name it Age.

2
Open the calculation script

Double-click the calculated result field, open Properties > Calculate, select Custom calculation script, and click Edit. Note the field names already used by the script.

3
Read and validate age

In the JavaScript editor, read the age field with `var ageText = this.getField("Age").valueAsString;` and convert it with `var age = Number(ageText);`. Replace Age with the exact field name if necessary. Check that the field is not blank, that age is a valid number, and that it falls within the formula's supported range before calculating.

4
Apply the chosen formula

Update the existing calculation logic to use the validated `age` variable according to the specified formula and age rules. Assign the resulting value to `event.value`; set `event.value` to an empty string when required inputs are invalid. Click OK to save the script.

5
Test the form

Close the form editor or use Preview, then enter values in the age and other input fields. Test valid values, blank and invalid inputs, and any age-range boundaries against known results for the chosen formula.

Add the Age Field to the Acrobat Calculation Script
Use a defined formula: There is no universal age adjustment for body-fat calculations. Choose a validated formula appropriate to the intended population before changing the script.
Free Microsoft Office alternative

Work With PDF and Office Files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDF and Office files. Its format support helps make the move from Microsoft Office straightforward. Use Adobe Acrobat to edit and test Acrobat-specific form JavaScript.

Open and view PDF documents alongside office filesCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFamiliar interface for a straightforward transition from Microsoft OfficeFree, lightweight tools for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Does age change the standard adult BMI calculation?

No. Standard adult BMI is calculated from weight and height. Age may be used in a separate body-fat estimate or when interpreting BMI for children.

Where can I find the calculated field's JavaScript?

In Acrobat, choose All tools > Prepare a form, double-click the result field, and open Properties > Calculate. If Custom calculation script is selected, click Edit to view the script.

Why is the age value not available to my script?

Check the age field's name in its Properties and use that exact name in `this.getField("Age")`. Also check that the field contains a valid number before applying the formula.

How can I check that the updated formula works?

Use Preview in Prepare a form and enter known test values, including age-range boundaries and invalid inputs. Compare the results with expected values from the chosen formula.