The OR function is a logical
function to test multiple conditions at the same time. OR returns either TRUE
or FALSE. For example, to test A1 for either "x" or "y",
use =OR(A1="x",A1="y"). The OR function can be used as the
logical test inside the IF function to avoid extra nested IFs, and can be
combined with the AND function.
Syntax
The syntax for the OR function in Microsoft Excel is:
=OR( condition1,
[condition2, ... condition_n] )
Parameters or Arguments
condition1
A condition to test that can
either be TRUE or FALSE.
condition2, ... condition_n
Optional. Conditions to test
that can either be TRUE or FALSE.
Notes:
Ø
In current versions of Excel (Excel 2007 and
later), you can enter up to 255 logical_test arguments to the Excel Or
function. However, in Excel 2003, the function can only handle up to 30
arguments.
Ø
If the logical_test arguments evaluate to
numbers, instead of logical values, the value zero is treated as FALSE and all
non-zero values are treated as TRUE.
Or Function Examples
The following spreadsheet shows three examples of the
Excel Or function.
Formulas:
|
A
|
B
|
C
|
1
|
5
|
10
|
=OR( A1>0, A1<B1 )
|
2
|
5
|
10
|
=OR( A2>0, A2>B2, B2>12 )
|
3
|
5
|
10
|
=OR( A3<0, A3>B3, B3>12 )
|
Results:
|
A
|
B
|
C
|
1
|
5
|
10
|
TRUE
|
2
|
5
|
10
|
TRUE
|
3
|
5
|
10
|
FALSE
|
In the above examples:
·
The function in cell C1 evaluates to TRUE, as
BOTH of the supplied conditions are TRUE;
·
The function in cell C2 evaluates to TRUE, as
the first condition, A2>0 evaluates to TRUE;
·
The function in cell C3 evaluates to FALSE, as
ALL of the supplied conditions are FALSE.
No comments:
Post a Comment