Conditional formula based on 2 pre-conditions

  • Thread starter Thread starter PSmith
  • Start date Start date
P

PSmith

Can anyone tell me what is wrong with the following formula? I only want the
division part of the formula to be executed if the previous two conditions
are both satisfied, if either one isn't satisfied, then I'd like it to return
the "--" value but I can't seem to get the parentheses right. Many thanks.

=IF(D57<>"NA"& IF(D22>0,D22/D57,"--"))
 
PSmith said:
Can anyone tell me what is wrong with the following formula? I only want the
division part of the formula to be executed if the previous two conditions
are both satisfied, if either one isn't satisfied, then I'd like it to return
the "--" value but I can't seem to get the parentheses right. Many thanks.

=IF(D57<>"NA"& IF(D22>0,D22/D57,"--"))


In the help file, search for "Logical Functions" and then select "AND worksheet
function".
 
=IF(AND(D57<>"NA", D22>0),D22/D57,"--")

but if you have #N/A in D57 from a formula then
=IF(AND(NOT(ISNA(D57), D22>0),D22/D57,"--")

best wishes
 
Back
Top