3 Replies Latest reply on Jan 19, 2018 11:29 AM by Thom Parker

# I am trying to create a SUMIF formula in adobe acrobat and have no idea where to begin. The code I am working with =SUMIF(\$F\$7:\$F\$28,\$H30,I\$7:I\$28). Any help of where to begin and how to finish building the script would be great.

I am trying to create a SUMIF formula in adobe acrobat and have no idea where to begin. The code I am working with =SUMIF(\$F\$7:\$F\$28,\$H30,I\$7:I\$28). Any help of where to begin and how to finish building the script would be great.

Thank you,

Ali

• ###### 1. Re: I am trying to create a SUMIF formula in adobe acrobat and have no idea where to begin. The code I am working with =SUMIF(\$F\$7:\$F\$28,\$H30,I\$7:I\$28). Any help of where to begin and how to finish building the script would be great.

Here are some articles that cover performing calculations in Acrobat:

• ###### 2. Re: I am trying to create a SUMIF formula in adobe acrobat and have no idea where to begin. The code I am working with =SUMIF(\$F\$7:\$F\$28,\$H30,I\$7:I\$28). Any help of where to begin and how to finish building the script would be great.

This is what I have so far:

var total = 0;

var maxFields = 22;

for (var i=1; i<=maxFields; i++) {

if (this.getField("M"+i).value==("Code1")

total+=Number(this.getField("TL"+i).field);

}

event.value = total;

"Code1" is a field within the PDF, something isn't linking. How would I get it so it SUMS all TL if M matches field "Code1"?

• ###### 3. Re: I am trying to create a SUMIF formula in adobe acrobat and have no idea where to begin. The code I am working with =SUMIF(\$F\$7:\$F\$28,\$H30,I\$7:I\$28). Any help of where to begin and how to finish building the script would be great.

Good try   You've got a syntax error and an incorrect property

Here's the corrected code:

```var total = 0;
var maxFields = 22;
for (var i=1; i<=maxFields; i++) {
if (this.getField("M"+i).value=="Code1")
total+=Number(this.getField("TL"+i).value);
}
event.value = total;
```

To see the reported errors and debug your code you need to use the Console Window. Here's a tutorial: