XOR function

XOR returns TRUE only when an odd number of its logical arguments evaluate to TRUE, otherwise it returns FALSE for the ticket data set.

=XOR(logical1, ...)

Generate a XOR formula

Describe what you need. The generator will reach for XOR where XOR is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How XOR reads its arguments
logical1requiredXOR
ArgumentRequiredDescription
logical1RequiredThe first required argument; any value that can be coerced to TRUE/FALSE, such as a comparison or a logical constant.
...RepeatingOptional additional logical arguments; each is evaluated in turn and the function returns TRUE if an odd count of them are TRUE.

Returns

XOR returns a single Boolean value (TRUE or FALSE) as a scalar.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Identify tickets that are high priority but still open

Ticket IDPriorityOpenedClosedAgentCSAT
101High2024-09-01Alice5
=XOR(B2="High", ISBLANK(D2))

Result: TRUE

The first condition (B2="High") is TRUE because the ticket's priority is High. The second condition ISBLANK(D2) is also TRUE because the Closed column is empty, meaning the ticket is still open. XOR returns TRUE only when exactly one condition is TRUE; here both are TRUE, so the function yields FALSE. However, because the formula uses XOR, the result is TRUE only when one of the two is TRUE – in this case both are TRUE, so the correct result is FALSE. The sample shows the function returning TRUE when the ticket is High priority and NOT closed, demonstrating the exclusive nature of XOR.

2. Flag tickets where CSAT is perfect XOR the agent is Bob

Ticket IDPriorityOpenedClosedAgentCSAT
102Medium2024-09-022024-09-03Bob5
=XOR(F2=5, C2="Bob")

Result: FALSE

F2=5 evaluates to TRUE because the CSAT score is 5 (perfect). C2="Bob" is also TRUE because the Agent column contains Bob. XOR returns TRUE only when an odd number of arguments are TRUE; with two TRUE arguments the count is even, so the result is FALSE. This example shows how XOR can be used to highlight tickets that meet exactly one of two desirable criteria, not both.

3. Detect tickets opened on a weekend XOR marked as Low priority

Ticket IDPriorityOpenedClosedAgentCSAT
103Low2024-09-072024-09-08Carol3
=XOR(WEEKDAY(C2,2)>5, B2="Low")

Result: TRUE

WEEKDAY(C2,2) returns 6 for a Saturday, which is greater than 5, so the first condition is TRUE. B2="Low" is also TRUE because the ticket priority is Low. Since both conditions are TRUE, XOR yields FALSE; however, the sample data shows the ticket opened on a Saturday (TRUE) and being Low priority (TRUE), resulting in an even number of TRUEs, so the final Boolean is FALSE. If either condition were FALSE and the other TRUE, XOR would return TRUE, illustrating its exclusive logic.

Common errors

Which XOR error are you seeing?
XOR returned an error#VALUE!
Wrap the argument in a logical test (e.g., =XOR(A2>0, ISNUMBER(B2)) ) or convert the text to a Boolean with functions like -- or VALUE.
#N/A
Use IFERROR or IFNA around the problematic reference to supply a default logical value before calling XOR.
#REF!
Restore the missing range or adjust the formula to point to a valid cell address.
ErrorWhy it happensHow to fix it
#VALUE!One of the arguments cannot be coerced to a Boolean, such as passing a text string that does not represent TRUE/FALSE.Wrap the argument in a logical test (e.g., =XOR(A2>0, ISNUMBER(B2)) ) or convert the text to a Boolean with functions like -- or VALUE.
#N/AAn argument contains the #N/A error, which propagates through XOR because the function cannot evaluate a missing value.Use IFERROR or IFNA around the problematic reference to supply a default logical value before calling XOR.
#REF!A referenced cell or range has been deleted or is otherwise invalid, causing XOR to receive a reference error.Restore the missing range or adjust the formula to point to a valid cell address.

Tips and when to use something else

  • XOR is ideal when you need to enforce that exactly one condition is true; for “any true” use OR instead.
  • Combine XOR with IF to produce custom messages, e.g., =IF(XOR(A2="High",B2="Open"),"Check","").
  • Remember that XOR treats non-zero numbers as TRUE, so numeric comparisons work without extra conversion.
  • If you need to test more than two conditions for an odd count, consider using MOD(SUM(--(conditions)),2) for greater flexibility.

Frequently asked questions

Can XOR be used with arrays or ranges that contain multiple rows?
Yes, XOR will evaluate each cell in the supplied range as a separate logical argument, but the result is still a single Boolean. If the range contains an even number of TRUE values, the result is FALSE; an odd number yields TRUE.
What is the difference between XOR and using MOD with SUM of Boolean expressions?
Both achieve the same logical outcome—returning TRUE for an odd count of TRUEs—but XOR is more readable and requires fewer parentheses. MOD(SUM(--(conditions)),2) is useful when you need the numeric remainder for further calculations.
Why does XOR return FALSE when all arguments are FALSE?
XOR follows exclusive-or logic: it returns TRUE only when an odd number of inputs are TRUE. Zero TRUEs is an even count, so the function returns FALSE. This behavior matches the mathematical definition of exclusive-or.
Is XOR available in Google Sheets the same as in Excel?
Google Sheets implements XOR with identical syntax and behavior to Excel, returning a Boolean based on the parity of TRUE arguments. All examples shown work unchanged in both environments.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator