The XOR function performs what is called "exclusive OR". With two logical statements, XOR returns TRUE if either statement is TRUE, but returns FALSE if both statements are TRUE. If neither is TRUE, XOR also returns FALSE.
Perform exclusive OR
TRUE or FALSE
=XOR (logical1, [logical2], ...)
logical1 - An expression, constant, or reference that evaluates to TRUE or FALSE.
logical2 - [optional] An expression, constant, or reference that evaluates to TRUE or FALSE.
The XOR function performs what is called "exclusive OR", as opposed to the "inclusive OR" performed by the OR function. Whereas the OR function returns true if any logical is TRUE, XOR returns TRUE in specific cases . In the simplest case, with just two logical statements, XOR returns TRUE only if one of the logicals is TRUE, not if both logicals are TRUE.
The concept of exclusive OR is more familiar in the world of programing. In plain English, you can think of a sentence like this "I'm either going to visit New York or San Francisco this summer". Nothing prevents me from visiting both, but the meaning is clearly that I plan to visit only one or the other.
With more than 2 logicals
With more than 2 logicals, XOR only returns TRUE when the number of TRUE logicals is odd, as shown in the following example:
Logical arguments must evaluate to TRUE or FALSE, 1 or 0, or be references that contain logical values.
Empty references are ignored.
XOR returns #VALUE! if no logical values are found.
With more than two logicals, XOR returns TRUE when the number of TRUE logicals is odd, and FALSE if not.
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...
The AND function is a logical function used to require more than one condition at the same time. AND returns either TRUE or FALSE. To test if a number in A1 is greater than zero and less than 10, use =AND(A1>0,A1...
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.