Jan 25, 2024 11:32 AM
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.
This is my keyword mapping table. In total, I have a fixed list of around 20 tags with 3-4 keywords each.
Thanks for your help!
Jan 25, 2024 12:43 PM
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"
)
Jan 26, 2024 12:50 AM
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