Why Power Query: record a cleanup once, repeat it every month
Power Query basics7 minPremium
Builds on Turn a range into an Excel table.
Every month an operations analyst in Dublin gets the same messy export from the warehouse system. She spends an hour on the same dozen cleanup steps, and next month she does them all again.
How it works
Power Query, on the Data tab under Get & Transform Data, brings data into Excel and shapes it. You build a query: a list of steps that reads the source, cleans it and loads the result to a sheet as a new table. The source stays as it was.
- Click in the table or range and choose Data > From Table/Range. A plain range becomes an Excel table first, then the Power Query Editor opens with a preview of the data.
- Clean the data with the editor's menus. Each change becomes a step in Applied Steps, and the formula bar shows it in M, Power Query's formula language.
- Choose Home > Close & Load. The result lands on a new sheet as a table.
Next month, the new data goes into the source table, or the query points at the new file, and Data > Refresh All runs every step again. That makes Power Query the tool for a cleanup you repeat every week or month, for data that arrives as files, and for tables you combine or reshape.
Example
The analyst's export and the table her query loads from it:
Common mistakes
- Typing fixes into the loaded table. The next refresh rebuilds it from the steps and your typing is gone. Make the change as a step in the editor.
- Expecting a query to follow every change as you type, like a formula. It changes only when you refresh it.
In short
- A query is a list of recorded steps from a source to a loaded table, and the source stays as it was.
- Use it for cleanups you repeat. Refresh runs every step again on new data.
Practice
Premium3 exercises: 1 quiz question, 1 find-it task and 1 query.
Practice is part of Premium
Every lesson is free to read, and you can practice the free lessons without an account. This lesson's exercises are part of Premium, which you add to a free account.
Have one? Sign in