Power Query Data Cleaning Techniques (2026)
Home›Excel›Power Query›Data Cleaning
ExcelSub-Guide⏱ 11 min read

Power Query Data Cleaning Techniques

Messy data is what Power Query was built for. This guide covers the cleaning tasks you'll do on almost every dataset — junk headers, mixed types, blank rows, split/merge columns, unpivoting, and error handling — with the ribbon paths and M equivalents.

The cleaning checklist

Work through these in order for most messy imports:

  1. Remove junk header rows
  2. Promote real headers
  3. Remove blank rows and blank columns
  4. Set data types explicitly
  5. Trim and clean text
  6. Split or merge columns as needed
  7. Handle errors and nulls
  8. Standardize inconsistent values
  9. Unpivot wide data if needed

Remove junk header rows

Reports often have title rows, blank lines, and metadata before the actual data.

Ribbon: Home → Remove Rows → Remove Top Rows → enter count

M equivalent: Table.Skip(Source, 3)

Also useful:

  • Remove Bottom Rows — for reports with summary/footer rows
  • Remove Alternate Rows — for double-spaced exports
  • Remove Duplicates — Home → Remove Rows → Remove Duplicates
  • Remove Blank Rows — Home → Remove Rows → Remove Blank Rows

Promote first row to headers

Ribbon: Transform → Use First Row as Headers (or Home tab in newer versions)

M: Table.PromoteHeaders(Source, [PromoteAllScalars=true])

Remove blank columns

Wide exports often include empty columns. Select them → right-click → Remove.

To find empty columns quickly: filter each column for blanks; if the count equals total rows, remove.

Set data types

The single most important cleaning step. Auto-detected types are guesses.

Ribbon: Select column → Home → Data Type → pick type

Or click the icon left of the column name for a quick change.

Common conversions:

  • Whole Number — for counts, IDs
  • Decimal Number — for currency, measurements
  • Date — for date-only values (no time)
  • Date/Time — for timestamps
  • Text — force numbers to stay as text (useful for IDs like "007")
Locale matters

Dates like "6/9/2026" mean different things in US (June 9) vs UK (September 6). Use Transform → Data Type → Using Locale to specify the source locale explicitly.

Trim and clean text

Ribbon: Transform → Format → Trim / Clean / UPPERCASE / lowercase / Capitalize

Trim removes leading and trailing whitespace. Clean removes non-printable characters (line breaks, tabs).

M functions: Text.Trim, Text.Clean, Text.Upper, Text.Lower, Text.Proper

Split columns

By delimiter

Ribbon: Right-click column → Split Column → By Delimiter

Pick the delimiter (comma, space, custom), and choose how to split (at each delimiter, leftmost only, rightmost only).

By number of characters

For fixed-width fields like "USA-042" (country code, then dash, then number). Split at position 3.

By position

Enter multiple positions to split into multiple columns at once.

Merge columns

Ribbon: Select multiple columns → Transform → Merge Columns

Pick a separator (space, comma, custom). The columns collapse into one.

Replace values

Ribbon: Right-click column → Replace Values

Simple find-and-replace within a column. Great for fixing inconsistent labels ("USA" and "United States" → both to "US").

Handle nulls

Fill down

When a group column only has values on the first row of each group (common in exports from PivotTables):

Ribbon: Transform → Fill → Down

Empty cells fill with the value above them.

Replace nulls with a default

Right-click → Replace Values → find null, replace with 0 (or blank text, or whatever).

Standardize inconsistent values

Column from Examples

The friendliest cleaning tool. Give Power Query examples of what you want; it figures out the transformation.

Ribbon: Add Column → Column from Examples → pick the source columns

Type the desired result for a few rows. Power Query proposes an M expression. Confirm.

Conditional column

For rule-based categorization:

Ribbon: Add Column → Conditional Column

Fill in rules: "if Amount > 1000 then 'Large' else if Amount > 100 then 'Medium' else 'Small'".

Unpivot columns

The critical reshaping step. Wide data (Q1, Q2, Q3, Q4 columns) into tall data (Quarter, Amount).

Ribbon: Select columns to unpivot → Transform → Unpivot Columns

Better: select the columns you want to keep as identifiers → Transform → Unpivot Other Columns. This is more resilient to new columns appearing in the source.

Handle errors

When a step fails on some rows (e.g., a text row where a number was expected), those cells show "Error". Options:

Ribbon: Right-click column → Replace Errors → enter a default

Or: right-click column → Remove Errors, which removes rows containing errors in that column.

The full cleaning example

Given a sales report with junk headers, mixed types, wide quarter columns, and blank rows:

let Source = Excel.Workbook(File.Contents("sales.xlsx")), RawData = Source{[Item="Data"]}[Data], RemoveJunk = Table.Skip(RawData, 3), Headers = Table.PromoteHeaders(RemoveJunk, [PromoteAllScalars=true]), RemoveBlanks = Table.SelectRows(Headers, each [Region] <> null), TypedRegion = Table.TransformColumnTypes(RemoveBlanks, {{"Region", type text}}), TrimmedRegion = Table.TransformColumns(TypedRegion, {{"Region", Text.Trim}}), Unpivoted = Table.UnpivotOtherColumns(TrimmedRegion, {"Region", "Product"}, "Quarter", "Amount"), TypedAmount = Table.TransformColumnTypes(Unpivoted, {{"Amount", type number}, {"Quarter", type text}}) in TypedAmount

Every step is visible, editable, and re-runs on refresh.

Common pitfalls

Types too early break renaming

Setting types before renaming columns means M references old column names in the type step. Rename first, then type.

Fill Down on the wrong column

Filling down assumes rows are ordered correctly. If the query is sorted differently, wrong values fill. Verify sort order before filling.

Preview before Close & Load

The preview in the editor is a sample (200 rows by default). Once loaded, edge cases might fail. Review the loaded table before assuming the query is done.

Related guides