The XOR guide
=XOR(B2>0, C2>0) is TRUE when exactly one of the two tests is true, and FALSE when both are or neither is. OR would also say TRUE when both are; that's the difference.
AND, OR, XOR side by side
AND(a, b): TRUE only when both are true.OR(a, b): TRUE when at least one is true, both included.XOR(a, b): TRUE when exactly one is true.
"Paid by card or on invoice, not both" is XOR. An order paid twice is a problem to catch, and OR would wave it through. See AND and OR.
Test the value, not whether the cell is filled
A 0 in the card column means no card payment, but the cell isn't empty. B2<>"" and ISNUMBER(B2) both count it as a payment. B2>0 asks the real question.
Without XOR
Older files sometimes write it as =(B2>0)<>(C2>0): two TRUE/FALSE values that differ means exactly one is true. Or in full: =OR(AND(B2>0, C2=0), AND(B2=0, C2>0)). All three give the same answer.
More than two tests
With three or more arguments, XOR is TRUE when an odd number of them are true: one or three, not two. To check "exactly one of three", count instead: =COUNTIF(B2:D2, ">0")=1.
FAQ
- What does XOR do in Excel?
- XOR returns TRUE when an odd number of its tests are true. With two tests that means exactly one: TRUE if one is true and the other false, FALSE if both or neither are.
- What is the difference between OR and XOR in Excel?
- OR is TRUE when at least one test is true, including both. XOR is FALSE when both are true.
- Is XOR available in all versions of Excel?
- XOR arrived in Excel 2013. In older versions, compare the two tests instead: =(A2>0)<>(B2>0).
- How do I check that exactly one of three cells is filled?
- Count them: =COUNTA(B2:D2)=1, or =COUNTIF(B2:D2,">0")=1 for amounts. XOR with three tests is also TRUE when all three are true.






























































