The List.Union function in Power Query combines two or more lists into one list. A value that’s already in one list isn’t added again when it shows up in another, so you get every value without the extra repeats.
It’s not quite the same as removing duplicates, though, because a value repeated inside a single list stays repeated. In this article, I’ll show you how List.Union works, how it handles repeats, and how to use it on table columns.
Follow along with the example file
List.Union Function Examples.xlsx
List.Union Function Syntax
List.Union(lists as list, optional equationCriteria as any) as list
- lists – the lists you want to combine, put together inside one outer list. So two lists go in as
{List1,List2}, with an extra pair of curly brackets around them. - equationCriteria (optional) – tells List.Union how to decide that two values match. For example,
Comparer.OrdinalIgnoreCasemakes it ignore upper and lower case (Example 6).
What it returns: A list with every value from all the lists. It starts with the first list in its own order, then adds the new values from each later list.
The List.Union function is part of the Power Query M language, and Power Query is built into Excel 365, 2024, 2021, 2019, and 2016 for Windows. Excel for Microsoft 365 on Mac has Power Query too, but Excel 2016 and 2019 for Mac don’t.
When to Use the List.Union Function
Use this function when you need to:
- Combine two or more lists into one, without adding a value that’s already there
- Build one master list from the same column in two tables
- Get a list of every value, ignoring upper and lower case
- Combine IDs stored as numbers in one list and as text in another
- Get a unique list of tags from a column with comma-separated values
- Combine every column of a table into one list
Example 1: Combine Two Lists Without Repeats
Let’s start with a simple one. Suppose you’re baking pancakes and cookies, you have the ingredient list for each, and you want one shopping list with each ingredient once.
Create a new blank query (Data > Get Data > From Other Sources > Blank Query). In the Power Query Editor that opens, type this formula in the formula bar:
= List.Union({{"Flour","Eggs","Milk","Butter"},{"Flour","Sugar","Butter","Eggs","Vanilla"}})
Result: A list with Flour, Eggs, Milk, Butter, Sugar, and Vanilla

Here, each inner pair of curly brackets is one recipe’s list. The outer pair holds both lists, and that’s the single argument List.Union needs.
The result starts with the pancake list as it is. Then it adds only the cookie ingredients that weren’t there yet, Sugar and Vanilla, so Flour, Butter, and Eggs don’t show up twice.
If you used the List.Combine function instead, you’d get all nine items, with Flour, Eggs, and Butter in the list twice. List.Combine joins the lists as they are, while List.Union skips the values it already has.
And if you want only the ingredients both recipes share, use the List.Intersect function.
In the example file, Example 1 types its values right into the query, so it doesn’t have a sheet. You can open it from Data > Queries & Connections.
Example 2: Combine Three or More Lists
List.Union isn’t limited to two lists. Suppose Edward, Teresa, and Lydia each told you the software tools they use, and you want one list of every tool your team needs a license for.
Create a new blank query (as in Example 1), open the Advanced Editor (Home > Advanced Editor), and use this code:
let
Edward = {"Excel","Power BI","SQL"},
Teresa = {"SQL","Python"},
Lydia = {"Excel","Python","Tableau"},
AllTools = List.Union({Edward,Teresa,Lydia})
in
AllTools
Result: A list with Excel, Power BI, SQL, Python, and Tableau

Here, the first three steps hold each person’s tools as a list. The last step puts all three lists inside one pair of curly brackets, and List.Union returns each tool once.
Teresa’s list adds Python, and Lydia’s list adds Tableau. Her Excel and Python are already in the result, so they aren’t added again.
To add a fourth person, add a step with their list and put its name inside the curly brackets in the last step.
Example 3: Combine a Column from Two Tables
This one comes up a lot with real data. I have the suppliers we used in Q1 in one table and the suppliers from Q2 in another, and I want one list of every supplier.
Below is the Q1 table, on the Example 3 Q1 sheet.

And here is the Q2 table, on the Example 3 Q2 sheet. It has the same two columns.

The two tables are Excel Tables named SuppliersQ1 and SuppliersQ2. The code below reads them by those names, so for your own data, change the names to match your tables.
Create a new blank query, open the Advanced Editor, and use this code:
let
Source = Excel.CurrentWorkbook(){[Name="SuppliersQ1"]}[Content],
Q2 = Excel.CurrentWorkbook(){[Name="SuppliersQ2"]}[Content],
AllSuppliers = List.Union({Source[Supplier],Q2[Supplier]})
in
AllSuppliers
Result: A list with Northfield Packaging, Bluepeak Metals, Crestline Plastics, Lakeside Freight, Summit Labels, and Ridgeway Chemicals

Here, the Source step reads the Q1 table and the Q2 step reads the Q2 table. Source[Supplier] and Q2[Supplier] each give the Supplier column as a list, and List.Union combines the two.
Crestline Plastics and Northfield Packaging were suppliers in both quarters, but each shows up only once. Summit Labels and Ridgeway Chemicals are added at the end because they’re new in Q2.
Each supplier appears once per table here. If a column has the same value in several rows, List.Union keeps those repeats, which Examples 4 and 5 explain.
Example 4: Understand How Repeated Values Are Handled
This is the part of List.Union that surprises people. It keeps each value as many times as it shows up in the one list where it repeats the most.
Suppose a crew has two jobs this week. Job A needs two hammers, a drill, and a tape measure, and Job B needs two drills, a saw, and a hammer.
You want to load the van with enough tools for either job.
Create a new blank query, open the Advanced Editor, and use this code:
let
JobA = {"Hammer","Hammer","Drill","Tape Measure"},
JobB = {"Drill","Drill","Saw","Hammer"},
VanKit = List.Union({JobA,JobB})
in
VanKit
Result: A list with Hammer, Hammer, Drill, Tape Measure, Drill, and Saw

Here, Hammer shows up twice because Job A needs two, and Job B’s one hammer is already covered. Drill also shows up twice, because Job B needs two and Job A had only one.
So you get two hammers, two drills, a tape measure, and a saw, which is exactly enough for either job. Microsoft calls this “bag semantics”, and it’s why List.Union isn’t the same as removing duplicates.
The second drill comes after Tape Measure, because List.Union adds the extra copy where it finds it in Job B’s list. If you want each value only once, Example 5 shows how.
Follow along with the example file
List.Union Function Examples.xlsx
Example 5: Get Each Value Only Once
Most of the time, you want each value once, even when a column repeats it. Below is a table named TicketCategories with the category of each support ticket logged in Week 1 and in Week 2, and I want a list of every category.

Each column is its own list of tickets, so the values in the same row aren’t related. Login and Billing each show up twice in Week 1, and Shipping shows up twice in Week 2.
In the example file, each example’s table is on its own sheet, and the finished queries are under Data > Queries & Connections.
To follow along, select any cell in the table and go to Data > From Table/Range to open it in the Power Query Editor. If Power Query adds a Changed Type step, use #"Changed Type" in place of Source in the formulas in this article.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= List.Distinct(List.Union({Source[Week 1],Source[Week 2]}))
Result: A list with Login, Billing, Shipping, Refund, and Account

Here, List.Union combines the Week 1 and Week 2 columns, and the List.Distinct function around it removes the repeats that are left.
Without List.Distinct, you’d get eight items: Login, Billing, Login, Shipping, Billing, Shipping, Refund, and Account. Login and Billing repeat inside Week 1, and Shipping repeats inside Week 2, so List.Union keeps each of them twice.
You can also write this as List.Distinct(List.Combine({Source[Week 1],Source[Week 2]})). It returns the same five categories, because List.Distinct removes every repeat no matter which function joined the lists.
Example 6: Ignore Upper and Lower Case
By default, List.Union treats “Austin” and “austin” as two different values. Below is a table named EventCities with the cities people came from for a spring event and a fall event, and I want one list of every city.

Each column is a separate list of cities, so the rows aren’t related. Some cities were typed with different upper and lower case, like austin and DENVER.
Load the EventCities table into the Power Query Editor (as in Example 5), then add a new step and use this formula:
= List.Union({Source[Spring Event],Source[Fall Event]},Comparer.OrdinalIgnoreCase)
Result: A list with Denver, austin, Boston, Portland, and Seattle

Here, Comparer.OrdinalIgnoreCase is the second argument, and it tells List.Union to ignore upper and lower case when it compares the cities. Without it, you’d get all eight cities, because Austin, DENVER, and portland in the Fall column wouldn’t match the Spring spellings.
When two spellings match, the result keeps the one it saw first. That’s why you get austin in lowercase, as it was typed in the Spring Event column.
The comparer only ignores case. A city with an extra space at the end still won’t match, so trim both columns first (select the columns, then Transform > Format > Trim).
Trimming adds a new step under Applied Steps. Use that step’s name in place of Source in the formula, so List.Union reads the trimmed columns.
Example 7: Combine Numbers and Numbers Stored as Text
Here’s a problem that’s easy to miss. One system has the invoice numbers 5101 to 5103 as numbers, another system exported 5103 and 5104 as text, and you want one list of every invoice.
If you run List.Union on these two lists as they are, you get five items, with 5103 in the list twice. The number 5103 and the text “5103” are different values to Power Query, so they don’t match.
The fix is to turn the numbers into text first. Create a new blank query, open the Advanced Editor, and use this code:
let
SystemA = {5101,5102,5103},
SystemB = {"5103","5104"},
AllInvoices = List.Union({List.Transform(SystemA,Text.From),SystemB})
in
AllInvoices
Result: A list with 5101, 5102, 5103, and 5104

Here, the List.Transform function runs the Text.From function on every number in SystemA, so 5101 becomes “5101” and so on. Now both lists hold text, and 5103 is added only once.
When you combine columns from two tables and see a value twice, check the column types first.
The same fix works for table columns. In the List.Union formula, wrap the column that holds numbers in List.Transform with Text.From, exactly as SystemA is wrapped above.
Converting to text is safer than converting to numbers, because text keeps leading zeros and doesn’t error on an invoice number like “INV-88”.
Example 8: Get a Unique List of Tags
Now let’s use List.Union on lists that come from a single column. Below is a table named BlogPosts with the title of each post and its tags, separated by a comma and a space, and I want one list of every tag used.

Load the BlogPosts table into the Power Query Editor (as in Example 5), then add a new step and use this formula:
= List.Union(List.Transform(Source[Tags],each Text.Split(_,", ")))
Result: A list with Pivot Tables, Beginner, Formulas, Lookup, Power Query, Data Cleaning, and Charts

Here, Source[Tags] gives the Tags column as a list of five text values. List.Transform runs the Text.Split function on each one, so each post’s tags become their own small list.
That gives you a list of five lists, and List.Union combines them into one. Each tag shows up once, in the order it first appears.
This works because no post has the same tag twice. If one did, that tag would show up twice in the result (Example 4 explains why), so wrap it in List.Distinct if your data can have that.
The split also looks for a comma followed by a space. If a row has a comma with no space after it, those two tags stay joined as one, so check that every row uses a comma and a space.
Example 9: Combine Every Column of a Table
In this last example, let’s combine a whole table at once. Below is a table named VolunteerRota with the volunteers who signed up for each day, one column per day, and I want a list of everyone who signed up.

Load the VolunteerRota table into the Power Query Editor (as in Example 5), then add a new step and use this formula:
= List.Union(Table.ToColumns(Source))
Result: A list with Brenda, Raymond, Miranda, Dean, Samantha, Harold, Gordon, and Shannon

Here, the Table.ToColumns function turns the table into a list of lists, one list per column. That’s exactly the shape List.Union needs, so it combines all three days without you naming any column.
This also means the query keeps working when you add a Saturday column to the table. Click Refresh, and it includes the new column too.
If a day has fewer volunteers, its empty cells come into Power Query as null, and List.Union keeps null as a value in the result. When that happens, wrap the result in the List.RemoveNulls function.
Other Excel Articles You May Also Like:
- Table.Combine – Use Table.Combine in Power Query M to stack multiple tables into one by appending rows.
- List.Difference – Use List.Difference in Power Query M to find items in one list but not another.
- Table.Join – Use Table.Join in Power Query M to join two tables.
- Table.Distinct – Use Table.Distinct in Power Query M to remove duplicate rows.
- List.IsDistinct – Use List.IsDistinct in Power Query M to check if every value in a list is unique.
- Text.Combine – Guide to Text.Combine in Power Query M.
- List.RemoveItems – Use List.RemoveItems in Power Query M to remove values from a list.
- List.Zip – Use List.Zip in Power Query M to pair up items from several lists.