XOR Function

XOR returns a logical exclusive OR of all arguments. For two logical statement, XOR returns TRUE if anyone statement is TRUE and return FALSE if both statements are TRUE.

Buddy, we can remember it with simple way: ” one or other is TRUE but not both are TRUE”.

With more than two logical variable XOR returns TRUE if number TRUE logical is odd. And returns FALSE if the number of TRUE logical is even.

Example:

Raw 2 contains 5 (odd value) number of TRUE logical arguments (A2: E2) result in F2 cell is TRUE.

Raw 3 contains 4 (even value) number of TRUE logical arguments (A3: E3) result in F3 cell is FALSE.

XOR example in the practical field.

Let’s consider 3 countries named Australia, Germany & France is playing football for Triangle world cup.

And each country played two matches so far, and the result is as below.

Country who won Game 1 and Game 2 advance to the next round automatically and don’t have to play Game 3.

A country who lost both first games is knocked out and not eligible to play Game 3.

A country who won only one match out of two shall eligible to play Game 3.

XOR in conjunction with IF

With the use of XOR with IF we can have specifically defined value as result.

Here Australia who won first both match will not eligible to play the 3rd game as a predefined condition, hence the result is “No”.

Germany loss both of the matches knock out & not eligible to play the 3rd game hence the result is “No”

France won one match out of two is eligible for the 3rd match, hence the result is “Yes”.