How to Fill Down Surnames in Excel Power Query
Question details
The user needs to extract surname header rows and fill them down into the corresponding individual burial records using Power Query.

- Product
- Excel Power Query
- Device & OS
- not provided
- Scenario
- Organizing hierarchical data where surnames appear as header rows above individual records, such as burial dates and first names.
- Observed behavior
- Surnames need to be populated into a new column for each related record, and the original header rows must be removed to create a clean, flat dataset.
Ensure your burial records dataset is imported into Power Query and identify the logic that distinguishes a surname header row from a standard record (e.g., a null value in the Date column).
Use Conditional Column and Fill Down in Power Query
Create a conditional column to capture the surname, fill it down to all related rows, and filter out the original header rows.
By identifying a pattern in your data, such as empty date fields on rows containing only a surname, you can conditionally extract the surname and apply Power Query's Fill Down feature to cascade the data to related records.
Navigate to the 'Add Column' tab and select 'Conditional Column'. Name the new column 'Surname'. Set the logic: If the 'Date' column equals 'null', output the value from the 'Name' column; otherwise, output 'null'.
Right-click the header of your new 'Surname' column, hover over 'Fill', and select 'Down'. This action will duplicate the surname into all subsequent rows until the next surname is encountered.
Click the filter drop-down arrow on the 'Date' column and uncheck the 'null' (or blank) option. This filters out the original header rows that only contained the surnames.
Reorder your columns by dragging the 'Surname' column to your preferred position. Apply the correct data types to your columns, then go to the 'Home' tab and click 'Close & Load' to return the cleaned dataset to your worksheet.

Need a Lightweight Tool for Data Management? Try WPS Office
While Power Query is a powerful feature in Microsoft Excel, it can be resource-heavy or overly complex for simpler tasks. WPS Office offers a free, lightweight, and user-friendly spreadsheet application with seamless compatibility for Microsoft formats. You can easily organize, filter, and clean your datasets using intuitive tools and formulas without a steep learning curve.

Frequently Asked Questions
Why did Fill Down not work on my newly created column?
Fill Down only works on 'null' values in Power Query. If your conditional column resulted in empty text strings ("") instead of true nulls, Fill Down will ignore them. Ensure your conditional column logic outputs the actual 'null' keyword when conditions are not met.
Can I use this method if the surname header spans multiple columns?
Yes, but you may need to merge the header columns first or adjust your conditional column logic to check for nulls across multiple adjacent columns before extracting the surname.
How do I remove the blank rows after filling down the surnames?
You can filter out the original header rows by clicking the filter drop-down on a column that should always have data for a valid record (such as the Date or Record ID column) and unchecking the 'null' or '(Blank)' option.




