cancel
Showing results for
Did you mean:
Helper V

## Find contain substring

I have a list key words such as: water, juice, milk

And, I'd like to have function to find a input string if contains any one of above, then return TRUE.

What is best way to function this?

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User

The following formula will return true:

``CountRows(Filter(Split("In the water we drank juice", " "), Result in ["water", "juice", "milk"]))>0``

and the following returns false:

``CountRows(Filter(Split("In the ocean we drank wine", " "), Result in ["water", "juice", "milk"]))>0``

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Super User

You can change then to this formula.

``````Sum(
ForAll(
["water", "juice", "milk"],
If(Value in "In the WATERWORLD we drank wine", 1, 0)
),
Value
)>0``````

This will return true as it contains water.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
4 REPLIES 4
Super User

The following formula will return true:

``CountRows(Filter(Split("In the water we drank juice", " "), Result in ["water", "juice", "milk"]))>0``

and the following returns false:

``CountRows(Filter(Split("In the ocean we drank wine", " "), Result in ["water", "juice", "milk"]))>0``

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Helper V

I have one issue, if the string such as "WaterX" what should I do to make it contains water?

Community Support

@RandyHayes Thank you for always answering the forum. Please continue to help us keep the forum active.

Super User

You can change then to this formula.

``````Sum(
ForAll(
["water", "juice", "milk"],
If(Value in "In the WATERWORLD we drank wine", 1, 0)
),
Value
)>0``````

This will return true as it contains water.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Announcements

#### April 4th Copilot Studio Coffee Chat | Recording Now Available

Did you miss the Copilot Studio Coffee Chat on April 4th? This exciting and informative session with Dewain Robinson and Gary Pretty is now available to watch in our Community Galleries!   This AMA discussed how Copilot Studio is using the conversational AI-powered technology to aid and assist in the building of chatbots. Dewain is a Principal Program Manager with Copilot Studio. Gary is a Principal Program Manager with Copilot Studio and Conversational AI. Both of them had great insights to share with the community and answered some very interesting questions!     As part of our ongoing Coffee Chat AMA series, this engaging session gives the Community the unique opportunity to learn more about the latest Power Platform Copilot plans, where we’ll focus, and gain insight into upcoming features. We’re looking forward to hearing from the community at the next AMA, so hang on to your questions!   Watch the recording in the Gallery today: April 4th Copilot Studio Coffee Chat AMA