+5 votes
185 views
in Sell ​​on the Internet by (242k points)
reopened
Introduction to Excel function OR

1 Answer

+3 votes
by (1.6m points)
edited
 
Best answer

Excel OR function: syntax
Simple Excel Function Examples OR
Excel formula OR: combine with IF function
Practical example of the OR function

image

Introduction to Excel function OR

The OR formula is one of the logical functions in Excel, so it can only return the values ​​of TRUE or FALSE. It is used to evaluate simple expressions and allows you to add up to 255 conditions. This is one of the must-have features of the data analytics program in the Microsoft 365 suite and is very useful in a variety of situations, such as checking whether sales staff should receive incentives or commissions. Learn to harness its full potential with our tutorial..

Index
  1. Excel OR function: syntax
  2. Simple Excel Function Examples OR
  3. Excel formula OR: combine with IF function
  4. Practical example of the OR function

Excel OR function: syntax

The OR function is especially useful in combination with the IF function. Unlike the AND function, which expresses whether all the conditions that are analyzed are true, the OR function checks whether one or more specific conditions have a TRUE or FALSE value . Let's take a look at its structure. Like the rest of Excel functions, O has its own syntax:

 

  =O(valor_lógico1)  

In the following example, the function includes only one argument. It is always mandatory that there is an argument in the function, although you can add as many as you want. In the following example, the formula should check if the value in cell A1 (in this case, 1) is greater than that of B1 (here, 2). The syntax would look like this:

  =O(A1>B1)  
image
A1 would need to be greater than B1 for this OR formula to return TRUE.

Since this is not the case, the function returns the value FALSE.

Note

The signs to express the arguments of the OR function are always the characters > , < and = ..

The OR function can parse up to 255 arguments . To get the most out of it, include a number of arguments that are tested at the same time. In the following example, it is sufficient to automatically extend the function used in A1 and B1 to multiple cells. To do this, you can click on the cell containing the OR function (in the example, C1) and drag the small green square in the corner to the last cell of the column in which the logical values ​​are expressed (in the example, from A1 to A4 and from B1 to B4).

image
Click on the green square to drag the OR function to several cells.
image
The OR function checks the logical values ​​of all cells in the example.

Simple Excel Function Examples OR

Now that you know the structure and use of the function, it won't be difficult to include more arguments in the formula. This is the structure of the OR function if you add more arguments:

  =O(valor_lógico1;valor_lógico2)  

The arguments are combined with a dot and comma and no spaces. Depending on the region, it may be possible to enter a comma instead of a semicolon..

To the condition A1> B1 , now the condition A1 = B1 is added . A1 must be greater than or equal to B1.

image
Excel function OR with multiple arguments

If you want to include text in formula conditions, you must always enclose it in double quotes . Now the OR function should show if? Saturday? or? Sunday? they appear in a column of working days.

image
In the OR function, the text is enclosed in quotation marks.

Excel formula OR: combine with IF function

Values ​​like TRUE and FALSE are too abstract to be used in the workplace. To change the text that appears in the result cell, you can combine the OR function with the IF function . In fact, the OR function only serves its real purpose if it is combined with other formulas, since the most convenient for the user is to personally set the return value.

advice

Excel's IF function is very useful in various situations.

In combination with the IF function, the formula would look like this:

  =SI(O(valor_lógico1;valor_lógico2);"Sí";"No")  

You will see it clearly with our example of the days of the week. Of course, you can define whatever return values ​​you want. In the example, we have changed them to? Yes? and not?.

image
Combination of the SI and O functions in Excel.

Practical example of the OR function

Here is an example with the days of the week to give you an idea of ​​the possibilities offered by the OR function. Enter the corresponding parameters in an Excel table. The logical values ​​to check with the formula are the days of the week. In the return cell, it is indicated if the day belongs to the weekend.

image
O function with custom categories.

Suppose we work for a regional newspaper that wants to give subscribers a gift to celebrate its anniversary. To receive the gift, readers have to meet one of three conditions : only those who have subscribed without interruption for more than ten years OR who live in the region (in our example, Granada) OR who have subscribed during the anniversary campaign opt for the gift. In other words, it is enough that one of the conditions has the value TRUE to receive it.

With these conditions, the structure of this simple OR function would be the following:

image
The Excel OR function in a specific example.

In the example, all subscribers who meet at least one of the conditions will receive the gift. As Doris has not subscribed for ten years, nor does she live in Granada, nor has she subscribed during the anniversary campaign, she will not receive any gifts.

To change the text from TRUE or FALSE and define another return value, you can combine the OR function with the IF function as we explained above and set it yourself. In our example, the return values ​​are? Gift? if at least one criterion is applied or? -? if none apply.

image
The IF formula is combined with the OR function

...