Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Compare two arrays (e.g. SharePoint lists) using Power Automate

Posted on December 8, 2024December 8, 2024 by Tom

“I have SharePoint lists with users and registrations, how can I compare the lists (arrays), to see if everyone is registered using Power Automate?”


Comparing two lists, let it be SharePoint lists or any other, is quite an annoying task to do, especially for bigger lists. Since Power Automate doesn’t have any function to compare arrays (and lists are just arrays) you have to implement such functionality by yourself. And your first attempt might be to loop through both the lists and compare it item by item – a performance nightmare…

What’s the ‘better’ solution then? How can you compare two lists, two arrays, and find the differences in an efficient way?

Create the two arrays for comparison

To find the missing values you need two inputs – the array with all the values, and the second array with some of them. For example a list with all users and a registration list.

Power Automate compare sharepoint lists

The first step is therefore to get all the data into Power Automate flow. ‘Get items’ from the first list and ‘Select’ the values to compare, in this case the email addresses.

Repeat the same steps for the second list, with the registrations.

The outputs of the ‘Select’ actions will be the two arrays to compare.

List the missing values

Since Power Automate doesn’t have an expression to find the differences, you’ll have to do a small workaround.

Instead of an expression use the ‘Filter array’ action. Use the bigger array as the From value, the smaller array on the left side and the item() expression on the right side.

Power Automate compare sharepoint lists

The result will be an array with the values from the first array missing in the second array.

List whole SharePoint items

The example above compared two simple arrays, but that’s not always the case. Often you’re comparing objects in an array, e.g. items in two SharePoint lists. In such case it wouldn’t make sense to select only the emails for comparison as you want the whole items.

Instead of selecting only the value to compare from the first list, take the whole list. And since you’re now referencing the whole list, you can’t use simply item() – must reference the specific property with an expression.

Similarly to the example above, I’m looking for items in ‘Users’ where the user is not in the ‘Registered’ users list, still searching by the email.

Power Automate compare sharepoint lists

As I’m now filtering in SharePoint items, this time I’ll get the whole items instead of just email addresses.

Summary

There’s currently no expression in Power Automate to compare two arrays and find the differences, but there’s again a workaround. Get both the arrays into your flow and let the ‘Filter array’ do the work. No loops, no comparing it item by item, a single action that’ll do the filtering for you.

This example was based on a SharePoint list, but it doesn’t stop there. You can use the same approach to compare any arrays, let it be single arrays or arrays with object, this solution will do the trick.


🚀 Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

8 thoughts on “Compare two arrays (e.g. SharePoint lists) using Power Automate”

  1. Randal J Flinn says:
    June 12, 2023 at 10:05 pm

    I believe I am following the example; however, I am not receiving the values missing in the second array (for my data).

    Reply
  2. Steve says:
    September 22, 2023 at 9:58 pm

    This is amazing! You rock!

    Reply
  3. El Baz says:
    September 23, 2023 at 2:05 am

    I’ve gotten this far. What I’m wondering is how would I compare vs Employee ID instead, then send an email to folk not on the missing list.

    Reply
    1. Tom says:
      October 22, 2023 at 3:37 pm

      Hello El Baz,
      use ‘contains’ or ‘does not contain’ depending if you need people ‘in’ the list or ‘not in’ the list.

      Reply
  4. Tung says:
    February 16, 2024 at 11:36 am

    Brilliant. This is exactly what I’m looking for!

    Reply
  5. C. Dubé says:
    November 27, 2024 at 3:20 am

    Power Automate change @not(contains(ArrayA,item()) to @not(notcontains(ArrayA,item()). Why?

    Reply
  6. Dan says:
    March 7, 2025 at 4:29 pm

    Does this still work? I can’t get it to.. there seems to have been a change with it. The “SELECT” now as a different map..

    Reply
    1. Tom says:
      March 17, 2025 at 9:16 pm

      Hello Dan,
      yes, I’ve been using this on regular basis.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

🚀 Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundle—everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes