Help with multiple tags based on words in long text

I’m trying to automate going through and tagging customer responses (long text)

I have a list of words or phrases I want it automatically tag with another phrase
Find and tag the following words
“Specials” or “bargains” or “price” = Price,
“menu” or “search” or “find” “navigate” =Navigation

Done manually it looks like this

I think the code would be something like this
IF it contains “X” or “Y” or “Z” =Z, IF it contains “A” or “B” or “C” =A

I’m not sure if I can set this up using the IF formula because it may not contain any of the words or it may contain more than one. Any advice? Should I be using a script instead?

I’d probably use the scripting block, but this is possible with both formulas and scripts. Formulas have the benefit of “always running” - Scripts need to be run via hitting a button. However, Scripting would make for a more dynamic solution.

If you use a formula, other than the IF logic, your primary function is FIND(). And you’d need to write a FIND function for each word or phrase you’re looking for. In other words, it’s not dynamic code. If you someday need to search for some other words or alter what text it produces as a result of those words, the code would need to be altered.

Whereas a good JavaScript implementation might ask the user running it what words to look for / respond with each time it is run. Meaning the code wouldn’t get frequently altered, but it requires action from the user.

1 Like

Thanks Zollie,

I’m new to Javascript any suggestions for how to set up the script?

I’d checkout other posts tagged with the scripting block, or the work offered tags if you’d like to hire a developer. Otherwise, if you’d like to learn, I recommend starting with codecademy or similar free resources alongside any scripting block documentation Airtable provides.