XOR is TRUE when an odd number of conditions are TRUE — for two conditions, that means “exactly one, but not both.” Useful for either/or rules and parity checks.
The example
Two flags compared with XOR.
| A | B | C | |
|---|---|---|---|
| 1 | A | B | XOR |
| 2 | TRUE | FALSE | TRUE |
| 3 | TRUE | TRUE | FALSE |
The formula
Exactly-one logic:
How it works
XOR counts the TRUEs:
XOR(conditions)is TRUE when an odd number of them are TRUE.- With two conditions, that’s “exactly one” — one TRUE and one FALSE.
- Unlike OR, it’s FALSE when both are TRUE.
- Use it for “pick one” rules: e.g. flag rows where exactly one of two boxes is checked.
More than two inputs? XOR’s “odd count” rule means it’s not simply “exactly one” for three or more. To require exactly one of several conditions, use =SUMPRODUCT(--(conditions))=1 instead.
Try it: interactive demo
Toggle two flags.
Variations
Exactly one of many
Count the TRUEs:
Both TRUE (AND)
For comparison:
At least one (OR)
Inclusive:
Pitfalls & errors
Odd-count, not exactly-one. For 3+ inputs, XOR is TRUE for 1 or 3 TRUEs. Use SUMPRODUCT for strict “exactly one.”
2013 or later. XOR isn’t in Excel 2007 — use A2<>B2 for two booleans.
Inputs are boolean. Numbers are treated as TRUE if non-zero.
Practice workbook
Frequently asked questions
What does the XOR function do in Excel?
How do I check that exactly one of several conditions is TRUE?
How is XOR different from OR?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class