IF Function with AND, OR, NOT
IF function, logical operators, help you to deal with complex conditions.
IF with AND
AND allows you to check multiple conditions with the if function.
Syntax: IF(AND(condition 1, condition 2), Value if true, Value if false)
For example, there are two conditions A1>90, and B1>90, If both conditions are true then it will return “A1 Grade” otherwise “fail”.
Formula used is : =IF(AND(A1>90,A1<100),”A1 Garde”, “Fail”)
IF with OR
OR allows you to check at least one condition is True within the IF function.
Syntax: IF(OR(condition 1, condition 2 ), Value if true, Value if false)
For example: If you have two conditions that A1>90, B1>90 If at least one of them is true then it will return “Blue” otherwise “Red“.
Formula used is: IF(OR(A1>90,B1>90),”Blue”, “Red”)
IF with NOT
NOT allows you to check a function that negates a condition. It means it will Return “True” if the condition is False and “False” if the condition is True.
Syntax: IF(NOT(Condition 1), Value if true, Value if false)
For example: If you want to check a condition for the color of a ball. If the color of the ball is not red then it will be selected otherwise it will be rejected.
Formula used is: IF(NOT Red), “Selected”, “Rejected”.
Excel IF function With Examples
The IF function is one of Excel’s most used, if not the most used functions. It helps perform a single or a series of logical comparisons between entities. It works using the same principles as IF-ELSE conditional statements, used in most programming languages. Values satisfying the given condition, result in a positive output, while values not satisfying the given condition, result in a negative output. Condition and Return values both can be decided by the user.