XOR Function
Returns TRUE when an odd number of conditions are TRUE — with two, that means exactly one.
Category
Logical
Available in
Excel 2013+, Microsoft 365
Returns
TRUE or FALSE
Want to practice XOR in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox
Overview
XOR stands for “exclusive or”. With two conditions it returns TRUE when one or the other is TRUE, but not both.
It's useful for catching rows where two options should never both be chosen — or where at least one must be.
Syntax
=XOR(logical1, [logical2], …)
Arguments
| Argument | Required? | What it does |
|---|---|---|
| logical1 | Yes | The first condition. |
| logical2, … | Optional | Up to 254 more conditions. |
Examples
Example 1 — Exactly one discount
Customers may use a coupon or a loyalty discount, but not both.
D2fx=XOR(B2="Yes", C2="Yes")
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Order | Coupon | Loyalty | Valid? |
| 2 | 2001 | Yes | No | TRUE |
| 3 | 2002 | Yes | Yes | FALSE |
| 4 | 2003 | No | No | FALSE |
| 5 | 2004 | No | Yes | TRUE |
=XOR(B2="Yes", C2="Yes") Explain
Example 2 — Flagging the problem rows
Label the orders that break the rule.
=IF(XOR(B2="Yes", C2="Yes"), "", "Check discounts") Explain
Common mistakes
- Three or more conditions. XOR counts TRUEs and returns TRUE for an odd count — so three TRUEs gives TRUE. For “exactly one of many”, use =SUM(--(B2:E2="Yes"))=1.
Notes

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.