Ignoring zeros when averaging
I have browsed the forums and have tried some samples, but I can't make any headway. I have a numeric field on an form in Acrobat X that I want to be an average of several groups of check boxes. For the simplicity sake of my test, I have three groups of 5 check boxes. For each group of 5 boxes, they have an export value of "1", "2", "3", "4" and "5" respectively. The first 5 have the name "Prop1", the second group is named "Prop2" and the third is "Prop3". If I take my numeric field where I want the average and go to the calculations tab and select "Average" and then chose "Prop1", "Prop2" and "Prop3", it works as long as none of the groups have a blank check box. I want it to ignore any group with a blank check box (where the value of the group would be "0" or null) and only average the groups that have values. For instance, if the group "Prop1" has the "3" check box selected, and the group "Prop2" has the "3" check box selected and the group "Prop3" has the "3" check box selected, then the average is "3" as it should be. But, if I un-check one of them, the average changes to "2". The reason I say the value of an un-checked group is "0" is because if I create a new numeric field and set it to be the sum of the group, when I have a box selected, the calculated field shows that value, but if I have no box selected, the value is zero. So, I may need to be checking for null and "0" as I can't tell what the true value is for a group of check boxes when none of them are checked. I can not use the group names as my field in the formula and instead use my calculated field that sums the group as I know this shows zero when no box is checked. I have them off to the side and can leave them and use them for calculations if that is better and I will just hide them.
So, more simply put, how do I average 3 fields (or 3 check box groups), but ignore any field that is blank or has a value of zero so that it is ignored in the averaging assuming those field names are "Prop1", "Prop2" and "Prop3". Also, I am assuming this javascript should go in the calculations tab for the field and use the custom script section at the button to place the javascript.
