# Excel XOR Function

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.

**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:

Notes:

- 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.
- XOR was introduced in Excel 2013.

## Download 200+ Excel Shortcuts

Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.