Excel OR – an explanation of this useful function
The OR function can be found in Excel under the logical functions. It can be used to check simple conditions for their logical value - up to 255 conditions in total. Whether you are calculating bonuses or sales commissions, the OR function is an essential part of the data analysis program in the Microsoft 365 package. In this guide, we will show you how to best use this function.
Excel OR function – an explanation of the syntax
The OR function is particularly useful in conjunction with the IF function. While the AND function checks whether all the conditions of an analysis are TRUE, the OR function checks whether one or multiple conditions are TRUE or FALSE. First, let us take a look at the general structure. As with every Excel function, the OR function has its own syntax.
=OR(logical1)
In the following example, the function has only one argument. The function always requires at least one argument. You can add more arguments if needed. In the following example, the function will check whether the value of cell A1 (here 1) is larger than that of B1 (here 2). The syntax is as follows:
=OR(A1>B1)
Since this is not true, the function outputs the return value FALSE.
The operators for OR function arguments are always the characters [>],[<] and [=].
The OR function can analyze up to 255 arguments. So, to get the most out of the function, you should provide it with a set of arguments which it can check simultaneously. In the following example, all you need to do is apply the function used for the cell pair A1, B1 to a series of cells. To do so, click on the cell with the OR function (C1 in this example) and drag the small green fill box from the corner to the end of the column for the logical values (here for A1 to A4 and B1 to B4).
The Excel OR function explained using simple examples
Now that you are familiar with the structure and use of the function, you will find that it is easy to check multiple arguments at the same time. When checking multiple arguments, the OR function looks like this:
=OR(logical1;logical2)
Multiple arguments can be strung together using commas and no spaces. Depending on the region, you may need to use a semicolon instead of a comma.
The condition A1>B1 is now followed by the condition A1=B1. A1 is greater than OR equal to B1.
If you want to include text when evaluating a condition, always place it in double quotation marks in the syntax of the function. The OR function will then be able to check whether “Saturday” “or Sunday” appear in a column containing weekdays.
Combining the Excel OR function with the IF function
Values like TRUE and FALSE can be too abstract when using the OR function. To define what value should appear in the output cell, you can combine this function with the IF function. Using this combination is essential for the OR function to be able to serve its actual purpose and helps define the return values more precisely.
The IF function can be useful in a variety of situations when using Excel.
The syntax of the combination of the IF and OR functions looks like this:
=IF(OR(logical1;logical2);“Yes”;“No”)
This can be clearly illustrated using the example with the days of the week. Naturally, you can define the return values yourself: “Yes” and “No” in this example.
A practical example of the OR function
To illustrate the practical use of the OR function, we will provide you with a concrete example. For the sake of clarity, you will enter the relevant parameters in the Excel spreadsheet. This is easy to illustrate using the days of the week. The evaluation of the logical values determines whether it is a weekday. The return values should indicate whether it is the weekend.
For our example, let us consider a regional daily newspaper. The newspaper would like to provide readers with a reward to celebrate its anniversary. However, there are three criteria to determine who gets a present. Only those who have had an uninterrupted subscription for more than ten years OR who live in the area (Berlin in this example) OR who have bought a special offer anniversary subscription will receive a gift. Only one of these criteria needs to be TRUE to receive a present.
Using the simple OR function, it looks like this:
All subscribers in the example who meet at least one of the criteria will receive a gift. Since the example subscriber Doris has not been a subscriber for ten years, does not live in Berlin, and has not purchased a special offer subscription, she will not receive a gift.
To avoid receiving TRUE or FALSE as the return value, you combine the function described above with the IF function and define the return values yourself. In this example, the return values are either “Present” if one of the criteria has been met or “-” if no criteria has been met.