Excel XOR function

How to use the Excel XOR function

Description

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.

Syntax

XOR( logical1, [logical2], … )

Arguments

logical1 – First condition to evaluate

logical2 – [Optional] Second condition to evaluate

Return value

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:

= XOR(A1>10, B1>10)

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:

= XOR(A1>10, B1>10, C1>10, D1>10, E1>10)

Additional Notes

If none of the supplied arguments is a logical value, XOR returns a #VALUE! error.

Formula examples

Related Tutorials

Related Functions

How to use the Excel OR function

Excel OR function

The Excel OR function is a logical function that is used to check if at least one of multiple conditions is evaluate TRUE.

How to use the Excel NOT function

Excel NOT function

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.

How to use the Excel AND function

Excel AND function

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.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on reddit
Reddit
Share on whatsapp
WhatsApp
Share on email
Email
Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on whatsapp
Share on email