# One or the other not both

=XOR(criteria1,criteria2)

To check two items with exclusive OR (one or the other, but not both), you can use the XOR function. In the example shown, E5 contains the following formula:

=XOR(C5="x",D5="x")

This formula returns TRUE when either coffee or tea have an "x". It returns FALSE if both coffee or team has an "x", or if neither coffee or team has an "x".

### How this formula works

In this example the XOR function contains two expressions, one to test for an "x" in column C, and one to test for an "x" in column D.

C5="x" // TRUE if coffee is "x" D5="x" // TRUE if tea is "x"

With two logical criteria, XOR has a particular behavior, summarized in the table below:

Coffee | Tea | Result |
---|---|---|

TRUE | FALSE | TRUE |

FALSE | TRUE | TRUE |

TRUE | TRUE | FALSE |

FALSE | FALSE | FALSE |

At each row in column E, XOR evaluates values in column C and D and returns a TRUE or FALSE result. This behavior is sometimes referred to as "exclusive OR", meaning only one result can be true.

*Note: with more than two criteria, XOR behavior changes, as explained on the XOR function page.*

## 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.