XOR
Returns a logical exclusive OR of all arguments. Returns TRUE when an odd number of arguments evaluate to TRUE, and FALSE when an even number evaluate to TRUE.
XOR(logical1, [logical2], ...)Arguments
logical1A condition or logical value to test.logical2Additional conditions or logical values (up to 254 total).(optional)
=XOR(TRUE,FALSE)Exactly one argument is TRUE — returns TRUE
=XOR(TRUE,TRUE)Two arguments TRUE (even count) — returns FALSE
=XOR(1>0,2>0,3>0)Three TRUE values (odd count) — returns TRUE
- •XOR returns TRUE if an odd number of arguments are TRUE
- •Available since Excel 2013
- •Useful for parity checks and toggle logic
- •For two arguments, XOR is equivalent to '=A<>B' on logical values
- •Expecting XOR to work like OR - XOR returns TRUE only when an odd number of arguments are TRUE, not simply when at least one is TRUE, which surprises people expecting standard OR behavior
- •Passing more than two arguments and assuming XOR checks that exactly one is TRUE - with three or more TRUE values, XOR can still return TRUE if the count of TRUE values is odd, not necessarily just one
- •Using XOR on non-logical values without realizing how Excel converts them - numbers and text are evaluated for their logical truthiness first, which can produce unexpected results
ORReturns TRUE if at least one argument is TRUE, a more commonly needed logic than XOR's exclusive-or behavior.ANDReturns TRUE only if every argument is TRUE, a stricter condition than either OR or XOR.NOTOften combined with XOR-like logic to invert a result, though NOT itself only accepts a single argument.How is XOR different from OR?
OR returns TRUE if at least one argument is TRUE, no matter how many. XOR returns TRUE only when an odd number of arguments are TRUE - with exactly two arguments, that means exactly one of them, but with three or more, the behavior is less intuitive.
Does XOR with three TRUE values return TRUE or FALSE?
TRUE, because three is an odd number - XOR's actual rule is about the parity (odd vs. even) of TRUE values, not simply whether exactly one is TRUE.
When would I actually use XOR?
It's most useful with exactly two conditions, where you want to know if exactly one (but not both) is true - like flagging a mismatch between two settings that should always differ.
Need to translate a formula using XOR?
Use our translator to convert your complete formula
