What does XOR mean and how to use the XOR function in Microsoft Excel? The XOR function is a logical function that will result in a positive (TRUE) or negative (FALSE) answer. You can add up to 254 conditions in its Boolean formula. Other Boolean functions in Excel are AND, OR and IF.
The syntax of the XOR function in Excel is =XOR(logical1,[logical2],…).
Ready to learn how to use the XOR function? Discover more information about this handy function in MS Excel below.
What does XOR mean?
XOR means Exclusive (“X“) OR: the XOR function returns a logical Exclusive OR of all arguments.
What is the XOR formula in Excel?
The XOR syntax is =XOR(logical1,[logical2],…).
The first logical argument is required and you can add up to 254 conditions in the XOR function. The result of XOR will be TRUE or FALSE.
Notes
– The result of XOR is TRUE when the number of TRUE inputs is odd (numbers that cannot be divided entirely by 2).
– The result of XOR is FALSE when the number of TRUE inputs is even (numbers that can be divided entirely by 2).
– If none of the arguments are TRUE, the result of XOR will be FALSE.
– In Excel, the arguments must result in logical values or those values will be ignored by the system.
– If you need to mention a text element in a logical argument, use quotation marks: “text“. If you forget to do so, you will end up with an error: NAME?. The formula is not case sensitive.
Examples
XOR function in Excel with 2 values
In this example, we want to find clients who subscribed to our newsletter or who made less than 5 orders with us during the year, in order to send them a promotional code.
The XOR formula we use is =XOR(B22=”yes”,C22<5).
Ted is a subscriber (the first argument) but did not order less than 4 times with us: XOR result is TRUE because only 1 (odd number) logical value is TRUE.
Jordan is a subscriber (first argument) and ordered less than 5 times this year: XOR result is FALSE because 2 (even number) logical values are TRUE.
Marie is not a subscriber (first logical value is FALSE) and ordered 7 times with us this year (second logical value is FALSE): XOR result is FALSE because none of the arguments are TRUE.
XOR function in Excel with 3 values or more
Be careful when you use more than 2 logical values in the XOR formula!
We are using 3 logical arguments in the XOR function for this example:
1. Did the client make a purchase in Q1?
2. Did the client make a purchase in Q2?
3. Did the client make a purchase in Q3?
The XOR formula we use is =XOR(B22>0,C22>0,D22>0).
If the result of XOR is TRUE, it means the client ticks 1 or 3 of the arguments (like Marie who made 3 orders or David who made 1).
If the result of XOR is FALSE, it means the client ticks 0 or 2 of the arguments (like Ted who made 2 orders or Lisa who made 0).
Use the OR statement formula if you want to know if at least 1 argument is TRUE: =OR(B22>0,C22>0,D22>0).
Now, you know what XOR means and how to use the XOR function in Excel worksheets.
Depending on your situation, you might need to use other logical functions like IF or OR in Excel. We will cover these useful functions in other articles.
Master Microsoft Excel easily by checking more of our tutorials!