Formualizer Docs

XOR

Returns TRUE when an odd number of arguments evaluate to TRUE.

XOR aggregates all values and checks parity of truthy inputs.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

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

Arguments

ArgumentTypeRequiredDefault
logical1anyRequired—
logical2anyOptional—

Accepts a variable number of arguments. Minimum: 1.

Return type

Logical (TRUE or FALSE)

Remarks

  • Booleans and numbers are accepted (0 is FALSE, non-zero is TRUE).
  • Text and blank cells inside a reference or array are ignored.
  • A direct text argument produces #VALUE!.
  • The first error in argument order (ranges scanned row by row) is returned.
  • With no logical values at all, the result is #VALUE!.

Examples

Combine one true condition with one false condition.

Formula =XOR(TRUE,FALSE)

Expected result TRUE

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Add a third condition and compare the result.

Formula =XOR(TRUE,TRUE,FALSE)

Expected result FALSE

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Evaluate the logical operation with just one false argument.

Formula =XOR(FALSE)

Expected result FALSE

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A supplied argument evaluates to an error.

Formula =XOR(TRUE,1/0)

Expected result #DIV/0!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Odd count of TRUE values

Formula =XOR(TRUE, FALSE, TRUE, TRUE)

Expected result TRUE

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Text input triggers VALUE error

Formula =XOR(1, "x")

Expected result #VALUE!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

What determines XOR's final result?

XOR returns TRUE when the count of truthy inputs is odd; blanks are ignored.

Implementation

Engine source

On this page