XOR Function in Excel – Usage with Examples

In the previous blog, we did the usage of OR Function. The XOR stands for exclusive OR and is very different from the OR Function. The XOR Function in excel is a type of Logical Function.

Let us see how it works!

What is XOR Function in Excel?

The XOR stands for Exclusive Or. It can be explained with the help of an example.

Let us suppose a student has taken IT in class 12th and is now pursuing to go for a specialized course in IT. The student can take either BCA or Bsc in Computer Science or Btech in Computer Science. The result for this condition would be TRUE only if the student chooses any one course out of the three courses. The result will be false if the student chooses more than one course or no course at all.

Syntax and Arguments

=XOR(logical1,[logical2],[logical3],……………)

The following points will explain to you the required function arguments of the XOR Formula in Excel:-

  • logical1 – This can be a condition whose output is a logical TRUE or FALSE. It can be a hardcoded 1 or 0. This argument is mandatory to specify.
  • [logical2] – This argument is the second condition result. The XOR function works perfectly when it is not specified since this is an optional function argument.

The working of the XOR Function can be categorized into two parts.

XOR – When we have Two Conditions Check

Whenever we have the two conditions on which we want to apply the XOR function, it works as follows:-

Output Condition1Output Condition2Output XOR
TRUETRUEFALSE
FALSEFALSEFALSE
TRUEFALSETRUE
FALSETRUETRUE

Here you can see that the XOR returns a TRUE when only one out of the two conditions is returning a Logical TRUE to the Function.

The XOR returns a Logical FALSE when neither or both the conditions return a Logical TRUE to the XOR function.

XOR – when We have More than One Condition

This is the case when we have more than two conditions to apply the XOR formula. The formula returns a logical TRUE when:-

  • The conditions returning a Logical TRUE are odd.

The formula returns a Logical FALSE when:-

  • The total number of conditions returning logical TRUE is even.
  • All the conditions return Logical FALSE
XOR Function in Excel – Usage with Examples

Examples to Learn XOR Function Excel

In this section of the blog, we will be performing some of the practical examples of the XOR Function of excel/

Example 1 – Simplest Example to learn XOR working

In this example, we will supply the direct references containing logical TRUE and FALSE as a function argument to understand the basic functioning of the XOR function.

simplest example of XOR Function in excel

We have used the following formula in cell C2 and then copied the formula down the range C2:C5.

=XOR(A2,B2)

We have supplied the Logical1 and Logical2 arguments to the XOR Function.

XOR returns a logical TRUE only when only one out of the two conditions is TRUE.

The function returns a logical FALSE when both or either none of the conditions is TRUE.

Example 2 – Using XOR with Multiple Conditions

In this example, we will supply the conditions as the Logical Arguments to the XOR formula. We are having more than two conditions checked.

We have used the following XOR formulas and corresponding are the formula results.

XOR Formula example

Column B contains the formula results for the XOR function in Column A.

If we evaluate the conditions specified in the XOR Formulas then:-

XOR Formula example explanation

Here you can see that the formula returns a logical TRUE when the number of Logical TRUE supplied to the XOR Function is Odd.

This brings us to the end of the blog.

Thank you for reading.

Leave a Comment