web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / If condition with OR i...
Power Automate
Unanswered

If condition with OR in second operand

(0) ShareShare
ReportReport
Posted on by 75

i have 2 types of excel sheet, in 1 the column header is "Package Name" and in the second type the same date but column header is 'service/ Pacakage Name" , i wrote the second operand as "%Currentitem =['Package Name'] OR Currentitem = ['Service/ Package Name']. butthe flow in the desktop is giving error that the property for the current item not found. Is there anydifferent way of achieving this

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @bensat2 

    Try the below syntax using foreach loop:

    Deenuji_0-1711603173165.png

    Deenuji_1-1711603634550.png

     

    Direct check without for each loop:

    Deenuji_2-1711603705458.png

    Full flow screenshot:

    Deenuji_0-1711604424338.png

     

    Full code:

     

    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Deenu\\Excel1.xlsx''' Visible: True ReadOnly: False Instance=> ExceloneInstance
    Excel.ReadFromExcel.ReadAllCells Instance: ExceloneInstance ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelOneData
    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Deenu\\Excel2.xlsx''' Visible: True ReadOnly: False Instance=> ExceltwoInstance
    Excel.ReadFromExcel.ReadAllCells Instance: ExceltwoInstance ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelTwoData
    LOOP FOREACH CurrentItem IN ExcelOneData
     SET fistcolumnname TO CurrentItem.ColumnNames[0]
     IF (CurrentItem.ColumnNames[0] = 'Package Name' OR CurrentItem.ColumnNames[0] = 'Service/ Package Name') = $'''TRUE''' THEN
     # Implement your logic
     Display.ShowMessageDialog.ShowMessage Title: $'''info''' Message: $'''test info''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
     END
    END
    IF (ExcelOneData.Columns[0] = 'Package Name' OR ExcelTwoData.Columns[0] = 'Service/ Package Name') = $'''TRUE''' THEN
    END

     

     

    How to copy and paste the above code into your Power automate desktop?

    Deenuji_3-1711603804350.gif

     



    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀. If you'd like to appreciate me, please write a LinkedIn recommendation 🙏

  • VishnuReddy1997 Profile Picture
    2,666 Super User 2026 Season 1 on at

    Hi @bensat2 ,

     

    As per my understanding what you have elaborated I have created a solution.

    Please find the solution.

    VishnuReddy1997_1-1711603631946.png

     

     

    Code:

    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Users\\OneDrive\\Desktop\\Power Automate Desktop\\Practice\\VLOOKUP\\Excel 2.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance
    Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: ExcelInstance Name: $'''Sheet1'''
    Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: False RangeValue=> Sheet1_Data
    Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: ExcelInstance Name: $'''Sheet2'''
    Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: False RangeValue=> Sheet2_Data
    LOOP FOREACH CurrentItem_Sheet1 IN Sheet1_Data
    LOOP FOREACH CurrentItem_Sheet2 IN Sheet2_Data
    IF (CurrentItem_Sheet1 = 'Package Name' OR CurrentItem_Sheet2 = 'Service/ Package Name') = $'''True''' THEN
    Display.ShowMessageDialog.ShowMessage Message: $'''Both are Equal''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed2
    END
    END
    END

     

    (Note:- if you got your solution you can mark as solution and gives kudos)

     

    Thanks & Regards

    Vishnu Reddy

     

  • bensat2 Profile Picture
    75 on at

    i wanted the or condition in the seond operand of the if condition, both solutions given talks about the or in first operand

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @bensat2 

     

    Could you please elaborate your requirement?

     

    What is first operand value or variable?

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀. If you'd like to appreciate me, please write a LinkedIn recommendation 🙏

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @bensat2 

     

    If i am right > do you want to do a lookup b/w two sheets based on header values ?

     

    like row['Package Name'] equals row['Service/ Package Name']

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    What exactly are you trying to do with the two sheets? Are you trying to compare the two? What is in %CurrentItem%?

     

    Assuming you are likely doing a For each loop on one of the two sheets, %CurrentItem% will contain a data row from one of the sheets, and not both of them. You might need to have one more loop or a Find or replace in data table to find the corresponding value from the other sheet.

     

    The syntax you are using is clearly incorrect, but it can likely be fixed if you elaborated a bit on what you are trying to achieve. Can you maybe share some screenshots of your flow so far? 

  • bensat2 Profile Picture
    75 on at

    No, I have two sheets and a particular column in one sheet is called package name and in the other the same column is called "Service / package Name". i want to write a if condition as shown below. 

    bensat2_0-1711956735892.jpeg

    I have solved this using another if condition problem is this has icreased my code by another 12 lines

    if the condition shown in the image works this will solve my problem.

     

  • VishnuReddy1997 Profile Picture
    2,666 Super User 2026 Season 1 on at

    Hi @bensat2 ,

     

    What your getting from "Get Details of  Web Page. Can you provide for example what it is extracting. So I can replicate the issue.

    And also in that action what drop down option your selecting in Get.

     

    Regards,

    Vishnu Reddy

    Vishnu Reddy

  • bensat2 Profile Picture
    75 on at

    The web page property contains a value whcih is in the package name or Service  / Package Name column, if the excel value and the web page value match then some actions are done

     

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @bensat2 

    I am uncertain whether we can include two conditions with "or" in the second operand within Power Automate Desktop (PAD).

     

    If it's feasible, could you please share a screenshot of your flow with all sensitive data hidden? This will allow us to assess the setup and offer suggestions for achieving your objective more effectively.

     

    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀. If you'd like to appreciate me, please write a LinkedIn recommendation 🙏

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 463

#1
Valantis Profile Picture

Valantis 463

#3
11manish Profile Picture

11manish 264

Last 30 days Overall leaderboard