web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / PowerFx formula simila...
Copilot Studio
Suggested Answer

PowerFx formula similar to contains

(0) ShareShare
ReportReport
Posted on by 73
I would like to write a formula that is similar to CONTAINS that can search strings of text and if the strings of text contains this specified word, it will return TRUE, e.g. if the strings of text is 'the lazy fox jumps over the quick brown dog.' and my specified word is 'FOX', it should return true.
 
I thought IN might work but seems like the entire strings of text has to be the specified word i.e. 'fox' in this case, else it will fail to work. Is there any formula I can use in PowerFx to do this kind of substring search regardless of position, case? Current PowerFx in Copilot Studio doesn't have accept using MATCH/MATCHALL. 
Categories:
I have the same question (0)
  • Suggested answer
    Artur Stepniak Profile Picture
    1,539 Super User 2025 Season 2 on at
    Hello,
     
    can you convert the searched string first with Lower() or Upper() function and then perform the search? It should always contain lowercase/uppercase letters then. You can use it on both the searched string and search word.
     
    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.
     
    Best regards,
     
    Artur Stepniak
    Interested in GenAI? Visit my site!
  • wendy123 Profile Picture
    73 on at
    Hi Artur, 
     
    My question is not so much about the converting the casing but what formula could be used to perform the string search so that as long as the specified word appears in the strings of text, it will return true? Currently IN does not achieve this in Copilot Studio as the entire strings of text has to match the specified word for it to return true, 
     
     
     
  • VASANTH KUMAR BALMADI Profile Picture
    266 on at

    In PowerFx, while IN only checks for an exact match and doesn't support case-insensitive substring searches, you can accomplish your goal using a combination of functions that allow you to perform a case-insensitive search for a substring.

    Since you're using Copilot Studio (which doesn’t support MATCH or MATCHALL), you can work around this limitation by using the Lower function (for case insensitivity) combined with Search or Len (for checking the presence of a substring).

    Here’s an approach to do a case-insensitive substring search:

    Formula:

    If(
        Len(Search(Lower(Text), Lower("fox"))) > 0,
        true,
        false
    )

    Explanation:


    • Lower(Text): Converts the entire text to lowercase to ensure the search is case-insensitive.

    • Lower("fox"): Converts the specified word ("fox" in this case) to lowercase as well.

    • Search(Lower(Text), Lower("fox")): Searches for the substring "fox" within the text, ignoring case. If the substring is found, Search returns the position of the first character of the match. If not found, it returns -1.

    • Len(...) > 0: If Search returns a position greater than -1, it means the substring is found, and the length of the result will be greater than 0. This indicates the word is present in the string.

    •  

    Example:

    • Text: 'the lazy fox jumps over the quick brown dog.'

    • Search Word: 'FOX'

    This formula will return TRUE because "fox" is found in the string, regardless of case.

     
     

    If you want a simpler boolean result (i.e., just true or false without using If), you can directly use:

    Len(Search(Lower(Text), Lower("fox"))) > 0

    This directly returns true or false based on whether the substring is found.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 261 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 198 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard