cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Channah
Helper III
Helper III

how to have text boxes change colour based on value

Hi, 

 

I have a number of drop downs with options 1-5. The numbers in each box are used to calculate a percentage in a text box.

 

Code below: 

'(DataCardValue21.Selected.Value + DataCardValue22.Selected.Value + DataCardValue23.Selected.Value+ DataCardValue24.Selected.Value+ DataCardValue25.Selected.Value) / 25 * 100'

 

This works!

 

I am trying to have the percentage box change colour based on what percentage is filled e.g. 

 

<25% : Red 

25- 50% : Orange 

50-75% : Yellow 

75-100% : Green 

 

Can anyone help? 

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

Select the color or fill property of the textbox and use this formula:

 

If(Value(DataCardValue22_1.Text)<=25,Red,
If(Value(DataCardValue22_1.Text)>25&&Value(DataCardValue22_1.Text)<50,Orange,
If(Value(DataCardValue22_1.Text)>50&&Value(DataCardValue22_1.Text)<75,Yellow,
If(Value(DataCardValue22_1.Text)>=75,Green
))))
 
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

1 REPLY 1
eka24
Super User
Super User

Select the color or fill property of the textbox and use this formula:

 

If(Value(DataCardValue22_1.Text)<=25,Red,
If(Value(DataCardValue22_1.Text)>25&&Value(DataCardValue22_1.Text)<50,Orange,
If(Value(DataCardValue22_1.Text)>50&&Value(DataCardValue22_1.Text)<75,Yellow,
If(Value(DataCardValue22_1.Text)>=75,Green
))))
 
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,172)