Logical

XOR Formula

XOR returns TRUE when an odd number of its arguments evaluate to TRUE, and FALSE when an even number (or zero) are TRUE. It is useful for building toggle logic, parity checks, or validation rules where exactly one of two conditions should be met but not both.

Syntax

XOR(logical1, [logical2, ...])
ParameterDescription
logical1 Parameter of the XOR function.
[logical2 (Optional.) Parameter of the XOR function.
...] Parameter of the XOR function.
Try XOR in Viztab — free, no signup

Examples

Either/or check

Formula
=XOR(A1>100, B1>100)
TRUE if exactly one cell exceeds 100. If A1=150 and B1=50, returns TRUE because only one condition is met.

Parity validation

Formula
=XOR(C1="Yes", D1="Yes", E1="Yes")
TRUE when an odd number of cells contain "Yes" (1 or 3 of them). FALSE when 0 or 2 contain "Yes".

Toggle switch logic

Formula
=XOR(ISBLANK(A2), ISBLANK(B2))
TRUE when exactly one of the two cells is empty — useful for forms where you need one field filled but not both.

Common Errors

#VALUE!

Occurs when an argument cannot be evaluated as a logical value, such as passing text that isn't TRUE/FALSE.

#N/A

Can occur if a referenced cell contains a #N/A error and isn't wrapped in an error-handling function.

Tips

XOR vs OR

OR returns TRUE if any argument is TRUE. XOR returns TRUE only when an odd number are TRUE. For a simple "one but not both" check with two arguments, XOR is what you want.

Nesting with IF

Use =IF(XOR(A1>0, B1>0), "One positive", "Both or neither") to act on the exclusive-or result.

More than two arguments

With 3+ arguments, XOR checks parity (odd count of TRUEs), not "exactly one." For exactly-one logic with many arguments, use =COUNTIF(range, TRUE)=1 instead.

Try XOR in Viztab

Import your data and use XOR with 370+ other formulas. No signup required.

Open Viztab

Related Formulas