• Global community
• Language:
• Deutsch
• English
• EspaÃ±ol
• FranÃ§ais
• PortuguÃªs
• æ—¥æœ¬èªžã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£
Dedicated community for Japanese speakers
• í•œêµ­ ì»¤ë®¤ë‹ˆí‹°
Dedicated community for Korean speakers
Exit
• Re: Excel to Custom Calculation Script

Excel to Custom Calculation Script

New Here ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

How would this Excel formula translate to a custom calculation script in a PDF form?

=IF(A4<=10, 16.68,16.68+((A4-10)*1.67))

Thanks!

TOPICS
Acrobat SDK and JavaScript

Views

573

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 Expert , May 03, 2019 May 03, 2019

You can use this code as the custom calculation script of your field, then:

`var v = Number(this.getField("Same_Day_Miles").valueAsString);if (v<=10) event.value = 16.68;else event.value =16.68+((v-10)*1.67);`

4 Replies 4
Community Expert ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

What's the name of the "A4" field in the PDF?

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

"Same_Day_Miles"

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 Expert ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

You can use this code as the custom calculation script of your field, then:

`var v = Number(this.getField("Same_Day_Miles").valueAsString);if (v<=10) event.value = 16.68;else event.value =16.68+((v-10)*1.67);`

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

LATEST

You are a life saver my friend!