How To Use the OR Function in Excel (With Steps and Examples)

By Indeed Editorial Team

Published April 8, 2022

The Indeed Editorial Team comprises a diverse and talented team of writers, researchers and subject matter experts equipped with Indeed's data and insights to deliver useful tips to help guide your career journey.

Excel is capable of performing several logical tests. One of the most common is the OR function, where it yields a "TRUE" or "FALSE" result depending on whether any of the arguments are true. Using the OR function can help you organize your data and quickly test for various conditions. In this article, we explain how to use the OR function in Excel and provide examples.

Related: How To Use the Excel MROUND Function (With Definition and Examples)

What is the OR function in Excel?

The OR function in Excel is a logical formula that tests multiple conditions to determine if any of them are true. If at least one of the conditions is true, the function yields "TRUE." The result is "FALSE" if all the conditions are false. You can input the OR function in Excel by typing "=OR" into any cell and using commas to separate the logical tests you want the function to perform.

Related: 50 Questions To Help You Ace an Interview Test on Excel

How to use the OR function in Excel

Here's how to use the OR function in Excel:

1. Insert the OR function

Click on the cell where you want the "TRUE" or "FALSE" value to appear. Type "=OR" and press "Enter" on your keyboard to populate the OR function. Another way to access this function is by clicking on the "Formulas" tab. Go to the "Function Library" group, click "Logical" and select "OR." This action inserts the OR function into the cell you previously highlighted.

2. Add logical tests

Next, consider what you want the function to test for and enter these conditions as arguments. You can separate each condition with a comma and add a closing parenthesis after the final condition. For instance, imagine that you want the function to return a "TRUE" value if cell C4 is equal to 10, 15, 20 or 25. The function would look like:

"=OR(C4=10, C4=15, C4=20, C4=25)"

Other common logical tests use the greater than or less than signs. For instance, if you want the function to test whether the value of C4 is greater than 10, one of your arguments could be "C4>10." You may also use greater than or equal to or less than or equal to conditions by entering an equal sign after the greater than or less than sign. For instance, if you want the function to test whether the value of C4 is less than or equal to 10, the argument would be "C4<=10."

3. Press "Enter"

After writing your function and adding a closing parenthesis, press "Enter" on your keyboard. The function conducts all tests in order and returns a "TRUE" value as soon as it detects one true condition. For instance, consider this function: "=OR(C4=10, C4=15, C4=20, C4=25)." If C4 has a value of 20, the function returns a "TRUE" value because the third argument is true. If C4 was 16. the function would return a "FALSE" value because none of the conditions are true.

4. Copy the function to other cells

If you want to copy the function to other cells, click on the cell that contains the function. Hover your mouse over the small green box in the bottom right corner of the cell. When the cursor turns into a small cross, click and drag the formula to adjacent cells. This action causes the formula to use relative cell references. For instance, imagine cell D10 contains "=OR(C10=1)." If you copy this formula to D11, D11 contains "=OR(C11=1)" instead of "=OR(C10=1)."

Related: How To Use Excel MINIFS function in 3 Steps (With Examples)

How to use the OR function in Excel with the IF function

While you can use the OR function independently, many people use it with the IF function. This combination allows you to test multiple conditions and return values other than "TRUE" or "FALSE." Here's a simple explanation of how to use the OR function with the IF function:

1. Enter the IF function

Click on the cell where you want the result to appear. Type "=IF" and press "Enter" on your keyboard. You may also access the IF function by clicking on the "Formulas" tab. Click on "Logical" in the "Function Library" group and choose "IF."

2. Insert the OR function

Insert the OR function as the first argument of the IF function. Do so by typing "=OR," pressing "Enter" and using commas to separate each condition of the OR function. After entering all the conditions you want the OR function to test, add a closing parenthesis. For instance, if you want to test whether C4 is equal to 10 or 20, the beginning of your IF function would look like:

"=IF(=OR(C4=10, C4=20)"

Related: 10 Top Excel Accounting Formulas and Functions (With Examples)

3. Insert true and false values

After adding a closing parenthesis to the OR function, add a comma. You can add the second argument in quotes, which is the value that the IF function returns if it finds any of the logical tests to be true. Add another comma and add the third argument in quotes, which is the value that the IF function returns if the logical tests are all false. If you don't want the function to return anything for a true or false value, you can enter just quotes for that argument.

Then, close the IF function by adding a closing parenthesis. For instance, if you wanted the function in the example in step two to yield "Yes" if the OR function is true and "No" if it's false, the IF function would look like:

"=IF(=OR(C4=10, C4=20), "Yes," "No")"

Related: How To Use the Excel LEFT Function

Example of the OR function in Excel

Imagine that you're a teacher determining whether students pass a test. A passing score is at least a 60, and every student has three opportunities to take the test. You create a spreadsheet with the following information:

ABCDE1
Test 1Test 2Test 3Passed?2Student 1594280TRUE3Student 2908285TRUE4Student 3424448FALSE5Student 4707582TRUEYou can use the OR function to quickly see which students passed the test. You enter "=OR(B2>=60, C2>=60, D2>=60)" into cell E2. This function sees if Student 1 scored a 60 or above on any of their attempts. Because the student scored an 80 on their third attempt, the function yields a "TRUE" value to indicate that the student passed. You can copy this formula to other cells to see whether other students passed the test based on their exam scores.

Please note that none of the companies mentioned in this article are affiliated with Indeed.

Explore more articles