Logical

XOR Function in Excel

Returns TRUE if an odd number of arguments are TRUE (exclusive OR).

Syntax

  • =XOR(logical1, [logical2], ...)

Arguments

  • logical1 (required): First condition
  • logical2 (optional): Additional conditions

Examples

  • =XOR(TRUE, FALSE) - One TRUE - Result: TRUE
  • =XOR(TRUE, TRUE) - Both TRUE - Result: FALSE

Using XOR in business rules

  • Build logical tests that return clear outcomes (Yes/No, Pass/Fail, tier labels).
  • Combine with [AND](/functions/and/) and [OR](/functions/or/) for multi-condition rules.
  • For many branches prefer [IFS](/functions/ifs/) over deeply nested IF.
  • Compare patterns in [IF vs IFS](/compare/if-vs-ifs/).

Common errors

  • Different from OR - returns FALSE if all are TRUE

Use cases

  • Exclusive conditions
  • Toggle logic
  • Validation rules

Frequently asked questions

  • What is the difference between XOR and OR? OR returns TRUE if ANY argument is TRUE. XOR returns TRUE only if an ODD number of arguments are TRUE. XOR(TRUE, TRUE) = FALSE (both true), but OR(TRUE, TRUE) = TRUE. XOR is 'exclusive or' - one or the other, but not both.
  • When would I use XOR in real scenarios? Use XOR for mutually exclusive options: =XOR(HasDiscount, HasCoupon) ensures customer uses only one promotion. Or for toggle states: =XOR(CurrentState, Toggle) flips a boolean. Also useful in checksum/parity calculations.
  • How does XOR work with more than 2 arguments? XOR returns TRUE if an ODD number of arguments are TRUE. XOR(T,T,T) = TRUE (3 is odd), XOR(T,T,F) = FALSE (2 is even), XOR(T,F,F) = TRUE (1 is odd). Think of it as counting TRUE values and checking if the count is odd.

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.