How-to recipes · Cleaning data
How to transpose rows and columns in Excel
Switch rows to columns with Paste Special > Transpose, a live TRANSPOSE formula in Microsoft 365, or INDEX in older Excel without Ctrl+Shift+Enter.
Sometimes data arrives the wrong way round: months across the top when your chart or lookup needs them down the side, or a list in one row that should be a column. Transposing flips a range so that rows become columns and columns become rows: the first row becomes the first column, the second row the second column, and so on. Excel offers a one-off paste option and live formulas that update when the source changes.
The example data
A small table in A1:D3 with regions in rows and quarters in columns. We want quarters in rows and regions in columns.
Microsoft 365 and Excel 2021: TRANSPOSE as a live formula
Type TRANSPOSE in the top-left cell of an empty area large enough for the result (here 4 rows by 3 columns):
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Region | Q1 | Q2 | Q3 |
| 2 | North | 420 | 510 | 480 |
| 3 | South | 390 | 415 | 460 |
| 4 | ||||
| 5 | Region | North | South | |
| 6 | Q1 | 420 | 390 | |
| 7 | Q2 | 510 | 415 | |
| 8 | Q3 | 480 | 460 |
The 3×4 table becomes a 4×3 table. Change a number in the source and the copy updates.
The result is a spilled array: you can't edit single cells of it, and it needs the whole area to be empty (otherwise #SPILL!). Number formats are not carried over, so format the result yourself. Blank source cells appear as 0; use =TRANSPOSE(IF(A1:D3="","",A1:D3)) to keep them blank.
Any version: Paste Special > Transpose
- Select the range A1:D3 and copy it (Ctrl+C). Cut does not work for this.
- Click the top-left cell of the destination, outside the source range.
- Home > Paste > Transpose (the icon with arrows), or Paste Special (Ctrl+Alt+V), tick Transpose and click OK.
The result is a static copy with the original formats. It does not update when the source changes, and formulas inside the source are adjusted to new positions, which can break them; for a clean copy, paste values first. This is the fastest method for a one-time layout change.
Excel 2016 and 2019: TRANSPOSE as an array formula
In older versions TRANSPOSE exists but must be entered as an array formula: select the whole destination area (4 rows × 3 columns), type =TRANSPOSE(A1:D3) and press Ctrl+Shift+Enter. Excel puts braces around it, {=TRANSPOSE(A1:D3)}, and the block can only be edited or deleted as a whole. If you select an area that is too small, part of the result is cut off; too large, and the extra cells show #N/A.
Without array formulas: INDEX
A formula you can type in one cell and copy freely swaps the row and column numbers with INDEX, ROW and COLUMN:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Region | Q1 | Q2 | Q3 |
| 2 | North | 420 | 510 | 480 |
| 3 | South | 390 | 415 | 460 |
| 4 | ||||
| 5 | Region |
In A5, COLUMN(A1) is 1 and ROW(A1) is 1. Copy the formula right and down over A5:C8.
Result: Region
When copied one cell to the right, COLUMN(B1) becomes 2, which INDEX uses as the row number, so B5 returns North. When copied one row down, ROW(A2) becomes 2, the column number, so A6 returns Q1. Each cell is an ordinary formula, so you can edit, format and delete cells individually.
Turning a row into a column (and back)
For a single row or column, Microsoft 365 also has TOCOL and TOROW, which reshape any range into one column or one row: =TOCOL(B1:D1) lists Q1, Q2 and Q3 downwards. TOCOL can also flatten a whole table into one column, reading by row or by column, and skip blanks with its second argument.
When to transpose and when not
Transposing for presentation is fine. But if the reason is analysis, consider whether the data should be unpivoted instead: a table with one column per month is hard to filter and summarise, while a long table with Region, Quarter and Value columns works with PivotTables and SUMIFS. See How to unpivot data in Excel with Power Query.
Pitfalls
- Overlapping ranges. Paste Special cannot paste a transposed copy over its own source. Paste to a free area, then delete the original.
- Merged cells in the source stop Paste Special with an error. Unmerge first.
- Large ranges. Excel has more rows than columns (1,048,576 vs 16,384), so a column longer than 16,384 cells cannot be transposed into a row.
- References to the copy. A static transposed copy does not follow later changes; if other formulas depend on it, use the live TRANSPOSE formula.