Contact

XOR Function in Google Sheets: Test odd parity across logical inputs

Logical Beginner Google Sheets

Learn XOR in Google Sheets with explicit inputs, worked scenarios, independently checked expectations and troubleshooting.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: Test odd parity across logical inputs with XOR. The Google XOR documentation supplies the contract summarized here.

Syntax and arguments

=XOR(logical_expression1, [logical_expression2, ...]) requires the first logical expression; additional expressions are optional. Google documents both logical values and ranges. Numeric 0 counts as false, and every other number, including negative numbers, counts as true.

The answer is TRUE when the number of true inputs is odd, otherwise FALSE. For two inputs this means exactly one is true. That wording becomes wrong for three or more inputs.

Worked scenario: two alternative flags

Put TRUE in A2 and FALSE in B2. =XOR(A2,B2) has expected result TRUE. If both are TRUE, the expected result is FALSE. If both are FALSE, the expected result is also FALSE. This works for checking two mutually exclusive flags, provided they are actual logical values.

Advanced example: parity across a range

Enter TRUE, TRUE, TRUE and FALSE in A5:A8. =XOR(A5:A8) has expected result TRUE because three true entries is odd. Change A8 to TRUE: four true entries produces FALSE. This range example demonstrates why XOR is unsuitable for an “exactly one selection” rule across several choices.

For a numeric control, =XOR(0,-2,7) has expected result FALSE: there are two nonzero numbers. Adding a fourth input with =XOR(0,-2,7,4) changes the expected result to TRUE. The magnitude and sign of each nonzero number do not add extra votes.

Troubleshooting

  • Three TRUE inputs returning TRUE is correct parity behavior, not a fault.
  • If the rule is “at least one,” use OR. If every condition must pass, use AND.
  • Do not assume typed text such as quoted “TRUE”, blank cells or errors share the numeric/logical rules above. Those edge cases are outside this guide’s verified scope.
  • Range selection matters: an extra genuine TRUE entry flips the parity. Check both endpoints when copying a formula.

Documentation and compatibility

The detailed Google reference establishes odd parity and boolean output. A shorter catalogue description is insufficient to justify a two-number-only or numeric-1/0 interpretation. These examples use the detailed contract; no import/export or cross-software equivalence test is claimed.

Availability and version history

Documented in the rolling Google Sheets service. Documentation reviewed October 19, 2026; an introduction date or numbered release was not established. Examples use English function names, decimal points and comma separators; adapt separators to the sheet’s locale.

Verification scope and sources

The official reference establishes the syntax and function-specific contract. Worked values are original, independently derived expectations, not native Google Sheets observations. No account access, UI screenshot or cross-version execution was performed. Native behavior outside the documented scope remains unverified.