SheetsLessons
Logical function

XOR function in Google Sheets

XOR ("exclusive or") returns TRUE when an odd number of its conditions are TRUE. With two conditions that means "one or the other, but not both".

Syntax

=XOR(logical1, [logical2, ...])
logical1
The first condition.
logical2, ...
Optional. More conditions.

Practice XOR

Task 1 of 1

Applicants are fast-tracked if they have a referral or passed the test, but not both (those go to a different queue). Return TRUE/FALSE in D2.

D2
fx

Tip: while typing a formula, click a cell or drag across cells to insert references. Press Enter to check, and Tab to accept a function suggestion.

XOR examples

Each example below runs against this sample sheet. The results are calculated by the same engine as the practice grid.

ABCD
1StudentClassScorePassed
2PriyaA92TRUE
3LeoB67FALSE
4ChloeA48FALSE
5MateoB81TRUE
6InesCFALSE
7KaiC75TRUE
Test scores (Ines missed the test)
FormulaResultWhat it shows
=XOR(TRUE, FALSE)TRUEExactly one is TRUE.
=XOR(C2>=70, B2="A")FALSEBoth TRUE, so XOR is FALSE.
=XOR(C4>=70, B4="A")TRUEOnly one is TRUE.

Tips and common mistakes

  • With more than two conditions, XOR is TRUE when 1, 3, 5… of them are TRUE. That's rarely what people expect, so keep it to two.

Related functions