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 column 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 Home menu and besides formula bar, click on Function 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 the most 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 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.
4.8 (1,893 ratings)
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 cell A2 and B2 as our input cells. Once we do that, we will get the suggested result in 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, with the help of two logical values, we got an Exclusive-OR value.
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 POSTIVE, 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 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 go in edit mode of that cell. Once we do that, type or search XOR and select the function as shown below. And we will see the suggested syntax of selected function as well which is boxed in 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 function 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 different combination and below is the actual result.
As we can see above;
- For the 1st condition, where either of one is true, we got TRUE.
- For the 2nd condition, where both are true logic, we got FALSE.
- For the 3rd condition, where either of one is true, we got TRUE, same as Example 1.
- 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.
- 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.
This has been a guide to XOR Function in Excel. Here we discussed How to use XOR Function in Excel along with practical examples and downloadable excel template. You can also go through our other suggested articles –