OR
Excel OR Function
Excel’s built-in OR function returns TRUE or FALSE depending on two or more conditions.
=OR is typed there.
Note: The IF function and the OR function are frequently used in tandem.
=OR([logical1], [logical2], ...)
The conditions are referred to as [logical1], [logical2], and so on.
The conditions can check things like:
- If a number is greater than another number >
- If a number is smaller than another number <
- If a number or text is equal to something =
Note: A symbol, such as a , or ; is used to separate the various components of the function;
The symbol is determined by your language preferences.
Example OR Function
Verify whether the Pokemon has a defense of greater than 60 OR is a water type:
“True” or “False” is returned by the function.
Example OR function, step by step:
- Select the cell D2
- Type =OR
- Double click the OR command
4. Specify the first condition B2=”Water”
5. Type ,
6. Specify the second condition C2>60
7. Hit enter
Note: Before pressing enter, repeat steps 5–6 to add more conditions.
The first condition is FALSE since “Water” is not the value in cell B2.
The second condition is likewise FALSE since the value in cell C2 is less than 60.
For the OR function to return TRUE, at least one condition must be TRUE.
It is necessary to enclose text values in quotes: ” “
To carry out the same check for every Pokemon, the function can be repeated using the filling function for every row:
Currently, a check for Water Type or Defense greater than 60 is present in each row:
As an example:
- The code returns “TRUE” because the ivysaur has more than 60 defensive points despite not being a Water type.
- Since Charmeleon has less than 60 defense and is not of the Water type, the method returns “FALSE”.
- The function returns “TRUE” since Wartortle has more than 60 defense and is a Water type.
Example OR Function (with IF)
You can verify several conditions for the IF function by combining the OR and IF functions:
Note: You can define the return values using the IF function.
Typed =IF, the IF function consists of three parts:
=IF(logical_test, [value_if_true], [value_if_false])
The logical_test condition is replaced by the OR function.
The IF function gives back “Yes” or “No” in this case.
Step-by-step example of using the OR function as the condition for the IF function:
- Select cell D2
- Type =IF
- Double click the IF command
4. Type OR
5. Double click the OR command
7. Specify the first condition B2=”Water”
8. Type ,
9. Specify the second condition C2>60
10. Type ),
11. Specify the value “Yes” for when either or both conditions are TRUE
12. Type ,
13. Specify the value “No” for when both conditions are FALSE
14. Type ) and hit enter
To carry out the same check for every Pokemon, the function can be repeated using the filling function for every row:
Now, each row has a check for Water Type or Defense greater than 60:
As an example:
- The code returns “Yes” because the ivysaur has more than 60 defensive points despite not being a Water type.
- The function returns “No” since Charmeleon has less than 60 defense and is not of the Water type.
- The function returns “Yes” since Wartortle has more than 60 defense and is a Water type.