cancel
Showing results for
Did you mean:
Helper IV

## Using IF(AND) after a string of IFs

In Excel, if you want to use multiple IF statements, it would go like this:

IF(A=B, value if true, value if false), IF(C=D, value if true, value if false), IF(E=F, value if true, value if false)

In PowerApps, you don't have to use "IF" the second and third time:

IF(A=B, value if true, value if false), (C=D, value if true, value if false), (E=F, value if true, value if false)

I'm looking to start with two "IF" statements, and then add a "IF(AND)" statement, which is simple in Excel:

IF(A=B, value if true, value if false), IF(C=D, value if true, value if false), IF(AND(E=F, G=H, value if true, value if false))

But I can't make it work in PowerApps because that I can't use that third "IF".   If I just use "AND" it doesn't work.

There has got to be a simple solution to this but I can't find it anywhere.

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps

Hi Hugh,

A couple solutions here: (very bad example, but highlights how to nest the 'And' statements)

```Set(a, 1);
Set(b, 2);
Set(c, 3);

If(And(And(a = b, b = c), c = a), Do stuff, else do other stuff)```

and then, as your logic grows, it may be easier for you to use && in place of 'And' like so:

```Set(a, 1);
Set(b, 2);
Set(c, 3);

If(a = b && b = c && c = a, Do stuff, else do other stuff)```

6 REPLIES 6
Power Apps

Hi Hugh,

A couple solutions here: (very bad example, but highlights how to nest the 'And' statements)

```Set(a, 1);
Set(b, 2);
Set(c, 3);

If(And(And(a = b, b = c), c = a), Do stuff, else do other stuff)```

and then, as your logic grows, it may be easier for you to use && in place of 'And' like so:

```Set(a, 1);
Set(b, 2);
Set(c, 3);

If(a = b && b = c && c = a, Do stuff, else do other stuff)```

Helper IV

I knew there was a simple solution that I was missing!

Thanks so much.

Makes perfect sense.

Post Prodigy

HI @C_Ian_Davis

Can you help me with my formula? i want to make the gallery visible with 2 OR condition TRUE.

It doesnt seem work like i expected.
What should i do to make it work properly?

Thanks,

pytbyt

Frequent Visitor

It seems 'and' can be used only for comparision.

Regular Visitor

Yes it is possible to perform multiple stuff If True, - using "&"

here is the example code which I'm using

I'm running this code in OnChange event of Dropdown1

If (
Dropdown1.Selected.Value = "Edit",

Reset(Dropdown1) &
EditForm(formuserinfo) &
Set(
visformuserinfo,
true
) &
Set(
grpfrmsubmit,
true
),
Reset(Dropdown1)
)

You don't need "&", you need a semi-colon between those actions you want to do at the same time, instead.

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!