The XOR Function is a logical function that was introduced in Excel 2013 and later versions. The XOR Function if used with two conditions and one of the conditions evaluates to true, then the XOR Function returns true, this is similar in a way to the standard OR Function in this case. However if both of the conditions evaluate to false, then the XOR Function returns false, and if both of the conditions evaluates to true then the XOR Function returns false. This is where the significant difference in the way conditions are handled, comes into play.

When the XOR Function is used in conjunction with multiple conditions, then true is returned if there is an odd number of true conditions, and false is returned if there is an even number of true conditions.

*Read More: AND Function in MS Excel*

So, let’s get started with a simple example to illustrate how to use the XOR Function

Table of Contents

- 1 Introduction
- 2 Testing Two Conditions when one condition is true the other is false
- 3 Testing Two Conditions when one condition is true the other is true
- 4 Testing Two Conditions when one condition is false and the other is also false
- 5 Evaluating Multiple Conditions
- 6 Testing Four Conditions when one condition is false and the other three are true (an odd number of trues)
- 7 Testing Four Conditions when two conditions are false and the other two are true (an even number of trues)
- 8 Download Working Files
- 9 Conclusion

## Introduction

We are going to use the XOR Function to test conditions in the case where there are two conditions. The source data is shown below.

## Testing Two Conditions when one condition is true the other is false

1) So the first thing we want to do is test the situation where one condition is true and one is false so, in cell A7, we input the following formula:

*=XOR(A5=”Apples”,A6=”Cherries”)*

2) Upon pressing CTRL-ENTER, a value of TRUE is delivered, since the text in A5 was equal to Apples, but the text in A6 was not equal to Cherries. Remember when entering text directly into a formula always use quotation marks.

## Testing Two Conditions when one condition is true the other is true

1) So in this case, the first thing we want to do is test the situation where one condition is true and the other one is true as well so in cell C7, we input the following formula:

*=XOR(C5=”Apples”,C6=”Pears”)*

2) Upon pressing CTRL-ENTER a value of FALSE is delivered, since the text in C5 was equal to Apples, and the text in C6 was equal to Pears. When the XOR Function picks up both conditions out of the two are true it delivers a value of FALSE.

## Testing Two Conditions when one condition is false and the other is also false

1) So in this case, the first thing we want to do is test the situation where one condition is false and the other one is false as well so in cell E7, we input the following formula:

*=XOR(E5=”Oranges”,E6=”Cherries”)*

2) Upon pressing CTRL-ENTER a value of FALSE is delivered, since the text in E5 was equal to Oranges, and the text in E6 was not equal to Cherries. When the XOR Function picks up both conditions out of the two are false it also delivers a value of FALSE.

3) One can step through the formula, by selecting cell E7 and going to Formulas>Formula Auditing>Evaluate Formula, this is especially helpful in the case of the XOR Function.

*Read More: How to Use the CEILING.MATH and the FLOOR.MATH Function in Excel*

## Evaluating Multiple Conditions

We now want to see how the XOR Function handles multiple conditions. The source data is shown below.

## Testing Four Conditions when one condition is false and the other three are true (an odd number of trues)

1) So in this case, the first thing we want to do is test the situation where one condition is false and the other three are true, so in cell A9, we input the following formula:

*=XOR(A5=”Lemons”,A6=”Pears”,A7=”Cherries”,A8=”Oranges”)*

2) Upon pressing CTRL-ENTER a value of TRUE is delivered, since we had one condition that evaluated to false, namely Apples was not equal to Lemons and the other three evaluated to true, therefore the XOR function delivered a value of TRUE since the total number of TRUES was an odd number.

## Testing Four Conditions when two conditions are false and the other two are true (an even number of trues)

1) So in this case, the first thing we want to do is test the situation where two conditions are false and the other two are true, so in cell C9, we input the following formula:

*=XOR(C5=”Lemons”,C6=”Limes”,C7=”Cherries”,C8=”Oranges”)*

2) Upon pressing CTRL-ENTER a value of FALSE is delivered, since we had one condition that evaluated to false, namely Apples was not equal to Lemons and another condition that also evaluated to false namely Pears was not equal to Limes and the other two conditions evaluated to true, therefore the XOR function delivered a value of FALSE.

And there you have it.

*Read More: How to Use the FORMULATEXT Function in Excel*

## Download Working Files

## Conclusion

The XOR Function is a logical function which can be a bit tricky to master at first, but once you practice and get the hang of it, it becomes easier to understand. The XOR Function has uses in certain sports industries and in the computer science domain.

Please feel free to comment and tell us if you use the XOR Function in your spreadsheets.