How to Unpivot Columns into Rows in Excel Using Power Query

Loading Data into Power Query

Open up your data set in Excel. Make sure you can see the Power Query tab on the ribbon toolbar. If you can’t see it, you may need to restart your computer or re-install Power Query because Excel cannot see the plug-in.

Select the cells that hold your pivoted data.


Select the Power Query tab on the ribbon toolbar and choose the From Table button under the Excel Data section.


A dialog box will pop up asking you to confirm the range where your pivoted data exists. Make sure you’ve selected the row with the column titles in your data and that the My table has headers option is checked.


Click OK.

Power Query will automatically turn your pivoted data into an Excel data table and launch a Query Editor window.


Unpivot the Data in Power Query

Select the columns you wish to unpivot. You can either hold CTRL while clicking them individually or click the left-most column, hold SHIFT and click the right-most column.


Right-click one of the column headings you’ve selected to pull up an options menu. Click the Unpivot columns… menu item near the bottom.


The columns will converted into their own unique rows in the data inside the Power Query window. By default, the pivoted column headers will be in a column called Attribute and the data in the table will be in a column called Values. You can change the new column names by double-clicking them and typing in your new header names.


When you are satisfied with the new unpivoted columns of data in the Power Query window, click the Close & Load button in the top left of the toolbar. This will load the newly un-pivoted data back into Excel.


Review the Results of Unpivoting the Data

The new table will be inserted into its own tab in the original Excel spreadsheet.


You can now use your freshly unpivoted data to combine it with other data sets, import it into a database, or build your own pivot tables!