OR Function - Check if Any Argument is True

Add to Favorites
Author:

The OR function in Excel checks if ANY argument in it evaluates to TRUE.  If anything evaluates to TRUE, then the function will return TRUE; to return FALSE, every argument in the function must evaluate to FALSE.  Even if only one argument in this function evaluates to TRUE, the function will return TRUE.

This is the sister function to the AND function.

This is a very useful function and it is often used in conjunction with an IF statement in order to make more powerful logical tests in Excel.

Logical test: a logical test is any time you want to see if something is greater than, less than, equal to, or not equal to another thing.  Think of logical tests as anything that uses these operators: =, <, >, <>, >=, <=

Syntax

=OR(logical1, [logical2], etc.)

Argument

Description

Logical1

This is the first argument or condition that you want to check to see if it evaluates to TRUE or not.  You do not need more than this 1 argument in the function.

[Logical2] etc.

This argument is optional.  This would be another condition that you wanted to check to see if it evaluated to TRUE or FALSE.

You can have up to 255 conditions in this function if you are in Excel 2007 or later.

[] means it is an optional argument.

Each argument within this function must be a logical argument, which means it must evaluate to either TRUE or FALSE, in order for this function to work.

Basic Example - Testing Numbers

I will first go through a series of examples with simple numbers so that you can get an understanding of how this type of function works, especially when it concerns the logical operators, equals sign, less than sign, etc.

Here is a worksheet with many examples to illustrate how the OR function works:

Each value in column A is displayed in column B.

Look through these examples above until you understand how this function works.  This should help you become comfortable using logical comparison operators and also with how the OR function works.  Remember that only one of the logical arguments has to evaluate to TRUE for the function to return TRUE.

OR Function using Text and Also Numbers

You can use this function to see if certain text was entered into a cell as well as to compare numbers.  Here, we will mix the two and also use cell references instead of hard-coding the values into the function.

You can see that we can easily include text comparisons in here using the equals sign.  Note that the text comparisons are case-insensitive. Look to row 1, where "hi" is still equal to "HI" as far as the OR function is concerned.

OR Function Inside an IF Statement

This is where the OR function really becomes useful and allows us to make more powerful spreadsheets.

Here is the function we used:

=IF(OR(A1>B1,A2="yes"),"Proceed","Stop")

Here, we used the OR function within the logical argument of the IF statement.  The OR function simply returns a TRUE or FALSE back to the IF statement, which it then uses to determine whether or not to output the text "Proceed" or "Stop".

Since we are using the OR function, only one argument within it has to be TRUE in order for it to send the value TRUE to the IF statement, causing it to output "Proceed".

(If you read the AND tutorial that we made, you will notice that this is the same example.  In fact, it returns the same response of "Proceed" even though cell A2 says "no"; this is because we used the OR function and the other argument within it evaluates to TRUE.)

Notes

The OR function is a simple function and, by itself, it doesn't seem to be too useful.  However, when combined with other functions, like the IF function, it becomes quite useful and allows you to build powerful formulas.  Memorize the OR function and keep it in the back of your mind so that you can use it when needed.

Make sure to download the workbook that accompanies this tutorial so you can see the examples in the worksheet.


Excel Function: OR()
Downloadable Files: Excel File

Question? Ask it in our Excel Forum


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Tutorial Details
Excel Function: OR()
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course