FormulaCraft

XOR

XOR (exclusive OR) returns TRUE if an odd number of the provided conditions are TRUE, and FALSE if an even number (including zero or all) are TRUE. It is useful for toggle logic, parity checks, and scenarios where exactly one of several mutually exclusive conditions should be met.

Excel
=XOR(A2="Yes",B2="Yes")
Google Sheets
=XOR(A2="Yes",B2="Yes")

Verified example

Computed by a real spreadsheet engine on the sample data below.

Approval AApproval BExclusive?
YesNo=XOR(A2="Yes",B2="Yes")
NoYes=XOR(A3="Yes",B3="Yes")
YesYes=XOR(A4="Yes",B4="Yes")
NoNo=XOR(A5="Yes",B5="Yes")

=XOR(A2="Yes",B2="Yes")TRUE

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 1Set up two or more logical conditions to test — for example, A2="Yes" and B2="Yes".
  2. 2Enter =XOR(A2="Yes",B2="Yes") to return TRUE only when exactly one of the two conditions is TRUE.
  3. 3Combine with IF: =IF(XOR(A2="Yes",B2="Yes"),"One approved","Both or neither") to display a message.

Need a version for your data?

Try: “Check whether exactly one of two approval columns is marked Yes, but not both

Related

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: