Excel Power Query: Automate Data Cleaning Like a Pro
Tech Setup3 min read
TS
Published July 30, 2026 · Editorial policy

What is Power Query?
Power Query is Excel's built-in ETL (Extract, Transform, Load) tool. It lets you connect to data sources, clean and reshape data, and load it into worksheets — all without formulas or VBA.
Opening Power Query
- Go to Data tab
- Click Get Data (or From Table/Range for existing data)
- The Power Query Editor opens
Basic Transformations
Remove Columns
- Select columns you don't need
- Right-click → Remove Columns
Filter Rows
- Click the dropdown arrow on a column header
- Uncheck values you want to exclude
Change Data Types
- Click the icon next to the column name
- Select the correct type (Text, Number, Date, etc.)
Rename Columns
- Double-click the column header
- Type the new name
Merging Tables (Like VLOOKUP on Steroids)
Merge Queries
- Home → Merge Queries
- Select the two tables
- Choose the matching columns
- Select join type (Left, Inner, Full)
- Expand the merged column to show fields
Example: Match Orders with Customers
Table A (Orders) Table B (Customers)
┌──────────┬─────────┐ ┌──────────┬──────────┐
│ OrderID │ CustID │ │ CustID │ Name │
├──────────┼─────────┤ ├──────────┼──────────┤
│ 1001 │ C01 │ │ C01 │ Alice │
│ 1002 │ C03 │ │ C02 │ Bob │
│ 1003 │ C01 │ │ C03 │ Charlie │
└──────────┴─────────┘ └──────────┴──────────┘
After Merge (Left Join on CustID):
┌──────────┬─────────┬──────────┐
│ OrderID │ CustID │ Name │
├──────────┼─────────┼──────────┤
│ 1001 │ C01 │ Alice │
│ 1002 │ C03 │ Charlie │
│ 1003 │ C01 │ Alice │
└──────────┴─────────┴──────────┘
Appending Tables (Stack Rows)
- Home → Append Queries
- Select tables to combine
- Result: all rows stacked vertically
Use this to combine monthly reports, daily logs, etc.
Common Data Cleaning Recipes
Remove Duplicates
- Select the column(s)
- Home → Remove Rows → Remove Duplicates
Split Columns
- Right-click column → Split Column
- Choose delimiter (comma, space, etc.)
- Or split by number of characters
Fill Down Nulls
- Select the column
- Transform → Fill → Down
This replaces null values with the last non-null value above.
Unpivot Columns
Convert wide data to tall format:
Before (Wide):
┌─────────┬──────┬──────┬──────┐
│ Product │ Q1 │ Q2 │ Q3 │
├─────────┼──────┼──────┼──────┤
│ Widget │ 100 │ 150 │ 200 │
└─────────┴──────┴──────┴──────┘
After Unpivot:
┌─────────┬────────┬───────┐
│ Product │ Quarter│ Sales │
├─────────┼────────┼───────┤
│ Widget │ Q1 │ 100 │
│ Widget │ Q2 │ 150 │
│ Widget │ Q3 │ 200 │
└─────────┴────────┴───────┘
M Language (Advanced)
Power Query uses M language behind the scenes. You can edit it directly in the formula bar or Advanced Editor:
let
Source = Excel.CurrentWorkbook(){[Name="Sales"]}[Content],
FilteredRows = Table.SelectRows(Source, each [Amount] > 100),
SortedRows = Table.Sort(FilteredRows, {{"Amount", Order.Descending}}),
AddedTotal = Table.AddColumn(SortedRows, "Total", each [Amount] * 1.1)
in
AddedTotal
Refreshing Data
After setting up your query:
- Data → Refresh All (or
Ctrl+Alt+F5) - All transformations re-apply automatically
- New data from the source is processed
Auto-Refresh on File Open
- Data → Queries & Connections
- Right-click query → Properties
- Check Refresh data when opening the file
Connecting to External Sources
CSV File
Data → Get Data → From File → From Text/CSV
Database
Data → Get Data → From Database → From SQL Server Database
Web API
Data → Get Data → From Other Sources → From Web
Enter URL: https://api.example.com/data
Folder (Combine Multiple Files)
Data → Get Data → From File → From Folder
Select folder → Power Query detects file structure
Tips
- Name your queries — descriptive names make maintenance easier
- Document steps — add comments in Advanced Editor
- Use parameters for dynamic values (date ranges, file paths)
- Close & Load To → only create connection for intermediate queries
- Parameters let users input values at refresh time


