cancel
Showing results for
Did you mean:
Responsive Resident

## How to use And/Or

How can I perform an And/or check behind a button

This one works fine

If(Value(Blood1.Text) >= 120 && Value(Blood1.Text) <=129  && Value(Blood2.Text) < 80 ,Set(colorset,"#ffff1a");Set(txtval,"ELEVATED"));

But what if I want to check two text box values using an and/or calculation?
If textbox1 > 80 and/Or  textbox2 > 120

Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Super User

I know what the issue is... I needed to invert the order displayed on the chart when coding it, lol.

``````If(
Value(Blood1.Text) > 180 Or Value(Blood2.Text) > 120,
Red,
Value(Blood1.Text) >=140 Or Value(Blood2.Text) >= 90,
RedOrange,
(Value(Blood1.Text) >= 130 Value(Blood1.Text) <= 139) And (Value(Blood2.Text) >= 80 Value(Blood2.Text) <= 89),
Orange,
(Value(Blood1.Text) >= 120 Value(Blood1.Text) <= 129) And Value(Blood2.Text) < 80,
Yellow,
Value(Blood1.Text) < 120 And Value(Blood2.Text) < 80,
Green
)``````

13 REPLIES 13
Community Champion

If(Value(Blood1.Text) >= 120 Or Value(Textbox2.Text) > 120&& Value(Blood1.Text) <=129  && Value(Blood2.Text) < 80 Or Value(Textbox1.Text) > 80,Set(colorset,"#ffff1a");Set(txtval,"ELEVATED"));

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.

Super User

@sienna28
Can you please clarify what you want to do with this code?  I don't understand having both the AND and the OR.

If textbox1 > 80 and/Or  textbox2 > 120

---
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."

Responsive Resident

It just needs to work for these values

If textbox1 > 80 and/Or  textbox2 > 120

Super User
@sienna28
I guess what i am asking here is do you want the condition to be AND or OR for your code above: it cannot be both.
Responsive Resident

If you notice the second value is where the And/Or is done

Super User

In your example, the And is irrelevant.  If either value is outside of the range, the result will be flagged. I would just go with the Or condition.

Super User

``````If(
Value(Blood1.Text) >= 180 Or Value(Blood2.Text) >= 120,
Set(colorset,"#ffff1a"),
Set(txtval,"ELEVATED")
)``````

---
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."

Responsive Resident

Hi

That looks like it could be it, but I am not sure how it reads.

Could you please explain that logic to me....does the 180 value come into it?

Many thanks

Responsive Resident

I've attached a better graphic which shows what I am trying to do.

Using the Or condition only in the last option triggers the one above it.

Announcements

#### Celebrating the May Super User of the Month: Laurens Martens

@LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!

#### Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!