How to use the IF OR function in Excel

Many Microsoft users who work with the Excel spreadsheet program may already be familiar with the popular IF function. The function allows users to create requests in which one or more conditions are defined at the same time to obtain a specific result. When you combine the IF and OR function, it will return the result even if only one of the conditions is true. In this article, we will demonstrate what this looks like in practice using simple examples.

What is the IF OR function?

The Excel IF OR function is an extension of the IF function, also known as the IF-THEN function. Due to its many uses, it is one of the most important functions in Excel. The function can be used to evaluate a specific value to see if it matches an expected value. If the values are identical, you will receive a predefined output. If this is not the case, a different output will be triggered. First, you must define the conditions that determine whether the return value is true or false.

If you then combine the IF function with the OR function, you can define several conditions. At least one of these conditions must be met for the resulting return value in Excel to be true. If either condition A or B is true, return value C will be output. If neither are met, the function will output return value D. The formula looks like this:

 

=IF(OR(something is TRUE;something else is TRUE);value_if_true;value_if_false) 

In the formula above, the element “something is TRUE” is condition A and “something else is TRUE” is condition B. Accordingly, “value_if_true” corresponds to return value C and “value_if_false” to return value D.

Note

An alternative to the IF OR function is the IF AND function. When using this function, both conditions A and B must be true for return value C to be outputted. In contrast, the similar IF NOT function only accepts one condition at a time.

Excel IF OR: a practical example of this combination of functions

In the following example spreadsheet, column A lists the potential participants for a learning program. To be accepted by the learning institution, the individuals must either have attended a basic course or passed the entrance exam with at least600 points.

Since the conditions are defined, you can create the formula in the next step. First, select cell D2. In this cell, the question of admission will be answered with “YES” or “NO”. The return value “YES” is output if the participant has attended the basic course (represented by the value “yes” in column B) or if they have more than 600 points in column C. The resulting return value is “NO” if neither of the two conditions has been met. Now, enter the following formula in the formula bar:

=IF(OR(B2=“yes”;C2>599);“YES”;“NO”)

Once you have confirmed the formula by pressing the Enter key, Excel will display the corresponding return value in D2.

You do not need to enter the function each time to fill in rows 3 through 6 in column D with their corresponding return values. Simply select cell D2 and drag the green rectangle to the last row. Since the formula uses a relative reference, B2 and C2 will automatically become B3 and C3 and so on.

Combining the IF OR function with other functions

One advantage of the Excel IF OR function is that it can be combined with other useful functions. This allows you to perform more complex requests. Below you will see the spreadsheet used in the previous example. This time, both the first and last names of the potential participants are listed in columns A and B respectively.

You now want column E to display more than just the “YES” or “NO” response. You want it to output a full sentence: “[First name] [Last name] is accepted” or “[First name] [Last name] is not accepted”. You can do this by integrating the CONCATENATE function into the IF OR function. First, select the cell range E2 to E6. Then, enter the following formula into the formula bar:

=CONCATENATE(A2;“ ”;B2;“ ”;IF(OR(C2=“yes”;D2>599);“is accepted”;“is not accepted”))

The first part of the formula concatenates the content of cells A and B. To prevent the individual text elements from being placed directly next to each other in the resulting return value, enter a blank space enclosed by two double quotation marks after both A2 and B2. This is then followed by the IF OR function which completes the statement with the corresponding result.

The IF OR function in Excel can be combined with a variety of other functions depending on your needs. However, you should always ensure that you used the correct number of parentheses for the nested formulas. If a parenthesis is not closed, you will receive an error message. To avoid such errors, just use the formula builder under the menu option “Insert Function” which automatically produces the correct syntax.


Own your online success
IONOS takes care of your online challenges
Create your website with the perfect domain and the UK's fastest hosting!