Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
13

Fillable form with math formula not working

Explorer ,
Nov 02, 2023 Nov 02, 2023

Hello all,

 

I am trying to add a math formula to a Fillable pdf and I am running into some issues. I have taken a formula from excel and need it to work inside of this pdf with no luck. I've got this portion of the formula to work: G29*((G30-G28)/(G30-G31)) I need this equation taken to the power of 0.54. Is there anyone who can help me with this?

TOPICS
PDF , PDF forms
6.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
3 ACCEPTED SOLUTIONS
Community Expert ,
Nov 02, 2023 Nov 02, 2023

OK, then you must switch to using a script, such as this one (note you must also take into account the situation where G30 equals G31, to avoid division by zero):

 

 

var G28 = Number(this.getField("G28").valueAsString);
var G29 = Number(this.getField("G29").valueAsString);
var G30 = Number(this.getField("G30").valueAsString);
var G31 = Number(this.getField("G31").valueAsString);

var v1 = (G30-G31);
if (v1==0) event.value = "";
else {
	var v2 = (G30-G28);
	var v3 = G29*(v2/v1);
	event.value = Math.pow(v3, 0.54);
}

 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Ah, OK, that makes more sense... Then change these two lines:

var v3 = G29*(v2/v1);
event.value = Math.pow(v3, 0.54);

To:

var v3 = (v2/v1);
event.value = G29*Math.pow(v3, 0.54);

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 31, 2025 Oct 31, 2025
LATEST

I installed Adobe Acrobat Reader on another computer, opened my form, and you are correct, the math formulas do work with that product.  Thanks!!

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Math.pow(base, exponent)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

Sorry I'm very "dumb" when it comes to this, I would input what you typed where? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Are you using a script to perform the calculation? If so, post your code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

What I posted above is exactly what I put inside the simplified field notation. Nothing is in calculation script

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

I attached a picture

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

OK, then you must switch to using a script, such as this one (note you must also take into account the situation where G30 equals G31, to avoid division by zero):

 

 

var G28 = Number(this.getField("G28").valueAsString);
var G29 = Number(this.getField("G29").valueAsString);
var G30 = Number(this.getField("G30").valueAsString);
var G31 = Number(this.getField("G31").valueAsString);

var v1 = (G30-G31);
if (v1==0) event.value = "";
else {
	var v2 = (G30-G28);
	var v3 = G29*(v2/v1);
	event.value = Math.pow(v3, 0.54);
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

(I edited the code above to make sure the values are converted to numbers)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

Awesome!! I just need to copy and paste this into my pdf and I'm good to go?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Yes, under the "Custom calculation script" option.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy and pasting that does not give me the correct results. Here is the formula i am trying to replicate from the excel spreadsheet. =+G29*((G30-G28)/(G30-G31))^0.54 Maybe looking at the original one will help guide me in the right direction?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Can you share the PDF file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023
 
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

I shared the link. Its doing some math but not giving me the right results. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

With the numbers in the spreadsheat now my bottom box in green should show 2,499. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

That's incorrect.

(1048*((70-20)/(70-60)))^0.54 = 101.962128972 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

The 1048 should not be included in the power of .54 we need power of 54 on all the math and then it be multiplied by the 1048

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Ah, OK, that makes more sense... Then change these two lines:

var v3 = G29*(v2/v1);
event.value = Math.pow(v3, 0.54);

To:

var v3 = (v2/v1);
event.value = G29*Math.pow(v3, 0.54);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

Hmm I don't see what seems to be the issue I'm not getting the numbers I need. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Works fine for me. See attached.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2023 Nov 02, 2023

I see what I did, I got it to work on my end. Appreciate you taking your time to help and explain!!!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 30, 2025 Oct 30, 2025

I just created a fillable PDF form (yesterday) with two very minor formulas using Acrobat Pro, but when you open this PDF in Acrobat Reader (I've also tried another PDF Reader), the math formulas it don't work.  The ADOBE support guy said that the Reader is a free tool so not all the functionality works.  Then what good are formulas in PDF's then?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 30, 2025 Oct 30, 2025

What they told is you blatantly wrong. Every math formula that works in Acrobat should also work in Reader. Only things like extracting pages and stuff like that won't work there.

Did you test it on a mobile device, though, or on a regular PC? Unfortunately, many scripts won't work on the former, regardless of it being Acrobat or Reader.

Third-party viewers are a completely different question. You can't guarantee it will work in them, at all.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 30, 2025 Oct 30, 2025

I created it on a Mac with the latest version of the O/S, Tahoe version 26.0.1.  In Acrobat Pro, the form looks like this after entering a couple of expenses:  

Craig233868948lqt_0-1761847230182.png

Notice that the SubTotal is added up from the individuals expenses and the Total is simply the SubTotal + Sales Tax.  Works great!  Now open this in Acrobat Reader and:

Craig233868948lqt_1-1761847551049.png

Notice that the math does not happen!  Unless someone can tell me what I'm doing wrong!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 30, 2025 Oct 30, 2025

Are you sure that's Reader? Can you post a full-window screenshot?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines