0
votes

I'm trying to achieve nested conditions in Google Sheets. 3 columns test to see if a condition exists (find the word "nulled" across other columns). They're called into action by their number (1,2,3). If the column is already handling a conditional level, then it does not perform the test but copies the cell above to continue the decision (using INDIRECT). They're summarised in the final column, again, looking across the row to see if annulled or not.

enter image description here

I have a working formula but it won't sit within ARRAYFORMULA because it uses INDIRECT to reference the cell content above. I desperately want to put it into ARRAYFORMULA as the current formula has to be copied to every cell.

=
if ($E: $E < $1: $1, "<",
  if ($E: $E > $1: $1, indirect("R[-1]C[0]", false),
    if (and($E: $E = $1: $1, isblank($A: $D)), indirect("R[-1]C[0]", false),
      if (and($E: $E = $1: $1, not(isblank($A: $D))),
        if (or($A: $A = "nulled", $B: $B = "nulled", $C: $C = "nulled", $D: $D = "nulled"), "nulled", "active"),
        "-"))))

INDIRECT doesn't sit within ARRAYFORMULA so is there an alternative way to achieve it? (or any other feedback on how to do nested conditionals a better way...)

2
here's a link to the sheet. I've simplified it so only looking for the condition in one column: docs.google.com/spreadsheets/d/… - David Moore

2 Answers

0
votes

try:

=ARRAYFORMULA(IF((E2:E=""),,IF(E2:E<F1:H1, "<",
 IF((E2:E>F1:H1)+((E2:E=F1:H1)*(ISBLANK(A2:D))), VLOOKUP(ROW(A2:A),  
 IF(A2:A<>"", {row(A2:A), IFERROR(IF((E2:E=F1:H1)*(NOT(ISBLANK(A2:D))),
 IF((A2:A="nulled")+(B2:B="nulled")+
    (C2:C="nulled")+(D2:D="nulled"), "nulled", "active"), ))}), 2, 1),
 IF((E2:E=F1:H1)*(NOT(ISBLANK(A2:D))),
 IF((A2:A="nulled")+(B2:B="nulled")+
    (C2:C="nulled")+(D2:D="nulled"), "nulled", "active"), "-")))))

0


UPDATE:

=ARRAYFORMULA(IF((E2:E=""),,IF(E2:E<F1:H1, "<",
 IF((E2:E>F1:H1)+((E2:E=F1:H1)*(ISBLANK(A2:D))), VLOOKUP(ROW(A2:A),  
 IF(INDEX(IFERROR(IF((E2:E=F1:H1)*(NOT(ISBLANK(A2:D))),
 IF((A2:A="nulled")+(B2:B="nulled")+
    (C2:C="nulled")+(D2:D="nulled"), "nulled", "active"), )),,1)<>"", 
 {ROW(A2:A), IFERROR(IF((E2:E=F1:H1)*(NOT(ISBLANK(A2:D))),
 IF((A2:A="nulled")+(B2:B="nulled")+
    (C2:C="nulled")+(D2:D="nulled"), "nulled", "active"), ))}), 2, 1),
 IF((E2:E=F1:H1)*(NOT(ISBLANK(A2:D))),
 IF((A2:A="nulled")+(B2:B="nulled")+
    (C2:C="nulled")+(D2:D="nulled"), "nulled", "active"), "-")))))

enter image description here

spreadsheet demo

0
votes

I think the dragdown formula you built is "itereative". That is, it uses the previous answer as a part of it's output for every given cell.

This is largely not possible with Arrayformula with a few exceptions involving cumulative summing/subtracting that can be done with a sort of trick.

It's possible there's another way to do what you're trying to do, but i'm not sure i understand the example well enough to think outside the box of what's been presented. Could you share a little more detail about what is really going on in the sheet?