If you’re cleaning the same report every month (deleting columns, trimming spaces, filtering rows), Power Query can do it for you. Here’s how I’d get started, plus the habits that stop it getting messy.
Where to find it
Data tab > Get Data. You can connect to a workbook, CSV, folder, web page or database. When the preview appears, click Transform Data to open the Power Query editor.
A simple order that works
- Remove any junk rows at the top and bottom (titles, totals).
- Promote the first row to headers.
- Set your data types (dates, numbers, text).
- Remove columns you don’t need.
- Filter out rows you don’t want (cancelled orders, blanks).
- Clean text (Trim, then Capitalize Each Word).
- Add any calculated columns.
- Close & Load to a table, then use Refresh All whenever the data changes.
Habits worth building early
* Leave the raw data alone. Power Query reads your source file but never changes it. Do all your cleaning in the query, so you can always go back.
* Set headers and data types early. Later steps behave better when they’re in place, and dates stored as text cause all sorts of problems.
* One step, one purpose. Don’t cram two jobs into one step. It’s much easier to find and fix things later.
* Name your steps. “Filtered out cancelled orders” beats “Filtered Rows1” when you’re back in six months.
* Aim for a tidy table. One row per record, one column per field. Pivots and formulas get much easier.
If you get a new file every month
Use the folder connector. Put all the files in one folder and Power Query combines them. When you add next month’s file, you just hit refresh. The part that confused me initially was which steps go in the Transform Sample File query and which in the main query. My rule of thumb: steps that make one file look like a proper table (top rows, headers) go in the sample file, and anything that works on all the rows combined (filters, trimming, calculated columns) goes in the main query.
I made a video that walks through all of this on a simple example, in case it’s useful: https://youtu.be/23vd7vAEH2s
Hope people find this useful!