Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How can I have an M Query Text.Contains function search for multiple possible words in a field?

I would like to have a Text.Contains that searches Column A for "Example" OR "Examples" OR "Examples2". I am sure it is staring me in the face but I cannot figure out how to do it.
  • v-xuding-msft's avatar
    v-xuding-msft
    6 years ago

    Hi Anonymous ,

    Please try this:

    if Text.Contains([Column1],"Example") = true then [Column1] else null

    The function of Text.Contains will search out all the data which contains the key word. So you just need to write Text.Contains one time.

     

    If you want to filter data, you could try this:

    = Table.SelectRows(#"Changed Type", each Text.Contains([Column1], "Example"))

    Best Regards,

    Xue Ding

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.