**Excel XOR Function** **(Table of Contents)**

## XOR Function in Excel

**XOR** Functions in Excel performs “Exclusive OR”. This functions with two logical statement return one value. If both the statements are TRUE, then the result will be FALSE; if any of the statement is TRUE, then the result will be TRUE.

### How to use XOR Function in Excel?

**XOR** function in excel can be accessed from option besides **formula bar** with an icon.

Let’s understand how to use XOR Function in Excel by using some examples.

#### XOR Function in Excel – Example #1

Here we have a table below, wherein columns A and B have some logical values as **0** and **1,** and on that basis, we need an exclusive answer or result. The result will be in the combined results of both logical values. And the result will always be in the combination of **TRUE** or **FALSE**.

Now to apply XOR Function in excel, go to the cell where we need to see the result. Now go to the **Home** menu and besides the formula bar, click on the F**unction** option with an icon as shown below.

Once we do that, we will get an Insert Function box. Now in **Or Select a category** option, look for **Logical** functions, or else select **All** from the drop-down list. And click on **OK**.

Or else, if the category of required function is unknown, then Search for a function box. We can search the function **XOR** with its keyword and click on **Go**. We will get a possible function below of the category list drop-down, as shown below. Then click on **OK**.

As we can see above, at the bottom of the box, which is highlighted, it has the complete syntax of the selected function from the above list. If the function is completely new, then with the help of syntax in **the Insert** Function box, we can perform the function.

Once we click on **OK**, we will see an argument box of a selected function; as we can see, as per syntax, it is asking logical values as input. We can select any number of logical values.

Here, we have selected cells A2 and B2 as our input cells. Once we do that, we will get the suggested result in the argument box itself at the bottom of the box, as shown below. This shows the correctness of our syntax. After that, click on OK.

Now drag the formula or apply it to all the selected cells. As we can see below, we got an Exclusive-OR value with the help of two logical values.

The logic is simple.

- For two
**POSITIVE**logics, we will get**FALSE**. - For two
**NEGATIVE**logics, we will get**FALSE**. - If either of them is
**POSITIVE**, we will get**TRUE**.

This can be applied to any situation where logic is **POSITIVE** and **NEGATIVE**.

#### XOR Function in Excel – Example #2

There is one more method of executing the XOR function in excel, which is an easy way. For that, let’s consider a new data set as shown below. This is a combination of TRUE and FALSE Logics.

To execute XOR Function in excel, go to the cell where we want to see the result and type **= (Equal)** to edit that cell’s edit mode. Once we do that, type or search XOR and select the function as shown below. And we will see the suggested syntax of the selected function as well, which is boxed in the below screenshot.

Now select the logical input cells. It can be in any number. Here, we will select cells A2 and B2 as shown below and press enter to execute the formula. If the syntax is incorrect, then we will get an error.

Once done, drag the formula or syntax in all the related cells as shown below.

As we can see in the above image, for logic 1 and logic 2, we got the result in column C., And the logic is completely simple, as it was already explained in Example 1.

#### XOR Function in Excel – Example #3

Now let’s see an example where we will have 2 logics in the combination of “1” and “2”, as shown below.

Now for executing XOR for this example, select the cell where we want to see the output and type **=** **(Equal)** sign to enable all the functions of excel and select XOR from the list down as shown below.

Here, we will use the condition of greater than and less than among 1 and 2. Use the combination where 1>0 or 1<0 and same with 2>0 or 2<0 as shown below.

In the above screenshot, we have used 3 conditions where we showed what will be the results if 1 and 2 are greater and less than 0 respectively in a different combination,s and below is the actual result.

As we can see above;

- For the 1
^{st}condition, where either of one is true, we got TRUE. - For the 2
^{nd }condition, where both are true logic, we got FALSE. - For the 3
^{rd}condition, where either of one is true, we got TRUE, same as Example 1.

**Pros**

- It is widely used in electronic circuit design for defining the logic before implementation.
- It can be used anywhere, where we see 0/1, Yes/No, Win/Lose or True/False kind of situation.
- It gives the result on the basis of 2 logics only and that 2 logic can repeat any number of times, in any number of cells.

**Cons**

- The logic building process sometimes gives the opposite results. So framing correct syntax is necessary.

### Things to Remember

- Make sure you are clear with the logic and the kind of result required.
- If there is text logics used, then use inverted commas quotes (” “) to convert texts into value as text cannot be taken directly in any excel function.
- Built the logic before using XOR so that when we are actually applying XOR, we will be able to imagine the actual logic with results.

### Recommended Articles

This has been a guide to XOR Function in Excel. Here we discussed Using XOR Function in Excel and practical examples and a downloadable excel template. You can also go through our other suggested articles –

16 Online Courses | 23 Hands-on Projects | 140+ Hours | Verifiable Certificate of Completion

4.8

View Course

Related Courses