Data Analysis•7 min read
Excel Power Query Unpivot Columns: Step-by-Step
Unpivot columns in Excel Power Query, preserve identifiers, clean blanks, and build refreshable analysis tables.
SheetHub••7 min
Twelve month columns can look tidy on a screen, but they make filtering, charting, and pivot analysis harder. Unpivoting turns that wide layout into a long table with one Month column and one Value column, so each record has a consistent shape.
Use the native Excel workflow for Excel Power Query unpivot columns, with no extra code. You will learn when to use Unpivot Columns, when Unpivot Other Columns is safer, and how to clean the result before loading it back into a worksheet.
Suppose a sales table has one row per product and a separate column for every month:
This format is convenient for entering a monthly report, but every new month adds another column. A pivot table or chart must keep learning about those columns individually.
After unpivoting, the same information becomes a row-based table:
Now Month is a field that can be filtered, grouped, sorted, or placed on a pivot axis. If you are cleaning several issues before this step, the broader Excel Power Query unpivot columns cleanup guide can help you prepare the source table.
Start with a proper Excel table whenever possible. A table gives Power Query a stable source range and makes future refreshes more predictable. The Excel tables and structured references guide covers the table setup in more detail.
Use Unpivot Columns when you know exactly which columns contain repeated measures. This is the clearest choice when your table has a fixed set of month or category columns.
Use Unpivot Other Columns when the identifier columns are stable but new measure columns may be added later. Instead of selecting every month, select the columns that must remain as identifiers.
For the sales example:
Unpivoting changes the shape, not the quality, of the source values. Review these details before loading the result:
After you verify the output, select Home > Close & Load. You can load the result to a new worksheet or use Close & Load To to choose a table, connection, or data model destination.
The transformation is saved as query steps. When the source table changes, select Data > Refresh All to run the steps again. A new row should flow through automatically. A new month column will be included automatically when you used Unpivot Other Columns and kept the identifier columns selected.
If the output has unexpected rows, check these common causes:
Unpivoting converts repeated columns into a consistent attribute-and-value structure. Use Unpivot Columns when the measure columns are known and fixed. Use Unpivot Other Columns when identifier columns are stable and new measures may arrive. Rename the output fields, check nulls and data types, load the result, and refresh it against the source table before using it for analysis.
Why wide data becomes difficult to analyze
| Product | Region | January | February | March |
|---|---|---|---|---|
| Desk | East | 1200 | 1350 | 1280 |
| Chair | West | 900 | 980 | 1040 |
| Product | Region | Month | Value |
|---|---|---|---|
| Desk | East | January | 1200 |
| Desk | East | February | 1350 |
| Desk | East | March | 1280 |
| Chair | West | January | 900 |
Load the table into Power Query
- Click any cell in the source range.
- Select Data > From Table/Range.
- Confirm that My table has headers is selected if the first row contains field names.
- Click OK to open the Power Query Editor.
- In the Queries pane, give the query a descriptive name such as
MonthlySales_Unpivoted.
Use Unpivot Columns
- In Power Query Editor, select the first month column.
- Hold Ctrl while selecting the other month columns.
- Open the Transform tab.
- Select Unpivot Columns.
- Power Query replaces the selected columns with two columns named Attribute and Value.
Use Unpivot Other Columns for future-proof tables
- Select Product and Region.
- Open the Transform tab.
- Select Unpivot Other Columns.
- Rename Attribute and Value to Month and Sales.
Clean blanks, data types, and names
- A blank source cell may become a row with a null Value. Filter out nulls when an empty period should not be part of the analysis.
- A formula that returns an empty string is not always treated like a true blank. Filter or replace those values according to the reporting rule.
- Set the Value column to Whole Number, Decimal Number, or Currency as appropriate. This prevents text values from breaking totals.
- If the original headings are dates, preserve them as dates when possible. If they are words such as January, add a separate sort field if chronological order matters.
- Replace generic Attribute and Value names with terms that describe the business data, such as Month and Sales.
Load, refresh, and troubleshoot
- An identifier was unpivoted: Return to the step where the columns were selected and keep the product, region, date, or ID fields out of the measure set.
- A measure stayed wide: Edit the unpivot step and include the missed month or category column.
- Null rows are inflating totals: Filter null or empty values before loading, unless a missing period must remain visible.
- The refresh misses new data: Confirm that the source is an Excel table rather than a manually selected range.
- Months sort alphabetically: Add a numeric month-order column or convert real date headings to a date type.
Summary
Article Topics
Recommended Next Reading
Excel
=EXCEL(...)Excel MODE.MULT: Find Multiple Modal Values in Data
Explore ↗
Excel
=EXCEL(...)Excel Goal Seek: Solve for a Target Value
Explore ↗
Excel
=LINEAR(...)Linear Interpolation in Excel: Fill Missing Values
Explore ↗
Share this tutorial
Discussion & Community
Share questions, tips, or edge-cases about this spreadsheet formula.