ID EN
#Logical

OR

Excel Functions

Test multiple conditions at the same time

Syntax

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

Arguments

Parameter Description
logical1 The first condition or logical value to evaluate.
logical2 [optional] The second condition or logical value to evaluate.

Return Value

TRUE or FALSE

Details

The OR function is one of Excel's logical functions. It is designed to test multiple conditions simultaneously and return TRUE if any condition is TRUE. If all conditions are FALSE, the OR function returns FALSE. The OR function is often combined with other functions like AND, NOT, and IF to construct more complex logical tests. It commonly appears in the logical test of the IF function and in formulas for conditional formatting and data validation. The OR function is a good way to simplify complicated formulas use many nested IFs. The purpose of the OR function is to evaluate more than one logical test at the same time and return TRUE if any result is TRUE. Excel's OR function can handle up to 255 separate conditions, which are entered as arguments with names like "logical1", "logical2",

Examples

OR function basics

The purpose of the OR function is to evaluate more than one logical test at the same time and return TRUE if any result is TRUE. Excel's OR function c

EXCEL
=OR(FALSE,FALSE,TRUE) // returns TRUE
OR function basics

If all conditions are FALSE, OR will return FALSE:

EXCEL
=OR(FALSE,FALSE,FALSE) // returns FALSE
OR function basics

Typically, logical arguments are provided to OR as logical expressions, for example:

EXCEL
=OR(A1>0,A1<5)
=OR(A1>0,B1>0)
=OR(A1="red",B1="small")
OR function basics

All expressions in the formulas above will be evaluated as TRUE or FALSE. Notice that text values used in comparisons must be enclosed in double quote

EXCEL
=OR(0,0,3) // returns TRUE
=OR(0,0,0) // returns FALSE
Example - value is x or y or z

You can use OR to test for one of several values. For example, in the worksheet below, we are using the OR function to test if the codes in column B a

EXCEL
=OR(B5=115,B5=120,B5=125)
Example - OR with the IF function

The OR function is often embedded inside the IF function as the logical test to simplify what would otherwise be a more complex formula. For example,

EXCEL
=IF(OR(B5<750,C5<750),"Deny","Approve")

See Also

AND IF XOR NOT