Use Power Query to Clean Data Already in Excel


February 22, 2023 - by

Use Power Query to Clean Data Already in Excel

Problem: My data is already in Excel. I need to transform the data. I need to unpivot the month data.

Data in Excel: Region in A, Product in B, then month headings Jan, Feb, Mar extending across row 1.
Figure 1016. Unpivot this data.

Power Query can either read from a named range or a range that has been Formatted as a Table using Ctrl+T.

Follow these steps:


1. Select one cell inside your data set.



  • 2. First, convert your data set to a table using Ctrl+T.

  • 3. Choose Power Query, From Table.

  • 4. In the Query Editor, click on the Jan heading to select that column.

  • 5. Shift+Click on the Dec column to select all the columns between Jan and Dec.

  • 6. On the Transform tab, select Unpivot Columns.

  • 7. Optionally, rename the Attribute column to be Month.

  • 8. On the Home tab, choose Close and Load.

You will see a new worksheet with the results.

Press Ctrl+T to format the data as a Table.
Figure 1017. If the underlying data changes, you can refresh this query.

This article is an excerpt from Power Excel With MrExcel

Title photo by Nick Fewings on Unsplash