Table.FillDown 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.FillDown function in Power Query fills the empty (null) cells in a column with the value from the cell above. You need it when a report shows a value only once, at the start of a group, and leaves the rows below it blank.

Below, I’ll show you how to fill one column, several columns, or every column, and how to handle the cases where fill down doesn’t do what you expect.

Follow along with the example file

Table.FillDown Function Examples.xlsx

Download

Table.FillDown Function Syntax

= Table.FillDown(table as table, columns as list) as table
  • table – the table that has the blank cells. This is usually the previous step, such as Source.
  • columns – a list of the column names you want to fill, in curly brackets, such as {"Store"} or {"Order ID","Customer"}. Only these columns change.

What it returns – the same table, where every null cell in the listed columns gets the value from the nearest non-null cell above it.

The function only fills cells that are null. A cell that holds anything else, even an empty text value or a space, counts as a value, so it’s left as it is and copied down instead.

I’ve tested the Table.FillDown function in Power Query in Excel for Microsoft 365. It’s also part of the Power Query M language that Power BI uses.

When to Use the Table.FillDown Function

Use this function when you need to:

  • Fill in a column that shows a value only on the first row of each group
  • Clean up a report copied from a Pivot Table, where row labels aren’t repeated
  • Repeat an order’s details (like the order ID and customer) on every line of that order
  • Carry the last known value down until a new value appears
  • Turn section heading rows into a proper column you can filter and group by

Example 1: Fill Down One Column

Let’s start with the most common case, where one column shows a value only once for each group.

Below is an Excel table named StoreSales with units sold for each product, where the store name appears only on the first row for that store. I want to fill the store name down in the Store column, so every row shows its store.

StoreSales table with Store, Product and Units Sold, where the store name shows only on its first row and null below it

To follow along, select any cell in the table and go to Data > From Table/Range to open it in the Power Query Editor. The blank store cells show up as null there.

If Power Query added a Changed Type step when you opened the table, use #"Changed Type" in place of Source in the formula below. Pointing at Source skips that step, so its data types are lost (the fill still works).

The same goes for the later examples that use an fx step.

Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:

= Table.FillDown(Source,{"Store"})

Result: every row now has a store name, with Downtown on rows 1 to 3, Riverside on rows 4 and 5, Airport on rows 6 to 8, and Harbor View on rows 9 and 10

Store column filled down so every row shows Downtown, Riverside, Airport or Harbor View

Here, Table.FillDown goes down the Store column from the top. Each time it finds a null, it copies in the last store name it saw, and it keeps doing that until it reaches a new store name.

The column name must match the header exactly, including its capitalization. If you type {"store"}, the step fails with the error “The column ‘store’ of the table wasn’t found.”

You can also do this without a formula. Right-click the column header in the Power Query Editor and choose Fill > Down.

If you need to do this outside Power Query, here’s how to fill down blank cells in Excel with Go To Special and VBA.

Example 2: Fill Down Several Columns at Once

Now let’s fill more than one column in the same step.

Below is an Excel table named OrderLines with one row for each item in an order. The order ID, order date, and customer appear only on the first line of each order, and I want to fill all three columns down.

OrderLines table where Order ID, Order Date and Customer show only on the first line of each order

Open the table in the Power Query Editor. Excel dates come into Power Query as date and time values, so the order dates show as 3/2/2026 12:00:00 AM.

To drop the time part, click the type icon on the Order Date header and choose Date. This creates a step named Changed Type (if Power Query already added one, choose Replace current when it asks).

Now add a new step with the fx icon and use this formula:

= Table.FillDown(#"Changed Type",{"Order ID","Order Date","Customer"})

Result: every item row now shows its Order ID, Order Date, and Customer, so the Gel Pen and Stapler rows below Notebook show SO-1041, 3/2/2026, and Lawrence Palmer

Order ID, Order Date and Customer filled down on every item row, with dates shown as 3/2/2026

Here, the list in the second argument has three column names, so Table.FillDown fills all three in one go. Each column is filled on its own, from its own last value, so the order of the names in the list doesn’t matter.

The fill also keeps each column’s data type. Since Order Date was set to Date before the fill, the filled dates are dates too and show without the time.

Example 3: Fill Down Every Column in the Table

Sometimes you want to fill every column, and typing all the names gets tedious (and a typed list misses any column added later).

Below is an Excel table named IngredientPrices with the weekly price per kg of three ingredients, where a price is entered only in the week it changes. I want to fill every column down, so each week shows the price that applied that week.

IngredientPrices table with weekly Flour, Sugar and Butter prices entered only when they change

Open the table in the Power Query Editor, add a new step with the fx icon, and use this formula:

= Table.FillDown(Source,Table.ColumnNames(Source))

Result: every week now has a Flour, Sugar, and Butter price, so Week 2 shows 1.2, 2.4, and 8.5, and Week 6 shows 1.25, 2.55, and 8.9

Every week now shows a Flour, Sugar and Butter price

Here, the Table.ColumnNames function returns a list of all the column names in the table, and Table.FillDown uses that list as its second argument. Because the list is built when the query runs, a new ingredient column added later gets filled too.

The Week column is in that list as well, but it has no blank cells, so nothing in it changes. Filling a column that has no nulls is harmless.

Example 4: Fill Down Before You Group the Data

Filling down usually isn’t the last step. Most of the time, you do it so that a later step, like a group or a filter, works on every row.

Below is an Excel table named DeptExpenses with expenses for each department, where the department name appears only on its first row. I want the total amount for each department, in a new Total column.

DeptExpenses table where the department name shows only on its first expense row

If you group this data as it is, all the rows with a blank department end up together in one group named null, with a total of 4550. So the Department column has to be filled first.

To do both steps together, create a blank query (Data > Get Data > From Other Sources > Blank Query). In the Power Query Editor, open the Advanced Editor (Home > Advanced Editor) and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="DeptExpenses"]}[Content],
#"Filled Down" = Table.FillDown(Source,{"Department"}),
#"Grouped Rows" = Table.Group(#"Filled Down",{"Department"},{{"Total",each List.Sum([Amount]),type number}})
in
#"Grouped Rows"

Result: three rows, Marketing with a Total of 2350, IT with 2540, and Facilities with 2250

Three rows with the Total for Marketing (2350), IT (2540) and Facilities (2250)

Here, the Filled Down step puts the department name on every row first. Then the Table.Group function groups the rows by Department and adds up the Amount values in each group.

The Source line reads the table by its name, so if your table has a different name, change DeptExpenses to that name. The same goes for the other examples that use this code.

Follow along with the example file

Table.FillDown Function Examples.xlsx

Download

Example 5: Blank Cells That Aren’t Null

This next one catches a lot of people. The cells look blank in Excel, but Table.FillDown doesn’t fill them.

Below is an Excel table named ProjectTasks with tasks for three projects, where the project name appears only on the first task of each project. I want to fill the project name down in the Project column.

ProjectTasks table where the cells below each project name look blank but do not show null

Open the table in the Power Query Editor, add a new step with the fx icon, and use this formula:

= Table.FillDown(Source,{"Project"})

Result: nothing changes, and the cells below each project name are still empty

After Table.FillDown the Project cells below each name are still empty

Look closely at those cells in the Power Query Editor. A true blank shows the word null, but these cells show nothing at all.

That’s because they hold an empty text value, not a null.

Since Table.FillDown fills only nulls, it treats the empty text as a real value and leaves it alone. You’ll get cells like these when you copy formulas that returned “” and paste them as values.

The fix is to turn the empty text into null first, and then fill down. Create a blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="ProjectTasks"]}[Content],
#"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"Project"}),
#"Filled Down" = Table.FillDown(#"Replaced Value",{"Project"})
in
#"Filled Down"

Result: every task now has its project name, with Website Redesign on the first three tasks, Mobile App on the next two, and Help Center on the last two

Project filled down on every task after the empty text is replaced with null

Here, the Table.ReplaceValue function replaces every empty text value in the Project column with null. Once they are real nulls, Table.FillDown fills them as usual.

A cell that holds just a space has the same problem, because a space is also a value. Use " " as the value to replace in that case.

Example 6: When the First Rows Are Blank

Table.FillDown needs a value above a blank cell to copy. So what happens when the very first rows of a column are blank?

Below is an Excel table named ShiftOutput with units made by each worker, where the shift name appears only when a new shift starts. The first two rows have no shift, and I want to fill the shift name down in the Shift column.

ShiftOutput table where the first two rows have no shift and the shift name shows only when a shift starts

Open the table in the Power Query Editor, add a new step with the fx icon, and use this formula:

= Table.FillDown(Source,{"Shift"})

Result: Barbara and Brenda still have null in the Shift column, while the rows from Stephanie down are filled with Day or Night

Barbara and Brenda still show null in Shift, while the rows below are filled with Day or Night

Here, there’s no value above the first two rows, so Table.FillDown has nothing to copy into them, and they stay null. Every blank below the first Day gets filled as usual.

Table.FillUp wouldn’t help here, because it would copy Day up into those two rows, and that isn’t known to be right. Instead, give these rows a clear label once the fill is done.

Create a blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="ShiftOutput"]}[Content],
#"Filled Down" = Table.FillDown(Source,{"Shift"}),
#"Replaced Value" = Table.ReplaceValue(#"Filled Down",null,"Unassigned",Replacer.ReplaceValue,{"Shift"})
in
#"Replaced Value"

Result: Barbara and Brenda now show Unassigned in the Shift column, and the other rows keep their filled Day and Night values

Barbara and Brenda now show Unassigned in the Shift column

Here, the Replaced Value step runs after the fill, so the only nulls left in the Shift column are the two at the top. It replaces those with Unassigned, which makes them easy to spot and filter later.

Example 7: Turn Section Heading Rows Into a Column

Some reports don’t have a column for the group at all. Instead, the group name sits on its own row, above the rows that belong to it.

Below is an Excel table named StaffDirectory with employee badge IDs, where each department name sits in the Employee column on its own row, with no badge ID. I want the department in a new Department column, without the heading rows.

StaffDirectory table where Finance, Sales and Support sit on their own rows with null Badge ID

Create a blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="StaffDirectory"]}[Content],
#"Added Custom" = Table.AddColumn(Source,"Department",each if [#"Badge ID"] = null then [Employee] else null,type text),
#"Filled Down" = Table.FillDown(#"Added Custom",{"Department"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down",each [#"Badge ID"] <> null)
in
#"Filtered Rows"

Result: eight employee rows with a Department column, where Brittany Cook and Jacqueline Gibson show Finance, the next three show Sales, and the last three show Support

Eight employee rows with a new Department column showing Finance, Sales or Support

Here, the Table.AddColumn step adds a Department text column that copies the Employee value only on the heading rows (the ones with no badge ID) and leaves null everywhere else.

Table.FillDown then copies each department name down to the employees below it. Finally, the Table.SelectRows step keeps only the rows that have a badge ID, which removes the heading rows.

Example 8: Fill Down Within Each Group Only

Table.FillDown doesn’t know anything about groups. It always copies the last value above, even if that value belongs to a different group.

Below is an Excel table named TicketLog with ticket updates, where the agent name is entered only when an agent picks up the ticket. Ticket TK-202 has no agent on its first update, and I want to fill the agent down in the Agent column.

TicketLog table where the agent is entered only when an agent picks up the ticket, and TK-202 has no agent on its first update

If you use a plain fill down on the Agent column, like this:

= Table.FillDown(Source,{"Agent"})

Result: the Opened update of TK-202 shows Travis, the agent from the previous ticket

Plain fill down gives the TK-202 Opened update the agent Travis from TK-201

That’s wrong, because Travis never worked on TK-202. The fill copied the last agent it saw, which happened to be on TK-201.

To fill each ticket on its own, create a blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="TicketLog"]}[Content],
#"Grouped Rows" = Table.Group(Source,{"Ticket"},{{"Rows",each Table.FillDown(_,{"Agent"}),type table}}),
Combined = Table.Combine(#"Grouped Rows"[Rows])
in
Combined

Result: the Opened update of TK-202 is null, and its later updates show Dorothy, while TK-201 shows Travis and TK-203 shows Julia on every update

TK-202 Opened stays null and its later updates show Dorothy, with Travis on TK-201 and Julia on TK-203

Here, the Table.Group function splits the log into one small table for each ticket and runs Table.FillDown on each one, where the underscore _ stands for that ticket’s rows. So a fill can never cross from one ticket into the next.

Then the Table.Combine function stacks the filled tables back into one. The first update of TK-202 stays null, which is correct, since no agent had picked it up yet.

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.