Excel XOR Function
XOR Function
TheXOR function is a premade function in Excel, which returnsTRUE orFALSE based on two or moreconditions.
Note: The XOR function is often used together with theIF function.
It is typed=XOR:
Theconditions are referred to as[logical1],[logical2], and so on.
The conditions can check things like:
- If a number isgreater than another number
> - If a number issmaller than another number
< - If a number or text isequal to something
=
For two conditions, you can think of the XOR function as:"either thisor that, butnot both"
Note: The different parts of the function are separated by a symbol, like comma, or semicolon;
The symbol depends on yourLanguage Settings.
Example XOR Function
Check if the Pokemon type is either Fire typeOR has HPless than 60, butnot both:
The function returns "TRUE" or "FALSE".
ExampleXOR function, step by step:
- Select the cell
D2 - Type
=XOR - Double click theXOR command

- Specify the first condition
B2="Fire" - Type
, - Specify the second condition
C2<60 - Hit enter
Note: You can add more conditions by repeating steps 5-6 before hitting enter.
The XOR function returns "TRUE" if anodd number (1,3,5,..) of conditions areTRUE.

Since the value in cellB2 is not "Fire" the first condition isFALSE.
Since the value in cellC2 is less than 60 the second condition isTRUE.
For two conditions,only one condition should to beTRUE for the XOR function to returnTRUE.
Note: Text values needs to be in quotes: " "
The function can be repeated with thefilling function for each row to perform the same check for each Pokemon:

Now, each row has a check for Fire Typeor HP less than 60, butnot both:

For example:
- Ivysaur isnot Fire type, but it also does not haveless than 60 defense, so the function returns "FALSE".
- Charmeleonis Fire type, and hasless than 60 defense, so the function returns "FALSE"
- Wartortle isnot Fire type, but hasless than 60 defense, so the function returns "TRUE"
Example XOR Function (with IF)
Combining the XOR function with anIF function lets you checkmultiple conditions for the IF function:
Note: The IF function lets you specify the return values.
The IF function is typed=IF and has 3 parts:
The XOR function takes the place of thelogical_test condition.
Here, theIF function returns "Yes" or "No".
ExampleXOR function as the condition forIF function, step by step:
- Select cell
C2 - Type
=IF - Double click theIF command

- Type
XOR - Double click theXOR command

- Specify the first condition
B2="Fire" - Type
, - Specify the second condition
C2<60 - Type
), - Specify the value
"Yes"for when just one condition isTRUE - Type
, - Specify the value
"No"for when both areFALSE, orTRUE at the same time - Type
)and hit enter

The function can be repeated with thefilling function for each row to perform the same check for each Pokemon:

Now, each row has a check for Water Typeor Defense greater than 60, butnot both:

For example:
- Ivysaur isnot Fire type, but it also does not haveless than 60 defense, so the function returns "No".
- Charmeleonis Fire type, and hasless than 60 defense, so the function returns "No"
- Wartortle isnot Fire type, but hasless than 60 defense, so the function returns "Yes"


