May 21, 2020 02:09 PM
I am trying to write a simple formula: If field X contains ‘Apples’ or ‘Cats’, or ‘Chocolate’, or ‘Dogs’, then ‘Enter in the database’.
I am not well-versed in formulas, as you will see, and am probably using a convoluted way, which is the following:
IF( OR( FIND(‘Apples’, {Field X}), FIND('Cats, {Field X}), FIND(‘Chocolate’, {Field X}), FIND(‘Dogs’, {Field X})), ‘Actionable’). The formula works for the first two values, but breaks on the last two. (Airtable also inserts backslashes there.) Can someone kindly help me figure this out?
Thanks.
May 21, 2020 02:35 PM
What kind of field is {Field X}
? It matters because certain field types are holding arrays behind the scenes, rather than strings, and the FIND()
function is designed to search a string, not an array.
As a failsafe, regardless of the type of field {Field X}
might be, you could try coercing {Field X}
into a string by concatenating it with an empty string like this:
IF(
OR(
FIND('Apples', {Field X} & ''),
FIND('Cats', {Field X} & ''),
FIND('Chocolate', {Field X} & ''),
FIND('Dogs', {Field X} & '')
),
'Actionable'
)
Try that, and see if it gets you the result you are wanting.
May 22, 2020 09:22 AM
Thank you. Unfortunately, that didn’t work. (The actionable only shows up for ‘Apples’. And backslashes continue appearing in the formula once posted.
Field X is a single line text field.
May 22, 2020 09:50 AM
Are you able to post a screenshot of the formula you have and the issue you are experiencing?