creating a formula to get a percentage

New Here ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

i am trying to calculate a cell in my form which will allow an automatic fill in from a percentage of a total amount from another cell. How do I accomplish this. pdf script.png

TOPICS
JavaScript

Views

232

Likes

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Mar 23, 2022 Mar 23, 2022

OK, you didn't explain it clearly. You want the result to show under "Total Funding Request 50 of cost up to 5000"... Use this code as that field's custom calculation script:

 

var v = Number(this.getField("CostTotal Cost").valueAsString);
event.value = Math.min(v/2, 5000);

Likes

Translate

Translate
Community Expert ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

What's the name of the other field, and what percentage do you want to show?

Likes

Translate

Translate

Report

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
New Here ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Hello, the name of the other field is" Total Funding Request 50 of cost up
to 5000". I want to show 50% of the cost but nothing over $5000.00.
$5000.00 is the maximum.

Thanks

Therese

Likes

Translate

Translate

Report

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 ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Use this code as the field's custom calculation script:

 

 

var v = Number(this.getField("Total Funding Request 50 of cost up to 5000").valueAsString);
event.value = Math.min(v/2, 5000);

 

Edited: Sorry, should have been min, not max, of course...

 

Likes

Translate

Translate

Report

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
New Here ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Okay I am getting an error, what am i doing wrong? I know nothing about
typing or writing script.

Likes

Translate

Translate

Report

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 ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

The first thing to learn is if you're getting an error, specify what the contents of the error are...

Likes

Translate

Translate

Report

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
New Here ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Okay this does not help me, I sent other messages with the error also a
screenshot of what I am trying to do. I am not looking for a percentage as
a value I am looking for a number. Such as, if they have costs that total
4500.00 I want that to show up in the Total Funding field, but anything
over 5000.00 it would max out at $5000.00

Likes

Translate

Translate

Report

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 ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

That's what my script does. And I don't see you posted any such thing here, but if you're not willing to do it then I can't help you further. Good luck.

Likes

Translate

Translate

Report

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
New Here ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Okay well I used the script but the word NaN keeps showing up. so I must be
entering something wrong that is what I am telling you. It is not that I
want to not use it.

Likes

Translate

Translate

Report

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 ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

That means the value of your text field can't be converted to a Number.

Likes

Translate

Translate

Report

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 ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Maybe share your file with us for further help with these issues.

Likes

Translate

Translate

Report

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
New Here ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Here is the file for you to review as per your previous email

Likes

Translate

Translate

Report

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 ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

It did not come through. You can't attach it via an email reply, if that's what you're trying to do.

Likes

Translate

Translate

Report

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
New Here ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

 

Likes

Translate

Translate

Report

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 ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

OK, you didn't explain it clearly. You want the result to show under "Total Funding Request 50 of cost up to 5000"... Use this code as that field's custom calculation script:

 

var v = Number(this.getField("CostTotal Cost").valueAsString);
event.value = Math.min(v/2, 5000);

Likes

Translate

Translate

Report

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
New Here ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Thank you this worked perfectly.

Likes

Translate

Translate

Report

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 ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

Do you want the "Total Funding Request" to be 1/2 of the "Total Cost" with a maximum of $5000?

David Creamer: Community Expert, Adobe Certified Instructor, and Adobe Certified Expert (since 1995)

Likes

Translate

Translate

Report

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
New Here ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Yes that is exactly what I want.

Likes

Translate

Translate

Report

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
New Here ,
Sep 06, 2022 Sep 06, 2022

Copy link to clipboard

Copied

Hi experts,

I have a simple request to get the % increase  to be stated in %'s from  two columns from the year 2022 to year 2023 columns

thanks

 

 

Likes

Translate

Translate

Report

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 ,
Sep 07, 2022 Sep 07, 2022

Copy link to clipboard

Copied

LATEST

You should start a new discussion specific to your question.

David Creamer: Community Expert, Adobe Certified Instructor, and Adobe Certified Expert (since 1995)

Likes

Translate

Translate

Report

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