Logical functions

XOR

Matches all 1,237 recorded answers

Recorded: 1,212 in the answer bank and 25 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicXOR
BulgarianXOR
CzechXOR
DanishXELLER
GermanXOR
GreekXOR
English (Australia)XOR
English (United Kingdom)XOR
English (United States)XOR
SpanishXO
EstonianXOR
FinnishEHDOTON.TAI
FrenchOUX
HebrewXOR
CroatianXOR
HungarianXVAGY
IndonesianXOR
ItalianXOR
JapaneseXOR
KoreanXOR
LithuanianXOR
LatvianXOR
NorwegianXOR
DutchEX.OF
PolishXOR
Portuguese (Brazil)XOR
Portuguese (Portugal)XOU
RomanianXOR
RussianИСКЛИЛИ
SlovakXOR
SlovenianXOR
Serbian (Latin)XOR
SwedishXELLER
ThaiXOR
TurkishÖZELVEYA
UkrainianXOR
VietnameseXOR
Chinese (Simplified)XOR
Chinese (Hong Kong)XOR
Chinese (Traditional)XOR

Names from Microsoft's support site.

What it does

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

XOR shares the truth scan of AND and OR but performs a different reduction: it returns the parity of the true items, not a threshold test.

Formally, let T be the number of items in the scan that classified as true. Then XOR returns TRUE when T is odd and FALSE when T is even — including T = 0, provided at least one item classified at all.

This is worth stating carefully because the name misleads. In two-argument use, parity and "exactly one is true" coincide, so XOR(a, b) reads like exclusive disjunction. With three or more arguments they diverge: XOR(TRUE, TRUE, TRUE) is TRUE (three is odd), not FALSE. If you want "exactly one of these is true" over three conditions, XOR is the wrong function — the counting idiom SUM(--(conditions)) = 1 is what you mean.

The scan and its classification are identical to AND's:

ItemClassification
Logicalits own truth value
Numberfalse if exactly 0, true otherwise
Text or empty inside an array or reference argumentskipped
Errorthe scan stops and that error is the result

And, as with AND and OR, a scan in which nothing classified returns #VALUE! rather than the algebraic identity FALSE.

Arguments

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

  • Each argument is a condition or a container of conditions, scanned in row-major order.
  • An omitted slot delivers Missing and contributes nothing.

The misunderstood position here is not any one slot but the count: readers reach for XOR with more than two arguments expecting uniqueness and get parity.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Quirks

Result and edge cases

Returns a Logical, or an Error.

  • Single argument. XOR(x) is just the truthiness of x — parity of one item.
  • Two arguments. Behaves as exclusive disjunction; this is the only arity at which the intuitive reading and the implemented rule agree for all inputs.
  • Three or more. Parity. XOR(TRUE,TRUE,TRUE) is TRUE.
  • Zero versus nonzero. Nonzero numbers are true; only exact zero is false.
  • Text and empty in ranges. Skipped, so they do not disturb the parity count.
  • All items skipped. #VALUE!.
  • Arrays. Scanned whole, not lifted elementwise.

How to implement

Notes for implementers

  1. Accumulate parity as a single boolean toggled on each true item. Counting and then testing the low bit is equivalent but invites overflow thinking that does not apply here.
  2. The "saw at least one classified item" flag is separate from the parity accumulator, exactly as in AND and OR; the empty scan is not FALSE.
  3. XOR is associative and commutative over the classified items, so scan order does not affect the value — but it does affect which error surfaces first if more than one error is present. Order is therefore still observable.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

XOR · 1 lines · calc-func/src/catalogue/logical.rs on GitHub
logicals(XOR, "XOR", 254, xor)
xor · 7 lines · calc-func/src/catalogue/logical.rs on GitHub
/// XOR: TRUE when the number of TRUE logicals read is odd, FALSE when it is even.
fn xor(
    arguments: &[CalcValue],
    services: &mut EvalServices<'_>,
) -> Result<CalcValue, FunctionFault> {
    decide(XOR, arguments, services, |tally| tally.trues % 2 == 1)
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
20430Windows, 64-bit, CPU not recorded1,212

The record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.

Recorded environments and comparison details.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

1,212 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.

Alternatives

Relationships

  • OR and XOR agree whenever at most one item is true and diverge as soon as two are.
  • AND is the conjunction over the same scan.
  • XOR was added in Excel 2013; workbooks that must open in earlier versions use MOD(SUMPRODUCT(--(conditions)), 2) = 1 or nested IF chains instead. The Handbook does not treat XOR as a Compatibility-category replacement pair — it supersedes an idiom, not a function.
  • BITXOR is a different function entirely: bitwise exclusive-or on integers, not a logical reduction. Readers searching for "XOR" frequently want that one.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents