XOR is a logical operation that stands for Exclusive OR.

XOR has many uses in programming, but it’s also useful in spreadsheet apps such as Google Sheets.

The XOR function in Google Sheets returns either TRUE or FALSE, depending on the logical operation.

The XOR function in Google Sheets and it’s reaction to different parameters

Syntax of the XOR Function: How Does It Work?

If there is an odd number of true values, then it returns TRUE.

This logical test can be anything, and you might refer to cells in your test as well.

A column of numbers in Google Sheets

In the spreadsheet above, you’ve got the option to see XOR’s reaction to different tests.

For instance, feeding XOR just the number 1 will return TRUE because there is one true statement.

These aren’t tests, so they’re always true.

Using XOR in Google Sheets to determine if a number is above average

Given multiple tests, XOR’s output depends on the number of true statements.

This way, we can use XOR to determine whether a value meets a specific condition or not.

To see that in action, we have a sample spreadsheet here with a column of numbers.

Strings of numbers in Google Sheets

The goal is to determine whether each number is above the total average of the numbers, or not.

If the number is above the average, it will return TRUE, otherwise it will return FALSE.

The formula utilizes both XOR and the AVERAGE function.

Using XOR in Google Sheets to determine whether a string has an odd count of numbers

If the cell is above the average, you’ll have one true statement.

One is an odd number, and thus, XOR will outputTRUE.

Otherwise, it will return FALSE.

Using XOR in Google Sheets to determine the third match of a league

Let’s see this with an example.

In this sample spreadsheet, we have five columns dedicated to strings of numbers.

XOR will now tell you if each string has an odd count of numbers in it or not.

Determining whether the total number of guests is odd or even using XOR in Google Sheets

In the formula,XORlooks through cellsA2toE2.

There are no tests here as we didn’t specify a condition.

XOR will only take in the available numbers in that range and returnTRUEif the number count is odd.

If the count is even, XOR will outputFALSE.

Here are two examples to give you an idea of what these scenarios might look like in real life.

The goal is to determine which teams will do a third match.

If the team has won zero or two matches, XOR outputsFALSEbecause zero and two are both even numbers.

If the team has won only one match, then XOR outputsTRUEbecause one is an odd number.

Since a rectangle has four edges, only an even number of people can evenly sit around it.

If the count is odd, XOR will outputTRUE.

This means that the host will need to use a round dinner table!

Even or Odd?

Otherwise, it returns FALSE.

If you give XOR a single parameter, XOR’s output will be the test results.

But with multiple parameters, the count of true statements will determine XOR’s output.