How to use XOR function in Excel?

The XOR (exclusive or) function in Excel is used to compare two or more logical statements. The XOR function returns TRUE if an odd number of the arguments evaluate to TRUE. If the number of TRUE statements is even, XOR returns FALSE.

Here’s a step-by-step guide on how to use the XOR function in Excel:

  • Open Excel: Start Excel and open the worksheet where you want to use the XOR function.
  • Select a Cell: Click on the cell where you want the result of the XOR function to appear.
  • Enter the XOR Formula: Start typing the formula, beginning with an equal sign (`=`), followed by `XOR(`.
  • Specify Logical Arguments: Inside the parentheses, input the logical comparisons or conditions you want to evaluate. Each argument should be a logical test or a reference to a cell that contains a logical value (TRUE or FALSE).
    • Example with cell references: `=XOR(A1, B1, C1)`
    • Example with logical tests: `=XOR(A1 > 10, B1 < 5, C1 = 20)`
  • Close Parentheses: Ensure to close the parenthesis to complete the function: `=XOR(logical1, [logical2], …)`
  • Press Enter: After completing the formula, press Enter. Excel will evaluate the function and display TRUE or FALSE based on the conditions.

Example

  • Suppose `A1` contains TRUE, `B1` contains FALSE, and `C1` contains TRUE. If you enter `=XOR(A1, B1, C1)` in another cell, the result will be FALSE because there are 2 (an even number) TRUE values.

Remember:

  • XOR takes a minimum of one argument. However, to be meaningful, you generally need two or more.
  • If all arguments evaluate to FALSE, XOR returns FALSE.
  • XOR can handle up to 255 logical conditions or references in Excel.

This function is particularly useful in scenarios where you need to assert that only one or an odd number of conditions are true among many.

Unlock Your Potential

Excel

Basic - Advanced

Access

Access Basic - Advanced

Power BI

Power BI Basic - Advanced

Help us grow the project