Excel tutorial
/

Data analysis

Advanced

Power Query basics in Excel: automate data cleanup (Get Data and Refresh)

Set up a monthly chore once with Power Query: Get Data, cleanup steps, Applied Steps, Refresh All and the most common Power Query mistakes.

Every month it’s the same: you export a report from your accounting system or bank, and it comes with a title row on top, blank rows, stray spaces, amounts stored as text and a Total row at the bottom. Cleaning it takes 30–40 minutes — and you repeat the exact same work each time.

Power Query records those actions once. Next month you replace the file and press one button — Refresh All. Every step reruns in seconds. Power Query is built into Excel 2016 and later on the Данные tab (Get & Transform Data group); no formulas required — it’s all buttons.

Книга1 - Excel
—☐✕
fx
ABCDE
1Report: January 2025
2DateBranchProductAmount
305.01.2025 TashkentBREAD4 500 000
406.01.2025Samarkand milk7 200 000
5
606.01.2025Samarkand milk7 200 000
707.01.2025tashkentmeat6 800 000
8Total18 500 000
9
Готово
The source (CSV export): a row above the header, spaces, mixed case, a duplicate, a blank row, a Total and amounts as text
Книга1 - Excel
—☐✕
fx
ABCDE
1DateBranchProductAmount
205.01.2025TashkentBread4 500 000
306.01.2025SamarkandMilk7 200 000
407.01.2025TashkentMeat6 800 000
5
Готово
The Power Query result: a clean table — real dates and numbers, consistent spelling, no duplicates or junk rows

Loading data into Power Query

1

On the Данные tab choose Получить данные → From File.

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Получить данныеОбновить все
Получить данные
СортировкаФильтр
Сортировка и фильтр
Текст по столбцамУдалить дубликатыПроверка данных
Работа с данными
fx
ABCDE
1DateBranchProductAmount
2
3
4
5
Готово

2

Pick the file type: From Text/CSV for CSV, From Workbook for an Excel file, From Folder for a whole folder. If the data is already in this workbook, select the range and choose From Other Sources → From Table/Range. For a table on a website — From Web.

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Получить данныеОбновить все
Получить данные
СортировкаФильтр
Сортировка и фильтр
Текст по столбцамУдалить дубликатыПроверка данных
Работа с данными
fx
ABCDE
1DateBranchProductAmount
2
3
4
5
Готово
The Get Data → From File submenu

3

Choose the file. In the preview window click Transform Data, not Load — the Power Query Editor opens. Load would dump the file onto a sheet without any cleanup.

Cleaning up in the Power Query Editor — 6 steps

1

Home → Remove Rows → Remove Top Rows → 1. The “Report: January 2025” row is gone.

2

Home → Use First Row as Headers — Date, Branch, Product and Amount become headers.

3

Filter button on the Date column → untick (null) and Total. The blank row and the total row disappear. Then Home → Remove Rows → Remove Duplicates — the duplicate goes.

4

Select the Branch and Product columns: Transform → Format → Trim (spaces at the edges), then Capitalize Each Word (“tashkent”, “BREAD” → “Tashkent”, “Bread”).

5

Amount column: Transform → Replace Values — replace the space with nothing, then the type icon in the header → Whole Number. Date column: type icon → Using Locale... → Date, locale Russian (Russia) or another day.month.year locale.

6

Home → Close & Load. The result lands on a new sheet as an Excel Table. The query appears in the Queries & Connections pane on the right.

Книга1 - Excel
—☐✕
fx
ABCDE
1DateBranchProductAmount
205.01.2025TashkentBread4 500 000
306.01.2025SamarkandMilk7 200 000
407.01.2025TashkentMeat6 800 000
5
Готово
Every button you click becomes one step in Applied Steps. Click a step to see the data at that point, or delete it with ✕

Next month: one button

Save the February report in the same folder under the same name (over the old one). Then Данные → Обновить все or Ctrl + Alt + F5. Power Query rereads the file and replays every step in Applied Steps in order. 40 minutes of manual work become 5 seconds.

A different number of rows each month is no problem: the steps are stored as rules (“remove row 1”, “filter out Total”), not as specific cells.

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Получить данныеОбновить все
Получить данные
СортировкаФильтр
Сортировка и фильтр
Текст по столбцамУдалить дубликатыПроверка данных
Работа с данными
fx
ABCDE
1DateBranchProductAmount
201.02.2025BukharaBread3 900 000
302.02.2025TashkentMilk5 100 000
403.02.2025SamarkandMeat12 400 000
504.02.2025TashkentBread4 800 000
6
Готово
Refresh All with the February file: the table updated and the row count changed by itself

Pro level: folders, Unpivot and Merge

  • From Folder — 12 files into one table. Put every monthly file in one folder: Get Data → From File → From Folder → Combine & Transform Data. Drop a new month’s file in the folder and Refresh picks it up automatically.
  • Unpivot Columns turns a table with months spread across columns (Jan, Feb, Mar...) into a long “Month | Amount” table — the ideal shape for PivotTables and formulas.
  • Merge Queries joins two tables on a key: a replacement for VLOOKUP/XLOOKUP that stays fast on hundreds of thousands of rows.
  • Group By — grouping and totals inside Power Query (similar to SUMIF).
  • Close & Load To... → Only Create Connection keeps helper queries off the sheet; PivotTable Report sends the result straight into a PivotTable.

Behind every step there is code in the M language (View → Advanced Editor). You don’t need to know it, but peeking is useful. The same skills work one-to-one in Power BI.

Has ExcelLab been useful?

Support the project and help us release new lessons and exercises.

Support us
Previous

57 / 154