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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If statment label cont...
Power Apps
Answered

If statment label contains text "YES" just make the text "YES" red

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Guys,

 

im trying to make some text (just the word YES) within a label appear red using the following,

 

If(Contains("YES",Label9_2.Text)),Red,RGBA(0, 0, 0, 0))

 

the label contains a few fields that i have concatenated together? is it my code or the because of the concatenate function before the if statement? 

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    I am not aware of the function CONTAINS but you can use the IN operator to achieve your goal.

     

    If("YES" in Label9_2.Text, Red, RGBA(0, 0, 0, 0))

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @mdevaney wrote:

    @Anonymous 

    I am not aware of the function CONTAINS but you can use the IN operator to achieve your goal.

     

     

    If("YES" in Label9_2.Text, Red, RGBA(0, 0, 0, 0))

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 


    I get an error on the 

     

    ; 

     

    after the concatenate and before the

     

    If("Defect" in Label9_2.Text, Red, RGBA(0, 0, 0, 0)) 

     

    ive also tried the others & and &&..

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    I don't see any ; symbol or concatenation in the code you have provided.  Please show a screenshot of the highlighted code with the error message showing.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @mdevaney wrote:

    @Anonymous 

    I don't see any ; symbol or concatenation in the code you have provided.  Please show a screenshot of the highlighted code with the error message showing.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."


    asdasdasd.png

     

    Ignore the redacted its just different text column data. (it works great) just cant combine the syntax

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    You can only control the text color using the color property.  If you put this code in the Text property it would either highlight the entire text red if Defect is found or transparent if not found.

    If("Defect" in Label9_2.Text, Red, RGBA(0, 0, 0, 0)) 

     

    HTML text can be used to highlight only a portion of a text-string but I have no idea how to detect where the position of YES is.  Is it always in the same position?

    Text before <font color="red"> YES </font> Text after

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @mdevaney wrote:

    @Anonymous 

    You can only control the text color using the color property.  If you put this code in the Text property it would either highlight the entire text red if Defect is found or transparent if not found.

     

    If("Defect" in Label9_2.Text, Red, RGBA(0, 0, 0, 0)) 

     

     

    HTML text can be used to highlight only a portion of a text-string but I have no idea how to detect where the position of YES is.  Is it always in the same position?

     

    Text before <font color="red"> YES </font> Text after

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."


    Yes. The information from the column is "brought" in by a flow, if the conditions are met to send the flow the words "YES" are at the end of Description 3 below, (there is a generic sentence before YES)

     

     

    "
    "&'Description1'&"
    "&'Description2'&"
    "&'Description3'&"
    "

     

     

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Based on the issue that you mentioned, I think the Html text control and the Substitute function could achieve your needs.

     

    I have made a test on my side, please consider take a try with the following workaround:

    7.JPG

    Set the HtmlText property of the Html Text control to following:

    Substitute("Show your Yes or No value", "Yes", "<b style='color:red;'>Yes</b>")

    On your side, you should set the HtmlText property of the Html Text control to following:

    Substitute(
     Concatenate(...), // Type your Concatenate(...) formula here
     "Yes", 
     "<b style='color:red;'>Yes</b>"
    )

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard