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.

Python Code (For reference)

Similar Reads

IF Function in Excel

The IF Function is an inbuilt function in Excel, which return values based on true or false condition....

Syntax of IF Function

The IF function serves a single purpose, i.e., to run tests for specific conditional statements....

Return Value

IF function will return the values, “TRUE” or “FALSE” or the values specified by the user to be used in place of TRUE and FALSE....

Parameters

The term argument refers to any expression that is enclosed inside the parenthesis of a function call....

How to Use the IF Function in Excel

Check for the empty cell value...

Nested If Function

We use the Nested IF function if we have multiple criteria to find and decide the final output....

IF Function with AND, OR, NOT

IF function, logical operators, help you to deal with complex conditions....

Excel IF Function Multiple Conditions

IF Formula with multiple criteria based on the AND / OR logic. Consequently, in the logic test of your IF formula, you can use one of these functions:...

FAQs

What is the IFS function? Instead of using multiple Nested if functions, IFS can be used. You can test multiple conditions, to see if they are TRUE. The Formula returns the result for the First True condition. The syntax for the IFS function is: = IFS([Something is true 1, Value if true 1, Something is true 2, Value if true 2, Something is true 3, Value if true 3)....