Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Need to comapare multiple conditions in the If loop in Power Automate Desktop

I need to compare the Name and the status of employee are matching or not using IF loop how to compare multiple conditions in the If loop using "AND" and "OR" Operators

Not applicable



I need to multiple conditions in the If statement.

I have many files of the same pattern, out of it I do not want to delete certain files starting with specific name followed by number ex. 'ABC-1234'.

I tried the following, but it is not working. Please help for the solution.





I would approach this completely differently. 

set up a temp folder

get files in folder ABC-1234*
move files to temp

get files in folder RES-1564*

move files to temp

get files in folder FED-1234*
move files to temp

get all files in folder

delete files

get all files in temp

move files back to folder

Not applicable

Thanks for your reply and it works.

I posted this to know whether multiple conditions are possible in a single if statement for my scenario.


Here are some ideas you can try, but the solution I know will work is below the dotted line.




It says you can do this:


I personally don't think this would work, because the operator is built into IF, and it doesn't give an And/Or option.


On the other hand, you can do nested If's to accomplish AND functions:

  • If name is
    • If status is
      • Do something
    • EndIF
  • EndIF

So in this example, it would only "Do something" If both statements were true.


Solution that will definitely work:


You can use Switch & Case to handle all possibilities of AND/OR Functions, but this gets complicated.  You have to set each If Statement to True (1) or False (0), so that looks like this:

  • If Name is True
    • Set Variable %NameIF% to (1)
  • Else
    • Set Variable %NameIF% to (0)
  • EndIF
  • IF Status is True
    • Set Variable %StatusIF% to (1)
  • Else
    • Set Variable %StatusIF% to (0)
  • EndIF
  • Set Variable %Result% to 'Name%NameIF%,Status%StatusIF%' 

#I used text other than just numbers in %Result% so it didn't mistake it for a number and turn "01" into "1".


Now that you have the result variable, which is 1 of 4 options, you can use Switch Case to "do something" based on your result:

  • Switch %Result%
    • Case Name0,Status0
      • Do something for 0,0
    • Case Name0,Status1
      • Do something for 0,1
    • Case Name1,Status0
      • Do something for 1,0
    • Case Name1,Status1
      • Do something for 1,1

Best of luck!

Resolver I
Resolver I

Here is another approach with OR conditions, using a list and looping items: 

Not applicable

Hello @Anonymous 


You can use multiple conditions in IF statement. 🙂


You would better to check the solution posted by @sakula1996  in the thread below:

Solved: If condition logic - Power Platform Community (


Also yet another thread discussing the same issue you should read through:

How to include the logical AND/OR operators in con... - Power Platform Community (


Thank you.




And/Or is working just fine
Try This example





Not applicable


Thank you for your response!

Actually the match starts with 'ABC-1234' and after that it contains some text (ABC-1234 ttttccvvfilename.pdf). So, I cannot give Match = ABC-1234, I have to give it like Match does not start with 'ABC-1234'. Any idea how to implement?



Me setting Match to "ABC-1234" was only because i did not want to do the parse and to show how the multiple or's worked

My suggestion would be

For each CurentItem9 in files
  Parse text
    If %match% is empty

      Delete file


That is if what you are trying to do is to delete all files not starting with ABC-1234 or RES-1564 or FED-1234

Not applicable



I have to give two if conditions,


For each CurentItem9 in files
  Parse text
    If %match% isn't empty

      if %match% doesn't starts with ABC-1234 or RES-1564 or FED-1234

       Delete file



because I have other files which have a same pattern as ABC-1456(numbers will vary) which should be deleted.

This will check for the two conditions you need.
Replace the Set variable with your parse function








Not applicable

It is working perfectly! 

Thank you for the solution.

Helpful resources

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,688)