Warning: This site requires the use of scripts, which your browser does not currently allow. See how to enable scripts.

# XOR function

This article describes the formula syntax and usage of the XOR function (function: A prewritten formula that takes a value or values, performs an operation, and returns a value or values. Use functions to simplify and shorten formulas on a worksheet, especially those that perform lengthy or complex calculations.) in Microsoft Excel.

## Description

Returns a logical Exclusive Or of all arguments.

## Syntax

XOR(logical1, [logical2],…)

The XOR function syntax has the following arguments.

**Logical1, logical2,…**Logical 1 is required, subsequent logical values are optional. 1 to 254 conditions you want to test that can be either TRUE or FALSE, and can be logical values, arrays, or references.

## Remarks

- The arguments must evaluate to logical values such as TRUE or FALSE, or in arrays (array: Used to build single formulas that produce multiple results or that operate on a group of arguments that are arranged in rows and columns. An array range shares a common formula; an array constant is a group of constants used as an argument.) or references that contain logical values.
- If an array or reference argument contains text or empty cells, those values are ignored.
- If the specified range contains no logical values, XOR returns the #VALUE! error value.
- You can use an XOR array formula to see if a value occurs in an array. To enter an array formula, press Ctrl+Shift+Enter.
- The result of XOR is TRUE when the number of TRUE inputs is odd and FALSE when the number of TRUE inputs is even.

## Example

The workbook below shows examples of this function. Inspect them, change existing formulas, or enter your own formulas to learn how the function works.

To work more in-depth with the example data in Excel, download the embedded workbook to your computer, and then open it in Excel.

Applies to:

Excel 2013, Excel Online