Power Query in Excel: Stop Rebuilding the Same Report
Every month the same thing happens. Somebody pulls an export out of the accounting system or the CRM, it lands in Excel, and it looks like a ransom note. A title block across the top. A blank row under every group. Dates sitting there as text, refusing to sort. A column called “Customer Name ” with a trailing space that quietly breaks every lookup you write.
So you clean it. Delete the junk rows, split a column, fix the dates, build the pivot. Forty minutes, give or take. Then next month’s export shows up and you do the same forty minutes again, because none of last month’s work was saved anywhere except in the finished file.
Power Query in Excel was built to end exactly that. You clean the file once, Excel writes down every step you took, and next month you click Refresh. It is not an add-in you have to go buy. It is on the Data tab of the Excel you already own.
Clean the Export Once with Power Query in Excel
The trick most people miss: don’t open the export at all. Point a query at it instead.
- In a blank workbook, go to Data → Get Data → From File → From Workbook (use From Text/CSV if the export is a .csv).
- Pick the file, click the sheet name in the Navigator, then click Transform Data — not Load. That opens the Power Query Editor, where the recording happens.
Do the cleanup in the editor and watch the Applied Steps box on the right fill up, one line per action. A typical pass on a real export:
- Home → Remove Rows → Remove Top Rows to drop the title block the system printed above the data.
- Home → Use First Row as Headers.
- Select the four columns you actually want, right-click, Remove Other Columns — faster than deleting twenty-six one at a time.
- Select your text columns, then Transform → Format → Trim. That is the one that kills the trailing spaces.
- Click the data-type icon left of each column heading and set it honestly:
Date,Whole Number,Decimal Number,Text. Dates-stored-as-text die right here. - Home → Close & Load To… → Table, existing worksheet.
That is the whole investment. Next month, save the new export into the same folder under the same filename and hit Data → Refresh All. Every step replays against the new data, and any pivot table built on that output refreshes with it. Forty minutes becomes about two seconds.
The gotcha: Power Query hard-codes the full file path into the first applied step, the one named Source. Move the file, rename the folder, or let the export land in Downloads with (2) on the end, and the refresh fails. Fix it with Data → Queries & Connections, right-click the query, Edit, then click the gear beside Source and repoint it. Better habit: pick one folder and one filename on day one and never deviate.
Replace That VLOOKUP Column with a Power Pivot Relationship
Here is the second half of the ritual. You have a sales table with a Customer ID and a separate customer list holding the ID, region, and rep. So you add a helper column, write a VLOOKUP down 80,000 rows, and the workbook starts taking nine seconds to recalculate. Power Pivot skips the helper column entirely: you tell Excel how the two tables relate, once.
- Format both ranges as tables (Ctrl+T) and give them real names in the Table Design tab —
SalesandCustomers, not Table1 and Table3. - Select the sales table, then Insert → PivotTable, and tick Add this data to the Data Model before you click OK. Repeat for the customer table.
- Go to Data → Manage Data Model, then Diagram View in the bottom-right corner.
- Drag
CustomerIDfrom the Sales box ontoCustomerIDin the Customers box. The line that appears is the relationship.
Back in the PivotTable field list you will now see both tables. Drop Region from Customers into Rows and Amount from Sales into Values, and it works — no helper column, no lookup formula, no recalculation lag, and a far smaller file, because 80,000 formulas are gone.
The gotcha: the lookup side must have unique values in the key column. If the customer list has the same CustomerID twice, Excel refuses with “the relationship cannot be created because each column contains duplicate values.” That is not a bug — it is Excel catching a data problem you would otherwise have shipped. De-duplicate the list first, which is a Remove Duplicates step in the query from the first tip. Also worth knowing: Power Pivot and the Data Model are Windows-only. On a Mac you get Power Query, but not this.
Plenty more on the calendar
If you want to watch both of these built live, from a messy export to a finished refreshable report, I am running Excel Power Query and Power Pivot: Mastering Data Transformation and Analysis on Friday, December 4 at 1:00 PM Eastern. We also cover combining a whole folder of monthly files into one table, merging queries instead of lookups, and writing your first measures in the data model.
The full current schedule is on the front page of PCWebinars.com, with new dates going up as they are confirmed. Register for this one, or browse the rest — there is usually something on Excel, Power BI, Copilot, ChatGPT, or Claude within a week or two.
About your trainer
I’m Tom Fragale. I have been a computer trainer and consultant for more than 30 years, and I have taught well over 30,000 people how to get more out of the software they already own — Excel, Access, Power BI, Word, Outlook, and now the AI tools that sit on top of all of it: Claude, ChatGPT, and Microsoft Copilot. My background is applied rather than theoretical. Alongside the teaching I build real databases and reporting systems for clients in Excel, Access, and Power BI, which means the examples I use in class are the problems I ran into last week, not textbook exercises. I also publish free tutorials on YouTube and longer courses online.
If this was useful, the full schedule of live sessions, plus recordings and courses, is at PCWebinars.com.