Xor Function

The XOR function performs what is called “exclusive OR”. With two logical statements, XOR returns TRUE if either statement is TRUE, but returns FALSE if both statements are TRUE. If neither is TRUE, XOR also returns FALSE.

Syntax

The syntax for the XORfunction in Microsoft Excel is:

=XOR( condition1, [condition2], … )

Parameters or Arguments

condition1

The first condition to test whether it is TRUE or FALSE.

condition2, …

Optional. Additional conditions to test whether they are TRUE or FALSE. There can be up to 30 conditions in total.

Xor Function Examples

The following spreadsheet shows six examples of the Excel Xor function.

Formulas:

Results:

Xor Function Errors

#VALUE!

Occurs if none of the conditions supplied to the Xor function evaluate to logical values or numeric values.

#NAME?

Occurs if Excel does not recognise the function name. This is probably because you have an earlier version of Excel, which does not support the Xor function.