How do you combine IF, AND and NOT statements in Microsoft excel
You have 4 possible outcomes, so you need 3 IF statements nested.
=IF(
AND(A2=C2;B2=D2);
"All Correct";
IF(A2=C2;"Car Correct";
IF(B2=D2;"Driver Correct";
"All wrong"
)
)
)
So why is this working? We first check if both are correct. Only if both are not correct we do further checks. We check if the first is correct, but if the second were correct too, we would not end up here, so we know the second is incorrect. But if the first one is incorrect already, we get to the NOT part of the IF. We then check if only the second one is correct. If that one is not correct either, then the last option of neither correct remains, we do not need to use an IF clause for that.
Here's the formula without formatting:
=IF(AND(A2=C2;B2=D2);"All Correct";IF(A2=C2;"Car Correct";IF(B2=D2;"Driver Correct";"All wrong")))