I have a row of tick boxes and I need to count the most recent successive TRUE
values. So it should start counting when the first TRUE
appears and stop when it changes to FALSE
, ignoring anything that comes after that.
Right now I have a script doing that, but since I have a lot of entries, it takes a long time to run and stops after 6min without finishing everything.
for(var j=3;j<lastRow;j++){
count = 0;
for (var k=stupac-1;k>2;k--){
if (range.getCell(j,k).getValue() == true){
count++;
}
else if ((range.getCell(j,k).isChecked() == false)&&(count>0)){
break;
}
}
range.getCell(j,stupac).setValue(count);
}
I thought the best way would be to stop the COUNTIF when the value changes, but have had no luck trying to get that working.