Table of Contents
The XOR function in Google Sheets is a logical function that allows users to compare two values and return a TRUE or FALSE result based on their logical relationship. This function can be used to perform exclusive or operations on binary data. To use the XOR function, simply enter the formula “=XOR(value1, value2)” into a cell, where value1 and value2 are the two values being compared. This function can help users analyze data and make logical decisions in their spreadsheets.
XOR function
The XOR function returns TRUE if an odd number of the provided arguments are logically true, and FALSE otherwise.
Parts of a XOR formula
XOR(logical_expression1, [logical_expression2, ...])
| Part | Description | Notes |
logical_expression1 | An expression or reference to a cell containing an expression that represents some logical value, e.g. “TRUE” or “FALSE,” or an expression that can be coerced to a logical value. | |
logical_expression2 | More expressions or cell references that represent logical values. | A second logical expression, and any additional expressions are optional. |
Sample formulas
XOR(TRUE, FALSE, TRUE)
XOR(A2=TRUE, A3=FALSE)
XOR(A1:A10, B1:B10)
XOR(0, 1, 2, 3)
Notes
- The number 0 is logically false. All other numbers (including negative numbers) are logically true.
- The XOR function accepts both logical value and range parameters.
- Returns TRUE if an odd number of arguments are TRUE.
Examples
| A | B | |
| 1 | Result | Formula |
| 2 | TRUE | =XOR(TRUE()) |
| 3 | FALSE | =XOR(FALSE()) |
| 4 | FALSE | =XOR(0) |
| 5 | TRUE | =XOR(1) |
| 6 | TRUE | =XOR(-3) |
| A | B | C | D | |
| 9 | logical_expression1 | logical_expression2 | Result | Formula |
| 10 | TRUE | FALSE | TRUE | =XOR(A10,B10) |
| 11 | FALSE | FALSE | FALSE | =XOR(A11,B11) |
| 12 | TRUE | TRUE | FALSE | =XOR(A12,B12) |
| 13 | 0 | 1 | TRUE | =XOR(A13,B13) |
| 14 | 1 | 5 | FALSE | =XOR(A14,B14) |
| A | B | |
| 17 | Result | Formula |
| 18 | FALSE | =XOR(A12,B13) |
| 19 | FALSE | =XOR(B11,B12,B13) |
| 20 | TRUE | =XOR(B11,B14) |
Related functions
- OR: The OR function returns true if any of the provided arguments are logically true, and false if all of the provided arguments are logically false.
- AND: The AND function returns true if all of the provided arguments are logically true, and false if any of the provided arguments are logically false.
Cite this article
stats writer (2024). How can I perform the XOR function in Google Sheets?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-perform-the-xor-function-in-google-sheets/
stats writer. "How can I perform the XOR function in Google Sheets?." PSYCHOLOGICAL SCALES, 29 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-perform-the-xor-function-in-google-sheets/.
stats writer. "How can I perform the XOR function in Google Sheets?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-perform-the-xor-function-in-google-sheets/.
stats writer (2024) 'How can I perform the XOR function in Google Sheets?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-perform-the-xor-function-in-google-sheets/.
[1] stats writer, "How can I perform the XOR function in Google Sheets?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I perform the XOR function in Google Sheets?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
