I have an array which length will change as the user enters new numbers, and I need the cell's value to be 0 when the condition is TRUE. For example the user enters: "201" and "500" into the array so the formula would be =IF(OR(N2=500, N2=201),0,F2), then =IF(OR(N3=500, N3=201),0,F3) till the final row. I came up with this code but the second OR condition it's the same because the i it's still the same
int arr[] = {500,201};
int i;
for (i = 0; i < arr.length; i++){
int cRow2 = 1;
int b = 2;
Row newRow2 = firstSheet.getRow(cRow2);
while (newRow2 != null) {
Cell cell3 = newRow2.createCell(12);
cell3.setCellFormula("IF(OR(N"+b+"="+arr[i]+", N"+b+"="+arr[i]+"),0,F"+b+")");
b++;
cRow2++;
newRow2 = firstSheet.getRow(cRow2);
}
}
Is there a way of doing it with the two spaces arr[0] and arr[1] but automatically as many times as the user enters numbers?