Check Sheet Logo
Check Sheet

XOR

The XOR function in Google Sheets returns TRUE if an odd number of the provided logical expressions are TRUE, and FALSE if an even number of the provided expressions are TRUE. It is commonly used in boolean algebra and logic circuits to perform exclusive disjunction. The XOR function takes 1 to 255 logical expressions as input.

Usage

Use the XOR formula with the syntax shown below, it has 1 required parameter and 1 optional parameter:

=XOR(logical_expression1, [logical_expression2, ...])
Parameters:
  1. logical_expression1 (required):
    The first logical expression to evaluate.
  2. logical_expression2, ... (optional):
    Additional logical expressions to evaluate. Up to 255 expressions can be provided.

Examples

Here are a few example use cases that explain how to use the XOR formula in Google Sheets.

Checking for odd occurrences

You can use XOR to check if a specific number of conditions are met. For example, if you have a list of tasks and you want to check if an odd number of them are completed, you can use XOR to easily determine that.

Toggling between two values

You can use XOR to toggle between two values. For example, if you have a cell that contains either 'Yes' or 'No', you can use XOR to toggle between the two values every time a certain condition is met.

Validating data

You can use XOR as part of a data validation formula to ensure that only one of two options is selected. For example, if you have a drop-down list with 'Male' and 'Female' options, you can use XOR to ensure that only one of the options is selected.

Common Mistakes

XOR not working? Here are some common mistakes people make when using the XOR Google Sheets Formula:

Using the wrong number of arguments

The XOR formula requires at least two arguments to be evaluated. If you provide only one argument, the formula will return an error. If you provide an even number of arguments, the formula will always return FALSE.

Mixing data types

The XOR formula only works with logical expressions. If you mix logical expressions with other data types like text or numbers, the formula will return an error. Make sure that all the arguments you provide to the formula are logical expressions.

The following functions are similar to XOR or are often used with it in a formula:

  • AND

    The AND function in Google Sheets is a logical function that returns TRUE if all of the logical expressions in the argument are TRUE, and FALSE if any of the logical expressions are FALSE. It can be used to test multiple conditions and evaluate whether they are all true or not.

  • OR

    The OR formula is a logical formula that returns TRUE if at least one of the provided logical expressions is TRUE. It returns FALSE if all logical expressions are FALSE. This formula is commonly used in conjunction with other logical formulas, such as AND, to build more complex logical statements.

  • NOT

    The NOT formula in Google Sheets is a logical function that negates a given logical expression. If the logical expression evaluates to TRUE, the formula returns FALSE, and vice versa. This function is commonly used to reverse the result of a logical test, or to check if a value is not equal to a specific criteria.

  • IF

    The IF formula is a logical function used to test a condition and return one value if the condition is true and another value if the condition is false. It is commonly used to create conditional statements and perform calculations based on certain conditions.

  • IFERROR

    The IFERROR formula is used to check whether a specified value results in an error or not. If the value results in an error, then it returns a user-specified value instead of the error. This function is commonly used to prevent errors from breaking a formula or to replace error messages with custom messages.

Learn More

You can learn more about the XOR Google Sheets function on Google Support.