Skip to main content
Participant
Jul 1, 2025 11:07 PM UTC
Answered

Calculations not working in worksheet

Hello! Hoping someone may be able to help.
I've created this worksheet for a client which calculates a spending and retirement budget. I created all of the calculation fields in Acrobat 2025 (Mac). The "Total spending" section calculates a monthly and annual amounts. The annual amount basically multiplies the monthly by 12. Simple, right? When entering values starting at the top left, the first section performs as expected, but the remaining sections don't totally calculate the annual correctly until you tab to the next section and enter a value. Not ideal, but we can live with that. The real problem is in the "Discretionary spending" section - the annual cell doesn't calculate properly until you tab through the cells and enter a value in the first "Social Security" cell. Very much appreciate any insight into why this is happening. 

PDF Automation Station
Community Expert
Jul 2, 2025 1:02 AM UTC

10 replies

boilermaker73
Inspiring
Oct 31, 2026 10:03 AM UTC

An Alternative to Acrobat's Automatic Calculated Fields

For developers experiencing problems with Acrobat's automatic field calculations, particularly calculation order, delayed updates, or dependencies between calculated fields, an alternative worth considering is to move the calculation logic into a document-level JavaScript function.

Rather than assigning separate calculation scripts to multiple fields and relying on Acrobat's automatic calculation sequence, you can create a single function that performs the required calculations in a controlled order.

For example:

function updateTotals() {
var qty = Number(this.getField("Quantity").value);
var price = Number(this.getField("UnitPrice").value);

if (!Number.isFinite(qty) || !Number.isFinite(price)) {
this.getField("Total").value = "";
return;
}

this.getField("Total").value = qty * price;
}

The function can then be called from an appropriate field event, such as the Validate event of either input field:

updateTotals();

This approach allows the developer to control calculation dependencies explicitly rather than relying on the automatic calculation order.

One important consideration: A Validate event occurs before the new field value is committed. Consequently, the function above may still read the previous value of the field being edited. To avoid that issue, either pass the pending event.value into the function or trigger the calculation after the input value has been committed.

This alternative does not mean Acrobat's automatic calculated fields are inherently unreliable or should always be avoided. They work well for many straightforward forms.

However, for complex interactive PDF applications involving multiple dependent calculations, reusable data, and custom workflows, explicitly controlled JavaScript functions can provide a more predictable and maintainable architecture.

Translate
Participant
Sep 10, 2025 10:36 AM UTC

If you are Looking for a Retirement Calculator then you should definitely try out this FIRE Calculator It's a simple Retirement Calculator tool that does the math automatically and shows results in an easy format.

 

Translate
PDF Automation Station
Community Expert
Community Expert
Jul 2, 2025 1:02 AM UTC
Kathy5CDBAuthor
Participant
Jul 2, 2025 4:22 PM UTC

Thank you for the response. 

I have double checked the calculation order and I believe it is correct. Did you open the file to see the order? If so, can you please let me know what is not correct? It would be helpful to understand in more detail what the issue is so I can fix it properly.
Thank you! 

Translate
PDF Automation Station
Community Expert
Community Expert
Jul 2, 2025 5:28 PM UTC

I did open it but I didn't go through all the fields.  Any field that uses other calculated fields in its calculation should come after the fields that are inputs into its calculation.  Otherwise, there will be a lag in calculation results since all calculations run every time a field value changes.  For example, if field D is the sum of fields A, B, and C, and A, B, and C have their own calculations, they must all come before field D, otherwise the values that feed into D might not be correct because they are calculating after D is calculated.

The default calculation order is the order in which calcualtions were added to fields, so if you add them in the logical order it should be correct.

Translate