Exceljet

Quick, clean, and to the point

Excel XOR Function

Excel XOR function
Summary 

The XOR function performs what is called "exclusive OR". With two logical statements, XOR returns TRUE if either statement is TRUE, but returns FALSE if both statements are TRUE. If neither is TRUE, XOR also returns FALSE.

Purpose 
Perform exclusive OR
Return value 
TRUE or FALSE
Syntax 
=XOR (logical1, [logical2], ...)
Arguments 
  • logical1 - An expression, constant, or reference that evaluates to TRUE or FALSE.
  • logical2 - [optional] An expression, constant, or reference that evaluates to TRUE or FALSE.
Usage notes 

The XOR function performs what is called "exclusive OR", as opposed to the "inclusive OR" performed by the OR function. Whereas the OR function returns true if any logical is TRUE, XOR returns TRUE in specific cases . In the simplest case, with just two logical statements, XOR returns TRUE only if one of the logicals is TRUE, not if both logicals are TRUE.

The concept of exclusive OR is more familiar in the world of programing. In plain English, you can think of a sentence like this "I'm either going to visit New York or San Francisco this summer". Nothing prevents me from visiting both, but the meaning is clearly that I plan to visit only one or the other.

With more than 2 logicals

With more than 2 logicals, XOR only returns TRUE when the number of TRUE logicals is odd, as shown in the following example:

XOR with more than two logicals

Notes:

  • Logical arguments must evaluate to TRUE or FALSE, 1 or 0, or be references that contain logical values.
  • Empty references are ignored.
  • XOR returns #VALUE! if no logical values are found.
  • With more than two logicals, XOR returns TRUE when the number of TRUE logicals is odd, and FALSE if not.
  • XOR was introduced in Excel 2013.

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

Excel foundational video course
Excel Pivot Table video training course
Excel formulas and functions video training course
Excel Shortcuts Video Course
Excel Charts video training course
Video training for Excel Tables