# Logical Expressions

Location: http:www.mvps.org/dmcritchie/excel/logical.htm
[View without Frames]

## AND and OR

AND and OR are logical functions and will return either a True or a False
0 will be considered False, everything else as True.

 C D E F 1 1 --OR-- TRUE =OR(C\$1,C\$2,C\$3,C\$4) 2 1 Opposite FALSE =AND(NOT(C\$1),NOT(C\$2),NOT(C\$3),NOT(C\$4)) 3 0 Same TRUE =NOT(AND(NOT(C\$1),NOT(C\$2),NOT(C\$3),NOT(C\$4))) 4 1 5 --AND-- FALSE =AND(C\$1,C\$2,C\$3,C\$4) 6 Opposite TRUE =OR(NOT(C\$1),NOT(C\$2),NOT(C\$3),NOT(C\$4)) 7 Same FALSE =NOT(OR(NOT(C\$1),NOT(C\$2),NOT(C\$3),NOT(C\$4)))

with AND if all of the bits are True it will return True; otherwise, False
with OR if any of the bits are True it will return True; otherwise, False
with NOT whatever is True becomes False, whatever was False becomes True.

The opposite of   OR(c1,c2,...cn)
is to change each condition to the opposite and change the OR to AND
i.e. AND(NOT(c1),NOT(c2),..., NOT(cn))
Therefore the equivalent of  OR(c1,c2,...cn)   would be
NOT(AND(NOT(c1),NOT(c2),..., NOT(cn)))

ISERR() is a condition and returns True or False, it is a negative of the content being valid

FALSE()  is a builtin function that returns False  so that you can type  FALSE into your worksheet.

### VBA Coding

Coding in VBA differs quite a bit for NOT with no parens.

IF cond1 OR cond2 OR ... OR condn

would be equivalent to the ELSE of the following test:
IF NOT (cond1 OR cond2 OR ... OR condn) THEN ...

but the difference shows up if there is only one condition -- no parens needed:
IF NOT cond1 THEN ...

(placeholder)