Home > Software engineering >  How do I run an Excel formula in one cell (have it produce a value) ONLY if another cell's form
How do I run an Excel formula in one cell (have it produce a value) ONLY if another cell's form

Time:11-04

I want to run this Excel formula:

=IFERROR(INDEX(Y163:AA163,MATCH(TRUE,Y163:AA163<>"",0)),"")

But ONLY if the formula in cell B163 produces a result/value.

I've tried different formulas but cell X163 still produces a value even though B163's formula has not produced a value.

Example formulas I've tried:

=IFERROR(IF(LEN(B163)<>"",(INDEX(Y163:AA163,MATCH(TRUE,Y163:AA163<>"",0)),""),"")
=IFERROR(IF(B163<>0,(INDEX(Y163:AA163,MATCH(TRUE,Y163:AA163<>"",0)),""),"")

In other words, I want a formula in X163 that states that if B163's formula results in a value or is not equal to 0, then run the formula beginning with "INDEX." On top of this, put this all in an IFERROR statement, because that's what I do with all my formulas. So there are a lot of nested formulas/statements.

How can I get this new condition to override other conditions?

CodePudding user response:

Drop the IFERROR in your second formula.

Based on your description use: IF(OR(B163<>0,B163<>""),INDEX(Y163:AA163,MATCH(TRUE,Y163:AA163<>"",0)),"")

CodePudding user response:

These formulas worked:

=IFERROR(IF(B163>0,INDEX(Y163:AA163,MATCH(TRUE,Y163:AA163<>"",0)),""),"")

...or

=IFERROR(IF([@Total]>0,INDEX(Y163:AA163,MATCH(TRUE,Y163:AA163<>"",0)),""),"")
  • Related