OR ()
This
function tests two or more conditions to see if any of them are true.
It can be
used to test that at least one of a series of numbers meets certain conditions.
Normally the OR() function would be used in conjunction with a function such as
=IF().
Best view in desktop mode.
A
|
B
|
C
|
D
|
E
|
F
|
|
1
|
Order No.
|
Cost
|
Payment Type
|
Handling Charge
|
||
2
|
AB001
|
1000
|
Cash
|
FALSE
|
= OR(C2="Visa",C2="Delta")
|
|
3
|
AB002
|
1000
|
Visa
|
TRUE
|
= OR(C3="Visa",C3="Delta")
|
|
4
|
AB003
|
2000
|
Cheque
|
FALSE
|
= OR(C4="Visa",C4="Delta")
|
|
5
|
AB004
|
5000
|
Delta
|
TRUE
|
= OR(C5="Visa",C5="Delta")
|
|
6
|
Syntax
=OR(Test1,Test2)
Note that there
can be up to 30 possible tests.
It can be used on single and multiple columns, rows.
It can be used on single and multiple columns, rows.
Formatting
When used by
itself it will show TRUE or FALSE.
Example 1
The following
table shows a list of orders taken by a company.
A handling charge
of $5 is made on all orders paid by Visa or Delta cards.
The =OR()
function has been used to determine whether the charge needs to be applied.
A
|
B
|
C
|
D
|
E
|
F
|
|
1
|
Order No.
|
Cost
|
Payment Type
|
Handling Charge
|
||
2
|
AB001
|
1000
|
Cash
|
$ -
|
=IF(OR(C2="Visa",C2="Delta"),5,0)
|
|
3
|
AB002
|
1000
|
Visa
|
$ 5.00
|
=IF(OR(C3="Visa",C3="Delta"),5,0)
|
|
4
|
AB003
|
2000
|
Cheque
|
$ -
|
=IF(OR(C4="Visa",C4="Delta"),5,0)
|
|
5
|
AB004
|
5000
|
Delta
|
$ 5.00
|
=IF(OR(C5="Visa",C5="Delta"),5,0)
|
|
6
|
Example 2
In a sports academy,
only two type items are allowed. If item color is Red, then it is allowed. If
item is Ball, then it is allowed. And show the allowed items as true.
A
|
B
|
C
|
D
|
E
|
|
1
|
Color
|
Item
|
Allowed
|
||
2
|
Red
|
Ball
|
TRUE
|
=OR(A2="Red",B2="Ball")
|
|
3
|
Green
|
Hockey
|
FALSE
|
=OR(A3="Red",B3="Ball")
|
|
4
|
Red
|
Shoes
|
TRUE
|
=OR(A4="Red",B4="Ball")
|
|
5
|
Blue
|
Ball
|
TRUE
|
=OR(A5="Red",B5="Ball")
|
|
6
|
White
|
Racket
|
FALSE
|
=OR(A6="Red",B6="Ball")
|
|
7
|
No comments:
Post a Comment