Login

+3 votes

Best answer

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

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) `

** 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) `

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

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).

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.

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.

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.

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?.

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.

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:

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.