Menu

Transpose in Excel: Rows to Columns with TRANSPOSE

=TRANSPOSE(A1:D3) turns the rows of A1:D3 into columns and stays linked to the source. For a one-off copy, use Paste Special > Transpose. TOCOL stacks a whole grid into one column.

Every sheet on this page is live: change a number or a formula and it recalculates.

To switch rows and columns in Excel, type =TRANSPOSE(A1:D3) where the result should start: the first row of A1:D3 becomes the first column of the result. The result stays linked, so changing a number in the source changes it in the copy too. Change B2 to 50 and watch B6 follow.

Quarters across become quarters down
A5
ABCD
1RepQ1Q2Q3
2Ann10129
3Ben81114
4
5RepAnnBen
6Q1108
7Q21211
8Q3914
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

The source has 3 rows and 4 columns, so the result has 4 rows and 3 columns. In Excel 2021 and Microsoft 365, TRANSPOSE spills: you type it in one cell and press Enter.

How to transpose with Paste Special

When you only need the swapped table once, Paste Special is quicker and leaves no formula behind:

  1. Select the range and copy it (Ctrl+C, Cmd+C on a Mac).
  2. Click the top-left cell of where the result should go, outside the copied range.
  3. On the Home tab click the arrow under Paste and choose Transpose, or press Ctrl+Alt+V (Cmd+Ctrl+V on a Mac), tick Transpose and click OK.

On Windows the keyboard path is Alt, H, V, T after copying. The pasted copy keeps formatting but is not linked: when the source changes, paste again. Excel adjusts formulas inside the copied range to their new positions; check any that use relative references, or paste as values if you only need the numbers.

TRANSPOSE syntax

=TRANSPOSE(array)

The only argument is the range or array to flip. TRANSPOSE has been in Excel for a long time, but before Excel 2021 it is an array formula: select a destination of the right shape first (4 rows by 3 columns for the example above), type the formula and press Ctrl+Shift+Enter (Cmd+Shift+Enter on a Mac). Excel then shows it in braces, {=TRANSPOSE(A1:D3)}. In Excel 2021 and Microsoft 365 plain Enter is enough, and a value in the way gives #SPILL!.

Google Sheets has TRANSPOSE too and spills it the same way.

Turn a column into a row

The same function flips a single column into a row, for example a list of names into column headers:

A column of names becomes a row
C2
ABCDEFG
1Name
2AnnAnnBenCaraDanEve
3Ben
4Cara
5Dan
6Eve
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

C2 spills Ann to Eve across C2:G2. Add a name in A7 and it is not included, because the formula reads A2:A6; extend the range to A2:A7 or larger to include it.

Why TRANSPOSE shows 0 for blank cells

A formula pointing at an empty cell returns 0, and TRANSPOSE does too. March has no sales below, so the plain version shows 0 where the source is empty:

Blank cells become 0
D4
ABCDE
1MonthJanFebMarApr
2Sales12095150
3
4MonthSalesMonthSales
5Jan120Jan120
6Feb95Feb95
7Mar0Mar
8Apr150Apr150
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

B7 shows 0 for Mar. The second formula first turns each empty cell into empty text with IF, so E7 stays blank. Type a number in D2 and both formulas show it.

Transpose several rows into one column

To stack a whole grid into a single column, use TOCOL (Microsoft 365 and Excel 2024). It reads the range row by row; TOROW does the same into one row:

A grid stacked into one column
F2
ABCDEF
1RepQ1Q2Q3All values
2Ann1012910
3Ben8111412
49
58
611
714
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

F2 lists 10, 12, 9 from Ann's row and then 8, 11, 14 from Ben's. To read down each column instead, set the third argument to TRUE: =TOCOL(B2:D3,,TRUE). =TOCOL(B2:D3,1) skips empty cells.

Practice: months down instead of across

Your turn
A5
ABCDE
1MonthJanFebMarApr
2Sales1209580150
3
4Months down
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: In A5, turn the table in A1:E2 around so the months run down column A and the sales down column B.

TRANSPOSE or a lookup across the row

People often transpose a wide table only to run VLOOKUP on it. That is not necessary: HLOOKUP and XLOOKUP search a row directly. =XLOOKUP("Mar",B1:E1,B2:E2) returns March sales from the wide table above without flipping anything. Transpose when the layout itself has to change, for a chart, a report or a system that expects one record per row.

Frequently Asked Questions

How do I transpose data in Excel?

Copy the range, right-click the cell where the result should start and choose Paste Special > Transpose (Ctrl+Alt+V, then E and Enter). That pastes a fixed copy. For a copy that updates with the source, type =TRANSPOSE(A1:D3) in the destination cell.

Why does TRANSPOSE show 0 for empty cells?

A formula that refers to an empty cell returns 0, and TRANSPOSE is no exception. Replace empty cells with empty text first: =TRANSPOSE(IF(A1:E2="","",A1:E2)).

How do I use TRANSPOSE in Excel 2019 or older?

Select a destination range with the rows and columns swapped (4 rows by 3 columns for a 3 by 4 source), type =TRANSPOSE(A1:D3) and press Ctrl+Shift+Enter (Cmd+Shift+Enter on a Mac). Excel 2021 and later need only Enter.

How do I turn several rows into one column?

Use TOCOL in Microsoft 365 or Excel 2024: =TOCOL(B2:D3) reads the range row by row and stacks every value in one column. =TOCOL(B2:D3,1) skips empty cells, and TOROW does the same into a single row.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED