• Global community
• Language:
• Deutsch
• English
• EspaĆ±ol
• FranĆ§ais
• PortuguĆŖs
• ę„ę¬čŖć³ćć„ććć£
Dedicated community for Japanese speakers
• ķźµ­ ģ»¤ė®¤ėķ°
Dedicated community for Korean speakers
Exit Search
• Javascript&colon; SUM IF for Adobe PDF Forms

# Javascript&colon; SUM IF for Adobe PDF Forms

Community Beginner ,
Nov 18, 2022 Nov 18, 2022

Copied

Javascript&colon; SUM IF for Adobe PDF Forms

I am wondering if there is something like a SUM IF Function for adobe. Basically, I want the calculation to if Row1 Column 1 = I then add Row 1 Column 5 (and I would have this repeat to check all rows but that part is simple. I am just stuck on making a statement that will add another amount if that row's column has a particular field "I"

(Edited by Adobe Employee/Moderator: Title & Topics)

TOPICS
How to , JavaScript , PDF forms

Views

1.1K

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 , Nov 19, 2022 Nov 19, 2022

You can use something like this:

``````var total = 0;
if (this.getField("Text1").valueAsString=="I") total+=Number(this.getField("Text2").valueAsString);
if (this.getField("Text3").valueAsString=="I") total+=Number(this.getField("Text4").valueAsString); // etc.
event.value = total;``````

4 Replies 4
Community Expert ,
Nov 19, 2022 Nov 19, 2022

Copied

You can use something like this:

``````var total = 0;
if (this.getField("Text1").valueAsString=="I") total+=Number(this.getField("Text2").valueAsString);
if (this.getField("Text3").valueAsString=="I") total+=Number(this.getField("Text4").valueAsString); // etc.
event.value = total;``````

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 Beginner ,
Nov 21, 2022 Nov 21, 2022

Copied

This was a great idea but for some reason it isn't working. I even tried editing it slightly but the value always remains at 0.

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 Beginner ,
Nov 21, 2022 Nov 21, 2022

Copied

TOTAL_ROW_1 is 1.00 so it should be seeingthat the first this.getfield matches the string and add the 1.00 from TOTAL_ROW_1 to the default 0 variable and appear as 1.00 but for some reason it isnt.

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 Beginner ,
Nov 21, 2022 Nov 21, 2022

Copied

LATEST

You are a life saver it did work I just did not have the bottom line added.