You all must have used AND and OR logical functions in Excel so far. Now there’s a new function XOR (Exclusive OR).
This logical function basically states that whenever you compare multiple conditions –
- If all the conditions are TRUE or FALSE, output will be FALSE
- If any 1 condition out of all of them is TRUE and others are FALSE, output will be TRUE.
The syntax of the function is =XOR (logical1, [logical2], …)
Let’s see a practical example of this: –
- You have 2 numbers 25 and 50 in cells A1 and B1 respectively.
- In A3, you write the formula =XOR (A1>B1, B1>A1).
- In A4, you write the formula =XOR (A1>B1, B1<A1).
- In A5, you write the formula =XOR (A1<B1, B1>A1).
- In A6, you write the formula =XOR (A1<B1, B1<A1).
Below is the output that you will get: –
This clearly shows that whenever all your conditions are either TRUE or FALSE, your output will be FALSE; and when even any 1 of the conditions is TRUE, output will be TRUE.
Now use this in an =IF formula.
Enjoy Excel-ling with XOR!