Formula - check if exact option in multiselect is selected

#1

Hello,

I would like to make a formula that does this:

Display 1 if the item “lightyellow” was selected from the Color multiselect

I see that I can use the SEARCH or FILTER functions. However, these will also evaluate to true if a non-exact-matching option was selected.

For example, let’s say I have the options “yellow” and “lightyellow”. The following formula will undesirably match items that have “lightyellow” selected.

SEARCH(“yellow”, {Color})

Is there nothing like this?

CONTAINS(“yellow”, {Color})

#2

Welcome to the forum, Will!

Because case matters in pretty much all aspects of Airtable, I suggest considering a slight shift to your color naming scheme: “lightYellow” instead of “lightyellow”. The capital Y in “lightYellow” will prevent a search for “yellow” from finding “lightYellow” by mistake.

Will that work?

#3

Hi Will,

Basically you need something like SEARCH(“yellow”, {Color}) = 1. That way it will ensure the color is matched from the beginning.

Besides, I would suggest you to use AND( SEARCH(“yellow”, {Color}) = 1, LEN(“yellow”) = LEN({Color})) so that it also make sure options like yellowxxx won’t be matched.

Hope this helped,

Alex

1 Like