The XOR function returns TRUE if an odd number of the provided arguments are logically true, and FALSE otherwise.

Parts of a XOR formula

XOR(logical_expression1, [logical_expression2, ...])

PartDescriptionNotes
logical_expression1An expression or reference to a cell containing an expression that represents some logical value, e.g. “TRUE” or “FALSE,” or an expression that can be coerced to a logical value.
logical_expression2More expressions or cell references that represent logical values.A second logical expression, and any additional expressions are optional.

Sample formulas

XOR(TRUE, FALSE, TRUE)

XOR(A2=TRUE, A3=FALSE)

XOR(A1:A10, B1:B10)

XOR(0, 1, 2, 3)

Notes

  • The number 0 is logically false. All other numbers (including negative numbers) are logically true.
  • The XOR function accepts both logical value and range parameters.
  • Returns TRUE if an odd number of arguments are TRUE.

Examples

AB
1Result
2TRUE
3FALSE
4FALSE
5TRUE
6TRUE
ABCD
9logical_expression1logical_expression2Result
10TRUEFALSETRUE
11FALSEFALSEFALSE
12TRUETRUEFALSE
1301TRUE
1415FALSE
AB
17Result
18FALSE
19FALSE
20TRUE
  • OR: The OR function returns true if any of the provided arguments are logically true, and false if all of the provided arguments are logically false.
  • AND: The AND function returns true if all of the provided arguments are logically true, and false if any of the provided arguments are logically false.