Help

Find keywords in a string, then assign a tag

Topic Labels: Automations Formulas
214 2
cancel
Showing results for 
Search instead for 
Did you mean: 
leMans
4 - Data Explorer
4 - Data Explorer

Hello!

I'm quite new to airtable and have been unsuccessfully trying to solve this for a while now. I'd like to assign a tags to a record based on keywords in a long text field. 

For simplification. Let's assum guests at a wedding text me their food options as a text field. Then I want a script or formular to find keywords in the text field. If it matches a keyword it should then assign a tag. 

In the image below: I want to assign the tag "omnivore" if either keyword (meat, fish, chicken) appears in the column "Dinner requests". The other keywords respectively.

In my case, I only need to assign one tag, not many. We can disregard the possibility that a guest wants vegan and meat option.

leMans_1-1706210087867.png

This is my keyword mapping table. In total, I have a fixed list of around 20 tags with 3-4 keywords each.

leMans_2-1706210221760.png

Thanks for your help!



2 Replies 2
Dan_Montoya
Community Manager
Community Manager

Try something like this switch formula.  I would then use an automation to copy the text from the formala into your tags field.

 

SWITCH(
  TRUE(),
  FIND("pizza", LOWER({Dinner Requests})), "Italian",
  FIND("sushi", LOWER({Dinner Requests})), "Japanese",
  FIND("burger", LOWER({Dinner Requests})), "American",
  "Other"
)

 

Thank you, @Dan_Montoya, somehow I get an error "invalid formula" when pasting your formula. It says it's missing parenthesis, but I can't figure out where