Syntax, a live playground, a measured truth table and coercion gallery, the eager-evaluation trap, and a sourced error library: odd number of TRUE inputs.
Returns TRUE when an odd number of arguments are TRUE — parity, not "exactly one". It returns a single logical value, so it is usually combined with IF to branch to a result.
XOR is odd-parity: TRUE when an odd number of arguments are TRUE — not "exactly one". The tables below were measured live in the HyperFormula engine. Click any truth-table row to load it into the live playground.
| A | B | XOR(A,B) |
|---|---|---|
| TRUE | TRUE | FALSE |
| TRUE | FALSE | TRUE |
| FALSE | TRUE | TRUE |
| FALSE | FALSE | FALSE |
Numbers, text and blanks do not all behave the same. Every value below was measured in the engine.
| Input | XOR result | Why |
|---|---|---|
| =XOR(1,0) | TRUE | One TRUE (odd) → TRUE |
| =XOR(1,1) | FALSE | Two TRUE (even) → FALSE |
| =XOR(2,2,2) | TRUE | Three non-zero (odd) → TRUE |
| =XOR(TRUE,TRUE,TRUE) | TRUE | Odd count → TRUE, NOT "exactly one" |
| =XOR(TRUE,TRUE,TRUE,TRUE) | FALSE | Even count → FALSE |
| =XOR(E2:E5) (all blank) | FALSE | Zero TRUE (even) → FALSE |
IF is different: it is lazy.| Input | Result | Why |
|---|---|---|
| =XOR(TRUE,1/0) | #DIV/0! | Even though the answer is already decided, the 1/0 still errors the whole formula |
| =IF(FALSE,1/0,5) | 5 | IF is lazy: the untaken branch is never evaluated |
| =IFERROR(XOR(TRUE,1/0),"safe") | safe | Wrap the whole call to absorb the error |
The biggest XOR surprise: it returns TRUE when an odd number of inputs are TRUE — not when exactly one is. Measured across 2, 3 and 4 inputs:
| Formula | TRUE count | Result |
|---|---|---|
| =XOR(TRUE,FALSE) | 1 (odd) | TRUE |
| =XOR(TRUE,TRUE) | 2 (even) | FALSE |
| =XOR(TRUE,TRUE,TRUE) | 3 (odd) | TRUE |
| =XOR(TRUE,TRUE,TRUE,TRUE) | 4 (even) | FALSE |
=COUNTIF(range,TRUE)=1 or =SUMPRODUCT(--(range))=1 instead.Edit the table or type any formula — the HyperFormula engine evaluates it instantly. Load a preset to see XOR return TRUE/FALSE, coerce numbers and text, and hit the eager-evaluation trap in real time.
8 failure patterns mined from actual user reports on Reddit, Stack Overflow and Super User — each with the authentic symptom, root cause, a fix, and a runnable formula. Not textbook theory.
XOR is available across modern Excel, Google Sheets and LibreOffice. XOR arrived in Excel 2013, so 2010 and earlier return #NAME? — here is the MOD/SUMPRODUCT fallback.
| Platform | Support | Notes | Gotcha |
|---|
XOR is parity. The full course walks the logical toolkit end to end — AND/OR/XOR/NOT, the "exactly one" pattern, and the eager-evaluation trap.