Go Back

Excel XOR Function

The XOR function defines exclusive OR. The XOR function in Excel provides a different result for different states. When there are two statements and one of them is TRUE, XOR gives a TRUE. Again if both are TRUE, the outcome will be FALSE. If none of the statements is TRUE, XOR will be FALSE. In this tutorial, we will learn how to use the XOR function in Excel.

Figure 1. Example of How to Use the XOR Function in Excel



  • Logical1
    This value is required. This value can be an expression, constant, or reference. This could be either FALSE or TRUE.
  • [Logical2…]|
    This value is optional. It can be a same expression, constant, or reference like Logical1.

The XOR Function in Excel

Exclusive OR is used in programming. People use this in coding.

The main purpose of the XOR function is to apply exclusive OR. This formula returns only TRUE or FALSE.

The XOR function is based on the OR function. The value comes in TRUE or FALSE in different logic. For example, suppose there are two statements. The XOR will return TRUE if one of the logic is TRUE. But if both of them are TRUE, the result will not be the same.

Setting Up Data

The following data set contains some logical values. They are in column A and B.

Figure 2. The Sample Data Set

To find the exclusive or using in column C using XOR:

  • We need to select cell C2.
  • Assign the formula =XOR (A2, B2) to cell C2.
  • Press Enter.
  • Drag the formula from cells C2 to C6 using the fill handle in the bottom right to copy the formula to the entire column.

Figure 3. Example of Applying the XOR Function

This will show the result  of the exclusive OR in column C.


  • The outcomes of exclusive OR will be either TRUE or FALSE. There will be no other outcome.
  • This function does not consider blank references.
  • The values which are imputed in the function has to be logical. Otherwise, the outcome will show #VALUE!
  • XOR will only work in Excel 2013 and later versions.
  • When the TRUE logical has an odd number, XOR will return TRUE. Otherwise, it will will be FALSE.

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

logical formula and or xor need help on spreadsheet
Solved by D. J. in 26 mins
Struggling with understanding the why and finding an example of an application for XOR in Excel with 3 or more conditions and why an odd number = true and an even number = false. There are plenty of explanations with two conditions and I get that but what I can't seem to find is anyone to say WHY it is true for an odd number and why false for an even when there are more than 2 conditions... HELP!!
Solved by I. A. in 22 mins

Leave a Comment