Feb 21, 2022 05:57 AM
Hi there,
I have accomplished a few formulas through my airtable base but I have trouble with this one:
In a library, I want to return “not in stock” for items that are signed out and have not yet been returned.
In writing this would be:
If SignOutDate contains a value and ReturnDate contains no value, return “not in stock”, otherwise “available”
IF(
AND(
{SignOutDate}<>””,{ReturnDate}=BLANK()
),
”notinstock”,”available”
)
As I am new to the AND/IF business, I might have severe problems in here already? If not, could it be that the date fields are the problem, they are set as ISO?
Any help highly appreciated.
Best, Sisi
Solved! Go to Solution.
Feb 21, 2022 08:55 AM
Welcome to the Airtable community!
Airtable formula fields have their own grammar and vocabulary, different from other formula writing systems you may have used. For example <>
is not a valid comparison operator in Airtable formulas.
There are also multiple methods of checking if a field has a value, but one of the easiest is to simply use the {field} itself as a test. If the field has a value, it will be “true”, with a few exceptions for number fields.
IF(
AND(
{SignOutDate},
NOT({ReturnDate})
),
"notinstock",
"available"
)
Feb 21, 2022 08:55 AM
Welcome to the Airtable community!
Airtable formula fields have their own grammar and vocabulary, different from other formula writing systems you may have used. For example <>
is not a valid comparison operator in Airtable formulas.
There are also multiple methods of checking if a field has a value, but one of the easiest is to simply use the {field} itself as a test. If the field has a value, it will be “true”, with a few exceptions for number fields.
IF(
AND(
{SignOutDate},
NOT({ReturnDate})
),
"notinstock",
"available"
)
Feb 22, 2022 12:20 AM
Thank you so much, kuovonne.
This worked perfectly and ended my two days of head-scratching.
It´s the first time I ever posted anything in a forum in my life - how lovely, it what such a success.
You just made my day. Thanks so much!