
Returns TRUE when an odd number of logical tests are TRUE.
The Excel XOR function returns TRUE when an odd number of logical tests are TRUE, and FALSE when the number of TRUE results is even.
Most people first meet XOR as an "either this or that, but not both" function. That is the most common use with two conditions. But with three or more conditions, XOR still follows the same core rule: it returns TRUE when the count of TRUE results is odd.
Useful when one condition should pass, but two passing at the same time would be treated differently.
Returns a logical result that can be used directly or inside formulas such as IF.
=XOR(logical1, [logical2], ...)
Microsoft documents that XOR accepts from 1 to 254 conditions. Each argument should evaluate to a logical value such as TRUE or FALSE.
These arguments can be direct logical values, comparisons such as A1>10, or references that evaluate to TRUE or FALSE.
| Function | Main Idea | Returns TRUE When | Best Use |
|---|---|---|---|
XOR |
Exclusive or odd-parity test | An odd number of tests are TRUE | Mutually exclusive logic and parity-style checks |
OR |
Any match | At least one test is TRUE | Flexible pass conditions |
AND |
All match | Every test is TRUE | Strict rule sets |
NOT |
Reverse a result | The original logical value is FALSE | Inverting a condition |
The most important difference is that XOR does not simply mean "one or the other" in every case. With two conditions, that is a good mental model. With more than two conditions, the real rule is odd versus even TRUE counts.
XOR is most useful when your model needs to detect an exclusive outcome. For example, one checkbox may be allowed, but not both. One sensor may be over a threshold, but if both are over the threshold, that means a different kind of issue. In those cases, XOR is often clearer than combining multiple AND, OR, and NOT checks manually.
Microsoft also notes that array or reference arguments containing text or empty cells ignore those values. But if a specified range contains no logical values at all, XOR returns #VALUE!. That is worth remembering when you point XOR at larger ranges or mixed data.
XOR fits naturally inside IF. For example, you can use it to return labels such as "Exactly one selected", "Conflict", or "Check required" based on whether the logic passes.
With two conditions, XOR is often used as a mutual-exclusion test.
=XOR(B1,C1)
This returns TRUE when one option is TRUE and the other is FALSE. If both are TRUE or both are FALSE, the result is FALSE.
In cell F1, check whether exactly one of B2 or C2 is TRUE with =XOR(B2,C2).
XOR can compare two logical tests and confirm that only one of them passes.
=XOR(B1>100,C1>100)
This is useful when one breach should be flagged differently from a two-sided failure. It gives you a quick way to distinguish "only one side failed" from "both sides failed."
In cell F2, check whether exactly one of B2 or C2 is greater than 100.
With three or more inputs, XOR follows its full odd-count rule.
=XOR(B1,C1,D1)
This returns TRUE when 1 or 3 of the tests are TRUE, and FALSE when 0 or 2 are TRUE. That makes it useful when parity matters more than a simple yes-or-no check.
In cell F3, test whether an odd number of B2, C2, and D2 are TRUE.
XOR works well with comparisons against dynamic benchmarks.
=XOR(B2>=G2,C2>=H2)
This returns TRUE when one target is met but not both. It can be useful in scorecards, validation checks, or rules where only one success path should remain active.
In cell F4, check whether B2 meets G2 or C2 meets H2, but not both.
XOR returns TRUE when an odd number of tests are TRUE.#VALUE!.IF to turn logic results into readable labels.Tell your friends about this post