XOR function

This article describes the formula syntax and usage of the XOR function in Microsoft Excel.


Returns a logical Exclusive Or of all arguments.


XOR(logical1, [logical2],…)

The XOR function syntax has the following arguments.

  • Logical1, logical2,…    Logical 1 is required, subsequent logical values are optional. 1 to 254 conditions you want to test that can be either TRUE or FALSE, and can be logical values, arrays, or references.


  • The arguments must evaluate to logical values such as TRUE or FALSE, or in arrays or references that contain logical values.

  • If an array or reference argument contains text or empty cells, those values are ignored.

  • If the specified range contains no logical values, XOR returns the #VALUE! error value.

  • You can use an XOR array formula to see if a value occurs in an array. To enter an array formula, press Ctrl+Shift+Enter.

  • The result of XOR is TRUE when the number of TRUE inputs is odd and FALSE when the number of TRUE inputs is even.


Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.





Because one of the two tests evaluates to True, TRUE is returned.



Because all test results evaluate to False, FALSE is returned. At least one of the test results must evaluate to True to return TRUE.


Top of Page

Applies To: Excel 2016, Excel 2013, Excel Online, Excel 2016 for Mac, Excel for Mac 2011

Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Change language