Table.ExpandListColumn Function in Power Query M

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

The Table.ExpandListColumn function in Power Query takes a column that holds lists and gives each item in the list its own row. Paired with a split step, it’s how you turn a cell like “Madison, Dennis, Nolan” into three separate rows, one per name.

In this article, I’ll show you how to use Table.ExpandListColumn with practical examples, including splitting comma-separated values and line breaks into rows, creating one row per day in a date range, and expanding JSON data.

Follow along with the example file

Table.ExpandListColumn Function Examples.xlsx

Download

Table.ExpandListColumn Function Syntax

= Table.ExpandListColumn(table as table, column as text) as table
  • table – the table that has the list column, usually the previous step in your query (such as Source).
  • column – the name of the column that holds the lists, as text in double quotes (such as "Team").

What it returns – a table with one row for each item in each list. The values in the other columns are copied into every new row, and the expanded column keeps its original name.

The Table.ExpandListColumn function works in Power Query in Excel for Microsoft 365, 2024, 2021, 2019, 2016, and Excel for Mac (Microsoft 365), as well as in Power BI.

When to Use the Table.ExpandListColumn Function

Use this function when you need to:

  • Split comma-separated values in a cell into separate rows
  • Split text with line breaks (Alt + Enter) into one row per line
  • Create one row for each day between a start date and an end date
  • Repeat each row a set number of times, such as one row per box in an order
  • Turn nested JSON data (a list of items inside each record) into rows

Example 1: Expand a List Column into Rows

Let’s start with a simple example to see what the function does.

Say you have a table of gift boxes, where the Items column holds a list of the items in each box, and you want each item in its own row.

In the example file, Examples 1 and 8 are saved as queries only, since they don’t need any worksheet data. You can open them from Data > Queries & Connections.

Create a new blank query (in Excel, go to Data > Get Data > From Other Sources > Blank Query), open the Advanced Editor (Home > Advanced Editor), and replace its code with this:

let
Source = #table({"Gift Box","Price","Items"},{{"Coffee Lover",35,{"Ground Coffee","Mug","Biscotti"}},{"Tea Time",28,{"Green Tea","Honey"}}}),
#"Expanded Items" = Table.ExpandListColumn(Source,"Items")
in
#"Expanded Items"

Result: a table with five rows, one for each item (Ground Coffee, Mug, and Biscotti for Coffee Lover, and Green Tea and Honey for Tea Time)

Each gift box item gets its own row, with the Gift Box and Price repeated

Here, the Source step uses the #table function to create a small table with two rows. In the Items column, each cell holds a list (the values inside curly brackets).

If you click the Source step in the Applied Steps pane, you’ll see the word List in those cells.

Table.ExpandListColumn then gives each item in the list its own row. Coffee Lover has three items, so it now takes up three rows, and Tea Time takes up two.

The Gift Box and Price values are copied into each new row. That’s why you see Coffee Lover and 35 three times.

Example 2: Split Comma-Separated Values into Rows

This is the most common reason to use this function.

Below is a Projects table with the team members of each project in one cell, separated by commas, and I want each team member in a separate row.

A Projects table with the team members of each project in one cell, separated by commas

Select any cell in the table and go to Data > From Table/Range to open it in the Power Query Editor. Then open the Advanced Editor (Home > Advanced Editor) and replace the code with this:

let
Source = Excel.CurrentWorkbook(){[Name="Projects"]}[Content],
#"Split Team" = Table.TransformColumns(Source,{{"Team",each Text.Split(_,", ")}}),
#"Expanded Team" = Table.ExpandListColumn(#"Split Team","Team")
in
#"Expanded Team"

Result: a table with Project and Team columns, with one row for each team member (10 rows in all)

Each team member is now in a separate row next to the project name

Here, Table.ExpandListColumn needs a column of lists, and the Team column holds plain text. So the Split Team step first turns each cell into a list.

The Table.TransformColumns function runs Text.Split(_,", ") on every Team cell. This splits the text at each comma followed by a space, so “Curtis, Emily” becomes the list {“Curtis”,”Emily”}.

The Expanded Team step then gives each name its own row, and copies the project name next to it. Office Move had four people, so it now has four rows.

The delimiter ", " includes the space after the comma. If a cell has no space after a comma, like “Curtis,Emily”, the delimiter doesn’t match, and the whole text stays as one name.

For data like that, use each List.Transform(Text.Split(_,","),Text.Trim) in the Split Team step. It splits at every comma, and the Text.Trim function then removes the extra spaces from each name.

Example 3: Split Lines in a Cell into Rows

Sometimes the values in a cell are on separate lines (typed with Alt + Enter) instead of being separated by commas.

Below is an Events table with the tasks for each event on separate lines in the same cell, and I want each task in its own row.

An Events table with the tasks for each event on separate lines in one cell

Open the table in the Power Query Editor (Data > From Table/Range), open the Advanced Editor, and replace the code with this:

let
Source = Excel.CurrentWorkbook(){[Name="Events"]}[Content],
#"Split Tasks" = Table.TransformColumns(Source,{{"Tasks",Lines.FromText}}),
#"Expanded Tasks" = Table.ExpandListColumn(#"Split Tasks","Tasks")
in
#"Expanded Tasks"

Result: a table with Event and Tasks columns, with one row for each task (8 rows in all)

Each task is now in its own row next to the event name

Here, the Lines.FromText function splits the text at every line break and returns a list of the lines. So the Spring Fair cell becomes a list of three tasks.

Table.ExpandListColumn then puts each task in a separate row, with the event name next to it.

Lines.FromText is written on its own, without each and _, because it needs only the cell text, which Table.TransformColumns passes to it. The Text.Split function in Example 2 also needs the delimiter, so it’s wrapped in each, with _ standing for the cell.

Example 4: Keep Rows That Have a Blank Cell

Real data often has blank cells, and they need a little extra care before you split them.

Below is a Certifications table with the certifications each employee holds, separated by commas, and I want each certification in its own row. Two employees don’t have any certifications yet, so their cells are blank.

A Certifications table where two employees have a blank cell

If you use each Text.Split(_,", ") from Example 2 here, the expand step fails with the error “We cannot convert the value null to type Text.” That’s because a blank cell comes into Power Query as null, and the Text.Split function can’t split a null.

So the formula has to skip the blank cells. Open the table in the Power Query Editor, open the Advanced Editor, and replace the code with this:

let
Source = Excel.CurrentWorkbook(){[Name="Certifications"]}[Content],
#"Split Certifications" = Table.TransformColumns(Source,{{"Certifications",each if _=null then null else Text.Split(_,", ")}}),
#"Expanded Certifications" = Table.ExpandListColumn(#"Split Certifications","Certifications")
in
#"Expanded Certifications"

Result: a table with one row for each certification, plus one row each for Gerald Shaw and Sophia Brooks with null in the Certifications column (8 rows in all)

One row per certification, with Gerald Shaw and Sophia Brooks kept with null

Here, if _=null then null else Text.Split(_,", ") leaves a blank cell as null and splits the rest.

Table.ExpandListColumn keeps a row whose value is null, so Gerald Shaw and Sophia Brooks are still in the result. The same thing happens with an empty list ({}), which also becomes a single row with null.

This way, every employee still shows up in the result, even the ones without a certification. If you’d rather drop those rows, filter out null in the Certifications column after the expand step.

Follow along with the example file

Table.ExpandListColumn Function Examples.xlsx

Download

Example 5: Create One Row for Each Day in a Date Range

This next one is a common reporting task, where each row has a start date and an end date.

Below is a Leave table with the first and last day of each employee’s leave, and I want one row for every day of the leave, with the date in a new Date column.

A Leave table with the start and end date of each employee's leave

Open the table in the Power Query Editor, open the Advanced Editor, and replace the code with this:

let
Source = Excel.CurrentWorkbook(){[Name="Leave"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Start",type date},{"End",type date}}),
#"Added Dates" = Table.AddColumn(#"Changed Type","Date",each List.Dates([Start],Duration.Days([End]-[Start])+1,#duration(1,0,0,0))),
#"Expanded Dates" = Table.ExpandListColumn(#"Added Dates","Date"),
#"Typed Dates" = Table.TransformColumnTypes(#"Expanded Dates",{{"Date",type date}})
in
#"Typed Dates"

Result: a table with six rows, three for Dominic Hamilton (3/2/2026 to 3/4/2026), two for Cassandra Martin (3/9/2026 and 3/10/2026), and one for Karen Ross (3/16/2026)

One row for every day of each employee's leave, with the date in the Date column

Here, the Changed Type step sets the Start and End columns to the Date type. Dates from an Excel table come in as date and time values, and the List.Dates function needs dates.

Without this step, you’d get an error like “We cannot convert the value #datetime(2026, 3, 2, 0, 0, 0) to type Date.”

The Added Dates step uses the List.Dates function to create a list of dates for each row. It starts at the Start date and adds one day at a time (#duration(1,0,0,0) is one day).

The number of dates is Duration.Days([End]-[Start])+1. The Duration.Days function returns the number of days between the two dates, and +1 counts the start day too.

So Karen Ross, with the same start and end date, gets one day.

Table.ExpandListColumn then gives each date its own row. The expanded column has no data type (Any), so the last step sets it to Date.

The dates show in your computer’s regional date format, so a UK machine shows 02/03/2026 for March 2, 2026.

Example 6: Repeat Each Row a Set Number of Times

You can also use Table.ExpandListColumn to repeat a row, by giving it a list of numbers.

Below is a Shipments table with the number of boxes in each order, and I want one row for each box, with a label like “Box 1 of 3” that can be printed and stuck on the box.

A Shipments table with the number of boxes in each order

Open the table in the Power Query Editor, open the Advanced Editor, and replace the code with this:

let
Source = Excel.CurrentWorkbook(){[Name="Shipments"]}[Content],
#"Added Box" = Table.AddColumn(Source,"Box",each {1..[Boxes]}),
#"Expanded Box" = Table.ExpandListColumn(#"Added Box","Box"),
#"Added Label" = Table.AddColumn(#"Expanded Box","Label",each "Box "&Text.From([Box])&" of "&Text.From([Boxes]),type text)
in
#"Added Label"

Result: a table with six rows, three for order SO-2041, one for SO-2042, and two for SO-2043, with labels from “Box 1 of 3” to “Box 2 of 2”

One row for each box, with a Box 1 of 3 style label

Here, the Added Box step uses the Table.AddColumn function with {1..[Boxes]}. This creates a list of numbers from 1 to the number of boxes, so an order with 3 boxes gets the list {1,2,3}.

Table.ExpandListColumn turns each number into its own row, so the order and customer are repeated once for each box.

The Added Label step then joins the text “Box “, the box number, ” of “, and the total number of boxes. The Text.From function turns the numbers into text, so they can be joined with &.

Example 7: Expand Two List Columns Together

This one catches a lot of people, so it’s worth seeing what goes wrong first.

Below is an Inventory table of T-shirt designs, with the sizes in one column and the quantity in stock for each size in the next. I want one row for each size, with its quantity next to it.

An Inventory table with the sizes and the quantity for each size of two T-shirt designs

In the example file, this table feeds two queries, Example 7 – Problem and Example 7 – Fix.

The obvious approach is to split both columns into lists and expand them one after the other, like this:

let
Source = Excel.CurrentWorkbook(){[Name="Inventory"]}[Content],
#"Split Lists" = Table.TransformColumns(Source,{{"Sizes",each Text.Split(_,", ")},{"Quantities",each Text.Split(_,", ")}}),
#"Expanded Sizes" = Table.ExpandListColumn(#"Split Lists","Sizes"),
#"Expanded Quantities" = Table.ExpandListColumn(#"Expanded Sizes","Quantities")
in
#"Expanded Quantities"

Result: a table with 13 rows instead of 5, where every size is paired with every quantity (S with 12, 8, and 5, M with 12, 8, and 5, and so on)

Expanding both columns pairs every size with every quantity, giving 13 rows

Here’s what went wrong. The first expand gives Mountain Tee three rows (S, M, and L), and each of those rows still holds the full list of quantities {12, 8, 5}.

The second expand then splits that list in each of the three rows. So you get 3 x 3 = 9 rows for Mountain Tee, and 2 x 2 = 4 rows for Sunset Tee.

To keep each size with its own quantity, pair the two lists first and expand only once. Open the Advanced Editor and use this code instead:

let
Source = Excel.CurrentWorkbook(){[Name="Inventory"]}[Content],
#"Added Pairs" = Table.AddColumn(Source,"Pairs",each List.Zip({Text.Split([Sizes],", "),Text.Split([Quantities],", ")})),
#"Expanded Pairs" = Table.ExpandListColumn(#"Added Pairs","Pairs"),
#"Added Size" = Table.AddColumn(#"Expanded Pairs","Size",each [Pairs]{0},type text),
#"Added Quantity" = Table.AddColumn(#"Added Size","Quantity",each Number.From([Pairs]{1}),Int64.Type),
#"Kept Columns" = Table.SelectColumns(#"Added Quantity",{"Design","Size","Quantity"})
in
#"Kept Columns"

Result: a table with Design, Size, and Quantity columns and five rows (Mountain Tee S 12, M 8, L 5, and Sunset Tee M 6, L 9)

Pairing the lists with List.Zip first keeps each size with its own quantity

Here, the List.Zip function takes the list of sizes and the list of quantities and pairs them by position. For Mountain Tee, it returns {{“S”,”12″},{“M”,”8″},{“L”,”5″}}, a list of three small lists.

Table.ExpandListColumn then gives each pair its own row, so the size and its quantity stay together.

The Added Size step takes the first item of each pair with [Pairs]{0} (positions start at 0). The Added Quantity step takes the second item with [Pairs]{1} and turns it into a number with the Number.From function.

The last step keeps only the Design, Size, and Quantity columns, so the original Sizes and Quantities columns and the helper Pairs column are gone.

Example 8: Expand Nested JSON Data into Rows

When you get data from a web API or a JSON file, a record often has a list inside it, like the items in an order. Table.ExpandListColumn is how you get those items into rows.

Say you have two orders as JSON text, where each order has a list of the products it contains, and you want one row per product.

Create a new blank query, open the Advanced Editor, and replace its code with this:

let
Source = Json.Document("[{""Order"":""A-101"",""Items"":[{""Product"":""Notebook"",""Qty"":2},{""Product"":""Pen"",""Qty"":5}]},{""Order"":""A-102"",""Items"":[{""Product"":""Stapler"",""Qty"":1}]}]"),
Orders = Table.FromRecords(Source),
#"Expanded Items" = Table.ExpandListColumn(Orders,"Items"),
#"Expanded Records" = Table.ExpandRecordColumn(#"Expanded Items","Items",{"Product","Qty"})
in
#"Expanded Records"

Result: a table with Order, Product, and Qty columns and three rows (A-101 Notebook 2, A-101 Pen 5, and A-102 Stapler 1)

One row for each product in each order, with Product and Qty columns

Here, the Json.Document function reads the JSON text and returns a list of two records, one for each order. The Table.FromRecords function turns that into a table with an Order column and an Items column, where each Items cell holds a list.

Table.ExpandListColumn gives each item its own row. Each item is still a record (with a Product and a Qty), so the Table.ExpandRecordColumn function then splits the record into Product and Qty columns.

The double quotes inside the JSON text are doubled (""), because that’s how you write a quote inside a text value in M. When the JSON comes from a file or a web address, you don’t need to do this.

If a column holds tables instead of lists, Table.ExpandListColumn still works, but each row of the inner table comes out as a record. In that case, the Table.ExpandTableColumn function is usually the better choice, since it expands the rows and the columns in one step.

Other Excel Articles You May Also Like:

All Power Query Functions

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.