Forum Discussion
See if column string contains multiple text values
Hi,
Is there a way to search for two or more words within the same string of text?
I already tried with containsstring but then I can only give one word.
Example data:
| Column |
| this text contains two words I want to search for to determine which group the content belongs to |
| this is another sentence where the content belongs to a different group |
if the text contains the following words "text" and "search" then group 1,
if the text contains the following words "sentence" and "different" then group 2,
otherwise group 3
Searching for one word in the text is no problem, I have that working, I just can't figure it out if several words have to be looked at. hopefully someone knows a solution. thanks in advance
Hi icturion ,
Create a column with below code:-
Column 2 = SWITCH ( TRUE (), CONTAINSSTRING ( 'Table (4)'[Column], "text" ) && CONTAINSSTRING ( 'Table (4)'[Column], "search" ), "Group 1", CONTAINSSTRING ( 'Table (4)'[Column], "sentence" ) && CONTAINSSTRING ( 'Table (4)'[Column], "different" ), "Group 2", "Group 3" )Output:-
Thanks,
Samarth
3 Replies
- Samarth_18Community Champion
Hi icturion ,
Create a column with below code:-
Column 2 = SWITCH ( TRUE (), CONTAINSSTRING ( 'Table (4)'[Column], "text" ) && CONTAINSSTRING ( 'Table (4)'[Column], "search" ), "Group 1", CONTAINSSTRING ( 'Table (4)'[Column], "sentence" ) && CONTAINSSTRING ( 'Table (4)'[Column], "different" ), "Group 2", "Group 3" )Output:-
Thanks,
Samarth
- icturionResolver II
Thank you, I hadn't thought of the switch function. thanks for thinking along
- AnonymousNot applicable
Is there a way I could work this function to support a sequence of words?
For example,
I want two groups one if the text contains "collab" and "workstations" = group 1 and another if the text contains "collab" and "no workstations" = group 2