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.

Excel: Month Name to Number & Number to Name

This tutorial showcases the most efficient formulas for converting a month name to a...

Get the First or Last Row/Column in a New Google Sheets Table

If you've recently started using the new Google Sheets TABLE functionality, you may find...

UNIQUE Function in Visible Rows in Google Sheets

The UNIQUE function doesn't inherently include only visible rows when it returns values, discarding...

Customizing Alternating Colors of a Table in Google Sheets

Google Sheets' new table feature offers limited options for customizing colors. While you can...

More like this

Get the First or Last Row/Column in a New Google Sheets Table

If you've recently started using the new Google Sheets TABLE functionality, you may find...

UNIQUE Function in Visible Rows in Google Sheets

The UNIQUE function doesn't inherently include only visible rows when it returns values, discarding...

Customizing Alternating Colors of a Table in Google Sheets

Google Sheets' new table feature offers limited options for customizing colors. While you can...

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.