The Excel XOR function returns a logical “exclusive OR” of all arguments. For two logical arguments, XOR returns TRUE if either one of both arguments is TRUE. In case both are TRUE or both are FALSE, XOR returns FALSE.
XOR( logical1, [logical2], … )
logical1 – First condition to evaluate
logical2 – [Optional] Second condition to evaluate
TRUE or FALSE
How to use the XOR function in Excel
The XOR function performs a logical “exclusive OR” operation. Unlike the normal OR function, which performs an “inclusive OR” operation and returns TRUE if any logical argument is TRUE, the XOR function returns TRUE only in specific cases.
In the simplest case with just two logical arguments, XOR returns TRUE only if exactly one of both arguments is TRUE, but FALSE if both are TRUE or both are FALSE. In the following formula, exactly one of both A1 and B1 has to be greater than 10 to make XOR return TRUE, but if both evaluate TRUE XOR returns FALSE:
For more than 2 logical arguments
For more than 2 logical arguments, XOR returns TRUE if the number of TRUE logicals is odd. For the following formula, the XOR statements only returns TRUE if either 1, 3, or 5 of the logical tests evaluate TRUE:
If none of the supplied arguments is a logical value, XOR returns a #VALUE! error.
The Excel OR function is a logical function that is used to check if at least one of multiple conditions is evaluate TRUE.
The Excel NOT function is a logical function that allows you to check if one value is not equal to another. It returns the opposite of a given value.
The Excel AND function is a logical function that is used to check multiple conditions at the same time. AND returns TRUE if all conditions evaluate TRUE.