Excel XOR Function

This Excel Tutorial demonstrates how to use the Excel XOR Function in Excel to test if one and only one criteria is true, with formula examples.

XOR Function Description:

The XOR Function Checks whether one and only one condition is met. Returns TRUE or FALSE. If no conditions are met, or more than one condition is met, XOR returns FALSE. If only one condition is met, XOR returns TRUE.

Formula Examples:

xor function examples

Example Formula Result
No Conditions Met =XOR(C5 > 5,D5 > 5) False
One Condition Met =XOR(C6 > 5,D6 > 5) True
Two Conditions Met =XOR(C7 > 5,D7 > 5) False
Text – Conditions Met =XOR(C8 =”apples”,D8 > 5) False
Text <> Equal =XOR(C9 <>“pears”,D9 < 5) True

Syntax and Arguments:

The Syntax for the XOR Formula is:

Function Arguments ( Inputs ):

logical1 – Logical expressions. Example: A1 > 4.

Additional Notes

Use the XOR Function to test if one and only one condition is met. Each condition must be a logical expression (ex: a1 >5), a reference to a cell containing TRUE or FALSE, or an array containing all logical values. If one and only one conditions are TRUE, the formula returns TRUE, otherwise it returns FALSE.

XOR is a logical function and is generally used in conjunction with another logical function, IF:
The IF Formula does one thing if a condition is TRUE and does another if a condition is FALSE. Often when using the OR Function you will “nest” it within an IF Function.

You may also want to use these other logical functions:
The AND Function tests if all conditions are met.
OR Formulas test if one or more condition are met.

Return to the List of all Functions in Excel

How to use the XOR Function in Excel:

To use the AND Excel Worksheet Function, type the following into a cell:
After entering it in the cell, notice how the AND formula inputs appear below the cell:
xor formula syntax
You will need to enter these inputs into the function. The function inputs are covered in more detail in the next section. However, if you ever need more help with the function, after typing “=XOR(” into a cell, without leaving the cell, use the shortcut CTRL + A (A for Arguments) to open the “Insert Function Dialog Box” for detailed instructions:
how to use the xor function in excel

For more information about the XOR Formula visit the
Microsoft Website.