This website uses Cookies. Click Accept to agree to our website's cookie use as described in our Privacy Policy. Click Preferences to customize your cookie settings.

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Airtable Community
- Discussions
- Ask A Question
- Formulas
- How to use a XOR formula with 3 and 5 arguments (w...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Topic Labels:
Formulas

Solved

Jump to Solution

0
1968
5

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Comment Post Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 30, 2020 01:38 AM

Hi, how to use a XOR formula with 3 and 5 arguments (with real world use cases)? I’m trying to understand how i can apply this in real life

Solved! Go to Solution.

1 Solution

Accepted Solutions

Solved
See Solution in Thread

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 30, 2020 09:36 AM

Usually XOR is used when building circuits or other computations.

The one-hot meaning is most common in regular life. For example, when ordering at a restaurant, there might be a choice of multiple entrees, but you can choose only one entree.

The parity meaning in regular life is better understood in terms of a series of transactions. Suppose your order a product online, then decide to cancel the order, then decide to cancel the canceling. In that case, the two “cancels” would cancel each other out, and your original order would stand. In the “Bill and Ted Excellent Adventure” series of movies, the quote "That Was Non-Non-Non-Non-Heinous!” also uses the parity meaning. Every “non-non-” pair drops out, so an even number of “non-”'s means that the thing was heinous, but an odd number of “non-”'s means that the thing was actually good.

If this answers your question, please mark this post as the solution. Otherwise, could you please give a bit more details and a screen capture?

Reply

5 Replies 5

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 30, 2020 08:37 AM

How do you want to define XOR for multiple inputs?

- true only if an odd number of inputs is true (parity)
- true only if one of the set is true (one-hot)

In this case, sum the number of true inputs, and see if the result is odd.

```
IF(
MOD(
IF(Case1, 1) + IF(Case2, 1) + IF(Case3, 1),
2
),
"true",
"false"
)
```

For five inputs, add more `IF`

functions to the sum.

```
IF(
MOD(
IF(Case1, 1) + IF(Case2, 1) + IF(Case3, 1) + IF(Case4, 1) + IF(Case5, 1),
2
),
"true",
"false"
)
```

Check the cases where one input is true and the rest are false.

Three inputs:

```
IF(
OR(
AND(Case1, NOT(Case2), NOT(Case3)),
AND(NOT(Case1), Case2, NOT(Case3)),
AND(NOT(Case1), NOT(Case2), Case3)
),
"true",
"false"
)
```

For five inputs, continue the pattern.

```
IF(
OR(
AND(Case1, NOT(Case2), NOT(Case3), NOT(Case4), NOT(Case5)),
AND(NOT(Case1), Case2, NOT(Case3), NOT(Case4), NOT(Case5)),
AND(NOT(Case1), NOT(Case2), Case3, NOT(Case4), NOT(Case5)),
AND(NOT(Case1), NOT(Case2), NOT(Case3), Case4, NOT(Case5)),
AND(NOT(Case1), NOT(Case2), NOT(Case3), NOT(Case4), Case5)
),
"true",
"false"
)
```

If this answers your question, please mark this post as the solution. Otherwise, could you please give a bit more details and a screen capture?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 30, 2020 09:08 AM

Thanks @kuovonne!

This clears up the logic of the formula :grinning_face_with_big_eyes:

However what is a real life use case for 3 arguments and 5 arguments? I’m trying to understand when I would ever use this formula in real life.

Usually if I want to compare 3 or 5 arguments, I would want control flow over them. Eg if first argument is true, then do this for the second etc.

However XOR is like so random. So long as odd number is true then it’s true. It’s so strange (or rather I’ve never come across a real life use case)

Could you give me an example when I would use XOR? Thank you!!

Solved
See Solution in Thread

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 30, 2020 09:36 AM

Usually XOR is used when building circuits or other computations.

The one-hot meaning is most common in regular life. For example, when ordering at a restaurant, there might be a choice of multiple entrees, but you can choose only one entree.

The parity meaning in regular life is better understood in terms of a series of transactions. Suppose your order a product online, then decide to cancel the order, then decide to cancel the canceling. In that case, the two “cancels” would cancel each other out, and your original order would stand. In the “Bill and Ted Excellent Adventure” series of movies, the quote "That Was Non-Non-Non-Non-Heinous!” also uses the parity meaning. Every “non-non-” pair drops out, so an even number of “non-”'s means that the thing was heinous, but an odd number of “non-”'s means that the thing was actually good.

If this answers your question, please mark this post as the solution. Otherwise, could you please give a bit more details and a screen capture?

Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 30, 2020 01:52 PM

I just realized you were probably asking about the `XOR()`

that Airtable already has, not asking for a formula to replicate its functionality. It is difficult to remember all of the functions that Airtable has, and sometimes Airtable quietly adds new functions.

In any case, I hope that you have your answer.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

May 30, 2020 02:04 PM

Whao that’s a great explanation @kuovonne!! I’m sure anyone who was perplexed by XOR has a much better understanding of it when they read through this thread and your answer now :grinning_face_with_big_eyes:

I think XOR is still quite an esoteric function cause it requires that the conditions are “fungible” thus negative multipled by negative multipled by negative etc gives us something meaningful.

Yea I can see in terms of switches how that would work (like sending button pushes to IoT switches) actually but in majority of real life conditional control flows would be more human useable cause each step we can define different semantics and usually each step has different semantics.

Thanks once again @kuovonne!

Reply