Home > front end >  Is it possible to nest IF(AND into IFS formula having as a false value a logical conditions?
Is it possible to nest IF(AND into IFS formula having as a false value a logical conditions?

Time:11-14

I was trying to setup a formula by nesting IF AND into IFS formula (spoiler not spoiler: I failed).

Following the IFS use, the formula must evaluate the conditions one after another and print the response of the first condition found to be true.

Based on the attached picture, the formula must:

  1. print P if A <= B;

if this condition is not met, evaluate the condition 2;

  1. print Q if C > D and E <= F;

if this condition is not met, evaluate the condition 3.

  1. print R if G > H and I > L.

print fail if nothing is met. conditions

I tried to nest IF(AND into IFS, but IF(AND will only print true and false values but not solve logic expressions.

eg. IFS(A<=B, P, IF(AND(C>D,E<=F), Q, (G>H,I>L), R)

Q is the true value of the second conditions.

To my will, I wanted to use the 3rd condition as false, but excel won't go on and solve the expression.

any help? thank you

CodePudding user response:

You can use the regular IF statement with nested IF() functions. Your IFS() sample is almost there, it just needs a few more brackets and replace IFS() with IF().

=IF(A<=B, P, IF(AND(C>D,E<=F), Q, if(and(G>H,I>L), R, "no conditions match")))

Note how three IF() statements are nested. The second IF() has a TRUE action, then another IF() for the FALSE action. Make sure to close all brackets in the correct positions. Write it out with line breaks if that helps.

=IF(A<=B, 
   P, 
   IF(AND(C>D,E<=F), 
      Q, 
      if(and(G>H,I>L), 
         R, 
         "no conditions match"
      )
   )
)
  • Related