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

Convert excel formula to JavaScript

New Here ,
Nov 06, 2019 Nov 06, 2019

Hello

 

I have the following issue. I need a way to calculate in a PDF.

 

excel formula:

=IF(OR(AND(C5=0;E5=0);AND(C5=0;G5=0);AND(E5=0;G5=0));0;ROUNDDOWN(AVERAGE(IF(C5>20000;20000+(C5-20000)/2;C5);IF(E5>20000;20000+(E5-20000)/2;E5);IF(G5>20000;20000+(G5-20000)/2;G5));0))

 

I have 3 values and need the average of them. But when 2 out of 3 values are 0, the result should also be 0. when a value is bigger than 20'000 then it should calculate with 20'000 + 50% of the remaining value (30'000 = 20'000 + 10'000/2).

 

for now im doing this calculation in excel. but i need it to be done in a pdf. would be great if anyone could show me a tool or something, after i've spent my whole day on google 🙂

 

thanks a lot!

jungerherr

TOPICS
Create PDFs , How to
1.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
Community Expert ,
Nov 06, 2019 Nov 06, 2019

Here are some resources for performing calculations in PDF forms.

https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm (Scroll down the list of example files)

https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

https://acrobatusers.com/tutorials/conditional-execution

https://www.pdfscripting.com/public/Calculating-field-values-and-more.cfm

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
LEGEND ,
Nov 06, 2019 Nov 06, 2019
LATEST

You basically have to learn Acrobat JavaScript just as you learned Excel calculation language, and make it again to do the same job. No conversion is offered. It will be much longer, but easier to read. Many functions, like AVERAGE, are not built in but must be calculated.

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