How to Use Exclusive OR with XOR in Excel

XOR is TRUE when exactly one of two conditions is met — ideal for "one or the other, but not both" rules.

You will learn to

  • Test whether exactly one of two flags is TRUE
  • Route records with IF and XOR
  • Use XOR on calculated comparisons

How it works

XOR stands for "exclusive or". With two conditions it returns TRUE when exactly one is TRUE, and FALSE when both or neither are: =XOR(B2,C2). That is different from OR, which is also TRUE when both conditions hold.

Use XOR for "one or the other, not both" business rules — one discount per order, one approver per request, a voucher for customers who hit one target but not the other. With more than two conditions, XOR returns TRUE when an odd number of them are TRUE.

=XOR(B2,C2)