Formula Guide

The Excel XOR Function
explained simply

XOR returns TRUE when an odd number of its conditions are true — most simply, when exactly one of two conditions is true, but not both.

ExcelPro · 4 min read · Updated June 2026
Contents
  1. What does XOR do?
  2. Syntax
  3. 3 examples
  4. XOR vs OR
  5. FAQ

What does XOR do?

XOR ("exclusive or") returns TRUE if an odd number of its arguments are TRUE. With exactly two conditions, this means it returns TRUE when exactly one of them is true — not both, and not neither.

This is genuinely different from OR, which returns TRUE if either or both conditions are true.

Syntax

=XOR(logical1, [logical2], ...)
ArgumentDescription
logical1 requiredThe first condition.
logical2, ... optionalAdditional conditions.

Examples

Example 1
Exactly one of two discounts applies
=XOR(A2>100,B2="VIP")

Returns TRUE only if exactly one of the two discount conditions is met — if both are true, XOR returns FALSE, useful when discounts should not stack.

Example 2
Compare to OR on the same data
=OR(A2>100,B2="VIP")

Returns TRUE if either or both conditions are true — the more commonly needed logic for most real situations.

Example 3
Check for exactly one filled cell
=XOR(A2<>"",B2<>"")

Useful for validating that exactly one of two optional fields was filled in, not both, not neither.

XOR vs OR

Condition ACondition BOR resultXOR result
TRUEFALSETRUETRUE
TRUETRUETRUEFALSE
FALSEFALSEFALSEFALSE

The only case where OR and XOR disagree is when both conditions are true — OR says TRUE (at least one is true), XOR says FALSE (it requires exactly one, not both).

Common mistakes

⚠️ Using XOR when OR is what you actually mean

XOR is a genuinely uncommon need in business spreadsheets — double check you do not just want OR, which is far more frequently the right choice.

FAQ

Does XOR work with more than two conditions?
Yes — with more than two, it returns TRUE if an odd number of them are true, which gets harder to reason about intuitively beyond two conditions.

Practise Excel with real data

ExcelPro has 700+ hands-on Excel exercises across 7 career tracks — free to start, no download needed.

Start practicing free →

Related formulas

OR AND IF