In this article, we will learn about basic Logical Functions of MS Excel, namely IF, OR and AND. We will also learn how to use them in combinations such as IF with AND & IF with OR
Logical functions are the functions that check for a given condition. If the value satisfies the condition, the logic will display results according to the condition.
IF Function
The first function is IF function. If the value/ formula satisfies a particular condition it will give results as per condition satisfaction.
Syntax of IF function
IF(logical_test, [value_if_true], [value_if_false]) wherein
• logical_test: The condition that need to be evaluated
• value_if_true: The value that you want to print if the condition is satisfied
• value_if_false: The value that you want to be returned if the condition is not satisfied
For Example –
AND Function
The second function is AND. AND function returns “TRUE” or “FALSE”. If all the conditions in the formula is satisfied, it will return “TRUE” else it will return “FALSE”.
Syntax of AND function
AND(logical1, [logical2], …) wherein
• logical1: The first condition that you want to check that can be either TRUE or FALSE
• logical2, logical3 …: Additional conditions that you want to check that can be either TRUE or FALSE. You can check maximum of 255 conditions
For Example –
OR Function
The Third function is OR. OR function returns “TRUE” or “FALSE”. If one of the conditions in the formula is satisfied, it will return “TRUE” else it will return “FALSE”.
Syntax of OR function
OR(logical1, [logical2], …) wherein
• logical1: The first condition that you want to check that can be either TRUE or FALSE
• logical2, logical3 …: Additional conditions that you want to check that can be either TRUE or FALSE. You can check maximum of 255 conditions
For Example –
Usage of IF with AND
IF AND combination is used when there are multiple conditions which we want to test and if all the conditions are true it gives us the result as per condition satisfaction
Syntax of IF-AND Combination
IF(AND(logical1, [logical2], …), [value_if_true], [value_if_false])
For Example –
Usage of IF with OR
IF OR combination is used when there are multiple conditions which we want to test and if one of the conditions are true it gives us the result as per condition satisfaction
Syntax of IF-OR Combination
IF(OR(logical1, [logical2], …), [value_if_true], [value_if_false])
For Example –