0
votes

Both D2 and F2 contain formulas that rely on inputted values in other cells. In a third cell (G2), I have a formula that utilizes both D2 and F2. I get accurate results just fine. However, using the formula below, when either D2 or F2 has no value the third cell says "#VALUE!" when I would prefer it to stay blank.

How do I fix that? Neither D2 or F2 are blank because they contain formulas, so I cannot use the ISBLANK condition. And my formula is not fixing it:

=IF(OR(D2=0,F2=0),"",IF(F2>D2,F2*2,F2))

Can anyone help me out?

2

2 Answers

0
votes

They don't really return no value - if they contain formulas then they return something. Whatever that something is apparently not interpreted as equal to zero, as blanks are.

You could use:

=IF(AND(ISNUMBER(D2),ISNUMBER(F2)),IF(F2>D2,F2*2,F2),"")

Or simply:

=IFERROR(IF(F2>D2,F2*2,F2),"")

Note that this last will return the value of F2 if F2 is a number but whatever is in D2 is text, since Excel can compare text and numbers, and considers text to be greater. But, you say that you get an error when either has "no value", in which case this will work as expected.

0
votes

Try:

=IF(D2=0,"",IF(E2=0,"",IF(F2>D2,F2*2,F2)))