#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Module 10
3 min

XOR Function

Returns TRUE when conditions are different

XOR Function

XOR = Exclusive OR

Returns TRUE when only one condition is true, not both.

Formula

=XOR(condition1, condition2, ...)


How XOR Works

Condition 1Condition 2XOR Result
TRUETRUEFALSE
TRUEFALSETRUE
FALSETRUETRUE
FALSEFALSEFALSE
4 rows

Key: TRUE only when conditions are different

XOR Truth Table


XOR vs OR

ABOR ResultXOR Result
TRUETRUETRUEFALSE
TRUEFALSETRUETRUE
FALSETRUETRUETRUE
FALSEFALSEFALSEFALSE
4 rows
  • OR = Either or both → TRUE
  • XOR = Either but NOT both → TRUE

Example: Either/Or Discount

Customer gets discount if they have coupon OR member card — but not both (no double discount!)

=XOR(A1="Yes", B1="Yes")

Coupon (A1)Member (B1)Discount?
YesNoTRUE
NoYesTRUE
YesYesFALSE
NoNoFALSE
4 rows

XOR Example


With IF

=IF(XOR(A1>50, B1>50), "One Passed", "Both or None")

A1B1Result
6040One Passed
4060One Passed
6060Both or None
4040Both or None
4 rows

When to Use XOR

  • Either/or situations (not both)
  • Toggle switches
  • Checking odd number of TRUE values
  • Validation: one option only

Summary

  • XOR = TRUE when conditions are different
  • Only ONE can be true, not both
  • Use for "either but not both" logic
  • Formula: =XOR(cond1, cond2)
SkillsetMaster - AI, Web Development & Data Analytics Courses