XOR Function in Excel

Hello all. In this short tutorial let’s look at the XOR (exclusive OR) function. XOR is a logical function that check two or more logic and return TRUE or FALSE value. If either of the condition is true, the function returns TRUE. The function returns FALSE if both the condition is true or neither of them are true. If more than 2 conditions, the function returns TRUE when the number of true logic is ODD.

Syntax

=XOR(logical1, [logical2],..)

Let’s look at the below example. The below data set has score cards for students across 2 x terms. We are trying to extract distinction flag if the student had scored >80 in one of the terms.

Here, we used IF condition to return Yes or No values for the TRUE or FALSE argument the XOR would return. Did you notice something here? The check is correct for Rahul, Virat, Sourav & Anil. However, for Sachin, the result is wrong. Sachin scored >80 in both the terms still couldn’t get distinction – remember XOR returns FALSE if both the conditions are true?

Let’s look at the example with >2 conditions. Same table, however, with the third term

Here, we have all our results as we want. We have number of true conditions as ODD numbers in all the rows and hence our results are correct.

I hope you liked this short tutorial. Please provide us with your valuable feedback. Thanks for reading.