Copy link to clipboard
Copied
Hello,
I am looking for a javascript to count the number of time a specific text "Face to Face" appears in a series of text boxes (26 different text boxes). How many times does that word appear in these boxes. The name of the text box is Mode of MeetingRow1 Mode of Meeting Row2 etc? This is similar to excel for =COUNTIF(C9:C19,"Face to Face")
Thank you!
Copy link to clipboard
Copied
Use this in a field where you want to show count number as 'custom calculation script':
var count = 0;
for(var i=1; i<=26; i++){
if(this.getField("Mode of Meeting Row"+i).valueAsString == "Face to Face")count++;}
event.value = count == 0 ? "" : count;
Copy link to clipboard
Copied
Use this in a field where you want to show count number as 'custom calculation script':
var count = 0;
for(var i=1; i<=26; i++){
if(this.getField("Mode of Meeting Row"+i).valueAsString == "Face to Face")count++;}
event.value = count == 0 ? "" : count;
Copy link to clipboard
Copied
Thank you so much that worked!!
Copy link to clipboard
Copied
Hello, I asked for help with a formula a while ago and I realized that I need a similar formula on the next page this is the original formula:
var count = 0;
for(var i=1; i<=26; i++){
if(this.getField("Mode of MeetingRow"+i).valueAsString == "Face to Face")count++;}
event.value = count == 0 ? "" : count;
But the rows for the new page now are Mode of Meeting1_2 to 26_2. I tried this formula
var count = 0;
for(var i=1_2; i<=26_2; i++){
if(this.getField("Mode of MeetingRow"+i).valueAsString == "Face to Face")count++;}
event.value = count == 0 ? "" : count;
but it didn't work. Any thoughts on how to edit this?
Thank you.
Copy link to clipboard
Copied
Use field name like this:
"Mode of MeetingRow"+i+"_2"
Copy link to clipboard
Copied
Thank you that worked!

