Forum Discussion

KristofferAJ's avatar
KristofferAJ
Icon for Helper III rankHelper III
4 years ago
Solved

Find specific word within a text cell

Hi all,

I have a column with cells containing a lot of text.

I would like to create a column which looks for a certain word and return a specific value.

 

1. 

For instance if I was to look for Apple -> return 'Yes' or 'No'

 

Can I make the code look for *app*' or does it need to be fully matching?

 

I would like to have to return entries like 'apple-like' for instance, or or 'apples'

 

I hope this makes sense, right now I'm using the 'add a conditional column' in the query, which is fine, but not taking all possibities into account.

 

Thanks

Kristoffer

 

  • Hello there KristofferAJ ! You can use the following:

     

    Find word =
    IF ( CONTAINSSTRING ( 'Your_Table'[Your_column], "*app*" ), "Yes", "No" )

     

    Hope this answer solves your problem!
    If you need any additional help please @ me in your reply.
    If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
    Thanks!

    You can also check out my LinkedIn!

    Best regards,
    Gonçalo Geraldes

3 Replies

  • Hello there KristofferAJ ! You can use the following:

     

    Find word =
    IF ( CONTAINSSTRING ( 'Your_Table'[Your_column], "*app*" ), "Yes", "No" )

     

    Hope this answer solves your problem!
    If you need any additional help please @ me in your reply.
    If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
    Thanks!

    You can also check out my LinkedIn!

    Best regards,
    Gonçalo Geraldes

  • Hi, this is great and does the job! - let's say that I want it to look for multiple words, like orange also? can that be built in?

    Find word =
    IF ( CONTAINSSTRING ( 'Your_Table'[Your_column], "*app*" ), "Yes", "No" )
    OR
    ( CONTAINSSTRING ( 'Your_Table'[Your_column], "*oran*" ), "Yes", "No"

     

    • goncalogeraldes's avatar
      goncalogeraldes
      Icon for Super User rankSuper User

      Hello there KristofferAJ ! You can simply do:

      Find word =
      IF (
          OR (
              CONTAINSSTRING ( 'Your_Table'[Your_column], "*app*" ),
              CONTAINSSTRING ( 'Your_Table'[Your_column], "*oran*" )
          ),
          "Yes",
          "No"
      )

      For additional help, please @ me in your reply!

      You can also check out my LinkedIn!

      Best regards,
      Gonçalo Geraldes