Hi all, I am wondering if I had a long text field and then a multi select field for key words, could I create a formula to show each key word and a count of it’s occurrence in the text field.
Count multiple keywords in text
Best answer by W_Vann_Hall
@HammerOz, @Vernon_Fowler, @Karlstens –
I can get you halfway (the easy half) there, but using the inputs from a multi-select field as your keywords is problematic.
The easy part is this: The basic formula for counting the number of occurrences of {Word} in {String} is
(LEN({String}) - LEN(SUBSTITUTE({String},{Word},"")))/LEN({Word})
That is, you want to subtract the length of {String}
with all instances of {Word}
deleted. This provides you with the combined length of all instances of {Word}
in {String}
. Dividing that number by the length of {Word}
gives you the number of instances.
As I noted, this is by far the easiest part of the task. Since Airtable does not [yet ;-)] provide any mechanism for iterating through a variable number of loops, you’ll essentially have to craft an elaborate chained IF()
that takes into consideration all potential multi-select values, and that IF()
statement will need to be actively maintained, requiring modification after every new addition to the multi-select.
Hey, but the other part: I’ve got you covered…
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.