# Can two unrelated conditions live in the same formula?

Solved
1624 7
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

Dear community,

can two unrelated conditions live in the same formula? Do they need to connected by the same first argument?

I want "Sample Availability to read “Shop only” when there is no value in “SignOutIcon”

In writing it would be:

If SignOutIcon contains no value, return “Shop only”. If SignOutDate contains a value and ReturnDate contains no value, return “not in stock”, otherwise “available”

With first argument the same, it would be

If SignOutIcon contains no value, return “Shop only”. If SignOutIcon contains a value and SignOutDate contains a value and ReturnDate contains no value, return “not in stock”, otherwise “available”

I used “&” but this returned a mess:

IF(AND({SignOutDate},NOT({SignOutComment})),“not in stock”,“available”) & IF(NOT({SignOutIcon}), “Shop only”, “available”)

Could anyone give me a hint? Any help highly appreciated.

Best, Sisi

1 Solution

Accepted Solutions
16 - Uranus

^that written as a formula would be:

``````IF(
NOT({SignOutIcon}),
"Shop only",
IF(
AND({SignOutIcon}, {SignOutDate}, NOT({ReturnDate})),
"not in stock",
"available"
)
)
``````
7 Replies 7
16 - Uranus

^that written as a formula would be:

``````IF(
NOT({SignOutIcon}),
"Shop only",
IF(
AND({SignOutIcon}, {SignOutDate}, NOT({ReturnDate})),
"not in stock",
"available"
)
)
``````
18 - Pluto

This is a great example of how to write a formula! First clarify the logic in English (or whatever your native language is), then translate it.

If SignOutIcon contains no value, return “Shop only”.

• If translates into the `IF` function.
• SignOutIcon contains no value translates into `NOT({SignOutIcon})`
• return “Shop only” translates in to the second parameter of the `IF` function.

If SignOutIcon contains a value and SignOutDate contains a value and ReturnDate contains no value,

• This If translates into a nested `IF` function.
• The and translates into the `AND` function.
• contains a value translates into the field name itself (except for numbers that might be zero)
• return “not in stock”, otherwise “available” translate into the second and third parameters of the nested `IF` function.

The rest is dealing with pesky grammar of making sure that you have parenthesis and commas in the proper places.

5 - Automation Enthusiast

Thank you Kuovonne, this will definitely help me the next time I am trying to write a formula. Much appreciated!

5 - Automation Enthusiast

Dear Kamille,

thank you very much for your help. It all makes very much sense to me - only airtable replies that it is an invalid formula when I paste it in. I have already tried removing blanks and replacing quotation marks but without success. Any hints that could help me fix this would be highly appreciated.

Thank you!

18 - Pluto

There is a missing comma at the end of the second line.

16 - Uranus

Good catch. I edited my formula to reflect that.

5 - Automation Enthusiast

Thank you both so much. Now it worked, fantastic!