HomeGoogle DocsSpreadsheetHow to Use the XOR Function in Google Sheets

How to Use the XOR Function in Google Sheets [Logical Function]

Published on

The XOR logical function is now part of Google Sheets. Learn the use of XOR function in Google Sheets and its difference with the logical OR function.

Google has silently added the XOR logical function in its cloud-powered Spreadsheet application called Google Sheets.

Google is doing everything possible to make this already powerful and popular Spreadsheet application more acceptable to users.

You can use XOR formula in Google Sheets to perform an exclusive OR. What does it mean by exclusive OR which is also called as EOR?

See the examples below to understand this. Take a look at the Syntax and jump to the examples.

XOR(logical_expression1, [logical_expression2, ...])

How to Use the XOR Function in Google Sheets

To understand the use of XOR in Google Doc Sheets, you should know what is exclusive OR.

See is one example. Here are the values of two cells.

A1 = 5

A2 = 20

Formula:

=xor(A1=10,A2=20)

Result: TRUE

Change the value in A1 to 10. You can see that the above same formula returns FALSE. Why so?

XOR Returns TRUE if an odd number of arguments are TRUE

To make you understand this better, I have included more logical tests below.

Here are few more XOR formula examples that explain to you what is the odd number of arguments are true in the XOR function.

examples to xor logical function in google sheets

See the formulas in column E. Just count the TRUE in each of the formulas.

In all the formulas the number of TRUE arguments is odd and since all of the formulas return TRUE.

The difference of XOR Function with OR in Google Sheets

If you replace XOR with the OR function in all of the above formulas the result would be the same.

The OR function doesn’t differentiate whether the total number of logical expression TRUE is odd or even. It only tests if any of the provided arguments are logically true.

I have the number 5 in cell A1, B1, C1 and D1. See the two formulas below.

=or(A1=5,B1=5,C1=5,D1=5)

Result: TRUE

=xor(A1=5,B1=5,C1=5,D1=5)

Result: FALSE

Here the XOR formula returns FALSE since even number of arguments is the TRUE. Refer to this Docs Editors help article for more info.

I don’t have any real-life example to share with you related to the use of XOR in Google Sheets. But I suggest you go through this XOR Gate Wikipedia article to get some insight about the practical use.

Hope this tutorial could help you to learn how to use the XOR Function in Google Sheets.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.