Skip to main content
Solved

Is there logical operator "includes any of"?

  • May 20, 2020
  • 2 replies
  • 32 views

Forum|alt.badge.img+10

Hi, is there a way to compare strings that include same word(or part of the word), but not the whole phrase?

Best answer by kuovonne

You can use the FIND or SEARCH functions to see if a word is in a phrase. Combine it with the OR and IF functions to get “includes any of”.

IF(
  OR(
    FIND("keyword 1", {field to search}),
    FIND("keyword 2", {field to search}),
    FIND("keyword 3", {field to search})
  ),
  "Found at least one",
  "Didn't find any"
)

If your {field to search} is a lookup field, you will need to turn it into a string: {field to search} & ""

You do have to be careful if some of your keywords are subsets of each other. For example, if you have keywords “alpha” and “alphabet”, this simply formula will find “alpha” even if the field includes only “alphabet”.

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Answer
  • May 20, 2020

You can use the FIND or SEARCH functions to see if a word is in a phrase. Combine it with the OR and IF functions to get “includes any of”.

IF(
  OR(
    FIND("keyword 1", {field to search}),
    FIND("keyword 2", {field to search}),
    FIND("keyword 3", {field to search})
  ),
  "Found at least one",
  "Didn't find any"
)

If your {field to search} is a lookup field, you will need to turn it into a string: {field to search} & ""

You do have to be careful if some of your keywords are subsets of each other. For example, if you have keywords “alpha” and “alphabet”, this simply formula will find “alpha” even if the field includes only “alphabet”.


Forum|alt.badge.img+10
  • Author
  • Known Participant
  • May 20, 2020

You can use the FIND or SEARCH functions to see if a word is in a phrase. Combine it with the OR and IF functions to get “includes any of”.

IF(
  OR(
    FIND("keyword 1", {field to search}),
    FIND("keyword 2", {field to search}),
    FIND("keyword 3", {field to search})
  ),
  "Found at least one",
  "Didn't find any"
)

If your {field to search} is a lookup field, you will need to turn it into a string: {field to search} & ""

You do have to be careful if some of your keywords are subsets of each other. For example, if you have keywords “alpha” and “alphabet”, this simply formula will find “alpha” even if the field includes only “alphabet”.


Wonderfull, I manage to make it work :slightly_smiling_face: Thanks