I'm trying to create a simple counting ArrayFormula that iterates by one, if adjacent cell is empty (doesn't contain "IGNORE"). E.g. COUNT
column here should only count when STATUS
<> IGNORE
:
ROW STATUS COUNT
______________________
1 IGNORE
2 IGNORE
3 1
4 2
5 3
6 IGNORE
7 IGNORE
8 4
9 5
What ArrayFormula can I use here in cell C1 COUNT
?
You can create a custom function and integrate it with ARRAYFORMULA
.
Code:
function countNonIgnore(values) {
var tempArr = [];
var ctr = 1;
values.forEach(val => {
if(val[0] == "IGNORE"){
tempArr.push([""]);
}else{
tempArr.push([ctr]);
ctr++;
}
})
return tempArr;
}
Output:
Reference: