Javascript maths calculation (SUM, COUNTIF)
Hi, I'm hoping someone can help me urgently on this one...
I have the following formula in excel, but not sure how to change it so it works as Java in the custom calculation field in Acrobat (I've used some online tools but none seem to work).
- =SUM(B2:Q2)/(13*(COUNTIF(B2:Q2,"<>")))*100
JS wise, this where I've got to....not very far:
- event.value = ( this.getField("FINALscoreS1").value + this.getField("FINALscoreS2").value + this.getField("FINALscoreS3").value );
There'll be a number of 'FINALscoreS#' fields (yet to be decided). and what I'm after is:
The sum of all results in the 'FINALscoreS#' fields, divided by the sum of 13*however many 'FINALscoreS#' have a value (even if that value is zero...so ignoring any blanks).
(And then multiplied by 100 to give a percentage - the excel formula works perfectly if that's any use)
Does that makes sense? Can anyone help?? Pretty sure there'll be an array involved somewhere...
Huge thanks in advance...I expect for a JS guru this is as simple as 2+2, apologies!!
🙂
