cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
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
Highlighted
Power Apps
Power Apps

Re: Using IF(AND) after a string of IFs

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)

 

View solution in original post

4 REPLIES 4
Highlighted
Power Apps
Power Apps

Re: Using IF(AND) after a string of IFs

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)

 

View solution in original post

Highlighted
Helper IV
Helper IV

Re: Using IF(AND) after a string of IFs

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

Thanks so much.

Makes perfect sense.

Highlighted
Post Prodigy
Post Prodigy

Re: Using IF(AND) after a string of IFs

HI @C_Ian_Davis 

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

If(GalleryTabInspection.Selected.Value.ID = "MenuTab2", Or(CountRows(Filter(HeaderColl, SO_Number=GalleryFilterSO.Selected.'Service Order Id'))=0), false, true)

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

Thanks,

pytbyt

Highlighted
Regular Visitor

Re: Using IF(AND) after a string of IFs

Hi @C_Ian_Davis@C_Ian_Davis 

 

 

 

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

 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,529)