XOR Function in Excel: Explained
In this article, you will learn what the XOR formula in Excel does and how to use it.
What does the XOR formula in Excel do?
The XOR function in Excel is a logical function that stands for "exclusive or". It takes one or more logical arguments and returns a logical value of TRUE or FALSE, depending on whether an odd or even number of arguments evaluate to TRUE.
How to use the XOR function in Excel
The syntax of the XOR function in Excel is:
where logical1, logical2, etc. are the logical values or expressions that you want to evaluate.
The function returns TRUE if an odd number of arguments are TRUE, and returns FALSE if an even number of arguments are TRUE.
Note 1: The XOR function can accept up to 255 logical values to compare.
Note 2: The inputs to the formula must evaluate to logical values TRUE or FALSE, or in arrays or references that contain logical values. If the argument contains text or empty cells, those values are ignored. However, If the specified inputs contain no logical values, XOR returns the #VALUE! error value.
XOR function: Case study in real life
Here’s how you can use the XOR function in Real Life
Suppose you are an HR manager and you want to offer your employees a choice between two benefits: a health plan and a retirement plan. However, you want to ensure that each employee can only choose one benefit, not both.
To accomplish this, you can use the XOR function in Excel. The XOR function is a logical function that returns TRUE if only one of the arguments is TRUE, and FALSE if both arguments are either TRUE or FALSE.
In this formula, Column C are the cells containing the TRUE/FALSE value for the Health Plan, and Column D are the cells containing the TRUE/FALSE value for the Retirement Plan. The XOR function evaluates whether only one of these cells contains TRUE. If both cells contain TRUE or both cells contain FALSE, the function returns FALSE. If only one cell contains TRUE, the function returns TRUE.
By using the XOR function in this way, you can ensure that each employee has chosen only one benefit, and avoid any confusion or mistakes that might arise if an employee were to choose both benefits.