Compare two list and check elements are common in both the list

I have two list named list1= [“Apple”,“Orange”,“Mango”] and list2=[“Apple”,“Orange”,“Mango”] and I need to ensure the items available in list1 should be there in list, to ensure if the list contains any unmatched item I have used list1.Except(list2) method to validate. if the values are same in the two list then block should be executed ,if not else part should be executed and used for each loop to iterate the item in list. In my case the for each loop is not executed. Could someone guide me on this
Attached the main.xml file for reference:
Main.xaml (12.5 KB)

Manoj Kumar V

Hi @ManojKumarV ,

When you have the two lists identical and perform the except function, it wont return any elements in the output array. Hence the for each loop is not executing.


Does there is any alternate way for this?

@ManojKumarV ,

You can check if List1.Except(List2).count>0 first then perform a for each if the count is greater than 0. If it’s equal to zero, then you can confirm that both the lists are identical.



Check out here. (14.1 KB)
Worked for me thanks!

1 Like

Just keep the following in mind (e.g. when a wrong check can cause damage)


the Except is 0, but arr1 is not arr2
(we keep also in mind that set operations Intersect, except will deduplicate the occurrences)

We can more strictly check with:

And also

With cross check

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.