How to Unpivot Data in Excel

If you just need to unpivot data in excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: start from Data ▸ Get Data (or Data ▸ From Table/Range) to open the Power Query Editor, shape the data with the ribbon buttons, then Close & Load to drop the result on a sheet.

On this page7
Annotated stepsExcel
1

Data ▸ Get Data and choose the source, or Data ▸ From Table/Range for data already on a sheet.

2

In the editor, shape the data with the ribbon: Remove Columns, Split Column, Filter, Change Type, Unpivot.

3

Watch the Applied Steps pane on the right — it is the recipe, and any step can be deleted or reordered.

4

Set every column's data type explicitly before loading; it is the step most often skipped.

5

Close & Load, or Close & Load To… if you want a connection only, or a load straight into the Data Model.

6

Afterwards, Data ▸ Refresh All replays every step against the current source.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

Power Query — shown in the ribbon as Get & Transform — is the import-and-clean layer that sits in front of the worksheet. Its defining property is that it RECORDS every step rather than performing it: removing a column, splitting one, changing a type, filtering rows and unpivoting all land as an ordered list in the Applied Steps pane. Point it at next month's file and click Refresh, and the whole sequence replays. That makes it the correct answer to any cleaning job you will do more than once, and to combining a folder of identically shaped files (Get Data ▸ From File ▸ From Folder). Two operations have no practical worksheet equivalent: Unpivot Columns, which turns a wide twelve-month-columns layout into the tall three-column shape every PivotTable wants, and Merge Queries, a join that handles many-to-many where VLOOKUP cannot. It is built into Excel for Windows from 2016 and into Excel for Mac from 2019, though the Mac version supports fewer connectors. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “unpivot data in excel”. Start on a copy or a tiny sample, keep the affected pivot table visible, and compare the result with the tool above before you touch the real workbook. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. The point is a data step that keeps your analysis trustworthy, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

Twelve monthly CSV exports in one folder, each with the same headers. Data ▸ Get Data ▸ From File ▸ From Folder ▸ pick the folder ▸ Combine & Transform. Power Query stacks all twelve, and the steps you then add — remove a blank column, set Date to date type, filter out cancelled rows — apply to every file. Next month, drop file thirteen into the folder and press Data ▸ Refresh All. Any cleaning routine you perform more than once is a query you should have built the first time — the second month costs one click instead of an afternoon. When the result is not what you expected, undo straight away rather than repairing it by hand — undo restores the sheet exactly, while manual fixes tend to leave small inconsistencies behind that surface later.

In Google Sheets

Power Query does not exist in Google Sheets. Queries built in Excel do not carry over; in Sheets the nearest built-in tools are IMPORTDATA, IMPORTRANGE and QUERY, which work differently. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. If you take one thing from this page on “unpivot data in excel”, make it the order of checks rather than the individual clicks: confirm what is selected, apply the step, and look at the result before moving on. That small routine is what keeps Excel work predictable when the same task comes back in a slightly different workbook.

Common mistakes

  • Editing the loaded output on the sheet — the next refresh overwrites it. All edits belong in the query.
  • Skipping Change Type, so numbers arrive as text and every downstream total is wrong or zero.
  • Filtering on a value list, which hard-codes today's values into the step and silently drops new ones later.
  • Combining files whose headers differ slightly; the step records column names, so "Amount " with a trailing space breaks the append.
  • Loading a million rows to a worksheet instead of Close & Load To ▸ Connection Only ▸ Add to Data Model.
  • Building the same clean-up by hand each month when the query already exists and just needs Refresh.

Frequently asked questions

What is Power Query used for?

Importing data from files, folders, databases and the web, and cleaning it with steps that are recorded once and replayed on every refresh.

Where is Power Query in Excel?

On the Data tab as Get Data / Get & Transform. It is built into Excel for Windows from 2016 and Excel for Mac from 2019.

How do I unpivot data?

In the editor, select the columns that should stay, right-click ▸ Unpivot Other Columns. Wide month-per-column data becomes the tall layout PivotTables need.

Can Power Query combine multiple files?

Yes — Get Data ▸ From File ▸ From Folder ▸ Combine & Transform appends every identically shaped file in the folder, and picks up new files on refresh.

Is Power Query better than VLOOKUP?

For repeated joins across whole tables, yes: Merge Queries handles many-to-many and does not recalculate on every edit. For a single lookup in a live formula, XLOOKUP is simpler.