How to transpose rows and columns in Excel

Quick answer: To transpose in Excel, select the range with its labels and press Ctrl+C (copying, not cutting). Right-click the first cell of an empty area, and under Paste Options choose Transpose. The rows become columns and the columns become rows. That result is a fixed copy. If you want it to follow changes to the original, type =TRANSPOSE( with the source range in the first output cell instead, for example =TRANSPOSE(A1:D5), and press Enter in Excel for Microsoft 365.

Applies to: Excel for Microsoft 365, Excel 2024, Excel 2021, Excel 2019 and Excel 2016 on Windows. Both Microsoft articles used here also list Excel for the web, which gets a short note near the end. The methods start with the quickest one.

Which method to use

Transposing turns a layout on its side. Say your months run down column A and your products run across row 1: after a transpose, the months sit across the top and the products run down the side. The values move with their labels, so each number still lines up with the same month and product.

The real choice is between a copy and a link. Paste with Transpose gives you a separate copy, including the formatting, and Microsoft points out that it won’t change when the source data changes. The TRANSPOSE function builds the rotated version from the source each time Excel calculates, so edits to the original show up in the result, but the formatting stays behind. Pick the paste for a one-off report and the function for a sheet you’ll keep updating.

Method 1: Copy, then paste with Transpose

This is the route Microsoft’s Transpose article gives:

  1. Select the whole range you want to rotate, including the row and column labels.
  2. Press Ctrl+C, or right-click and choose Copy. Microsoft notes that Ctrl+X doesn’t work for this, so don’t cut the data.
  3. Click a cell in a free part of the sheet, or on another sheet, with enough empty rows and columns for the rotated block. A range that is 3 rows by 8 columns needs 8 rows by 3 columns.
  4. Right-click that cell, the top-left corner of the new block, and under Paste Options select the Transpose icon.
  5. Check the result. Once you’re happy with it, you can delete the original range; Microsoft says the transposed copy stays as it is.

Two warnings from the same article. First, anything already in the destination cells is replaced, data and formatting alike, which is why an empty area matters. Second, formulas in the copied range adjust to their new position. Microsoft advises checking that they use absolute references (such as $B$2) and switching them before you transpose if they don’t, or the results can point at the wrong cells.

Choose a destination that doesn’t overlap the cells you copied. The fetched Microsoft pages don’t describe what happens if you try, but Excel can refuse the paste when the copy and paste areas overlap, and starting a few columns to the right or on a new sheet avoids the problem. The same Transpose option is also offered from the arrow under Home > Paste and in the Paste Special dialog as a check box; those menus aren’t on the page cited here, so the labels may differ slightly in your version.

Method 2: Use the TRANSPOSE function

TRANSPOSE takes one argument, the range to rotate, and returns it with rows and columns swapped. Microsoft’s function page shows the steps for both current and older Excel versions.

In Excel for Microsoft 365 (dynamic arrays):

  1. Click the cell where the top-left value of the result should go.
  2. Type =TRANSPOSE(, then type or drag over the source range, for example A1:D5, and close the bracket.
  3. Press Enter. Microsoft says this confirms it as a dynamic array formula, so the result spills into the cells it needs, below and to the right.

In older versions (legacy array formulas):

  1. Select a block of blank cells with the rows and columns swapped. For a source of 5 rows by 4 columns, select 4 rows by 5 columns.
  2. With the block still selected, type =TRANSPOSE(A1:D5).
  3. Press Ctrl+Shift+Enter instead of Enter. Excel adds curly braces around the formula to show it’s an array formula; don’t type them yourself.

The function copies values, not formatting. Microsoft’s own tip is to use paste with Transpose when you need the text formats and fills to come along. The pages read for this guide don’t cover the next points, so treat them as things to check: a blank source cell can show up as 0 in the result, and in an older version you can’t edit one cell of a legacy array result on its own, so select the whole block to change or delete it. To freeze a formula result into plain values later, copy it and paste it back as Values.

In Microsoft 365, the spill range needs empty cells. If something is in the way, the formula should show #SPILL! instead of the result. #SPILL! error in Excel explains how to find and clear the blocking cells.

Method 3: Swap rows and columns in a PivotTable

If you keep rotating the same summary to look at it from different sides, Microsoft suggests a PivotTable instead. In the PivotTable Fields pane, drag a field from the Rows area to Columns, or the other way, and the layout turns without copying anything. This suits summaries built from a list of records; it’s not a way to rotate an arbitrary block of cells.

Method 4: Transpose in Power Query

Power Query has its own Transpose command, which can help when the data comes from another file or needs cleaning first. Neither Microsoft page used here covers it, so this is a pointer rather than sourced steps: load the range with Data > From Table/Range, select Transform > Transpose in the Power Query Editor, then use Close & Load. Headers can end up in the first row after the rotation, and the Transform tab should offer a command to use the first row as headers again. The output is refreshed from the source rather than updated live.

Transposing data in an Excel table

Microsoft states that Transpose isn’t available for data in an Excel table (a range formatted with Format as Table, with filter arrows and banded rows). It gives two ways around that:

  • Convert the table to a range first. Click inside the table and look for Convert to Range on the Table Design tab, or right-click the table and open Table. The exact location isn’t on the page cited here and can vary by version. The formatting stays, but the table features go, so do this on a copy if other formulas refer to the table by name.
  • Use the TRANSPOSE function (Method 2) with the table’s cells as the source, which leaves the table itself untouched.

Merged cells can also get in the way. The Microsoft pages read here don’t mention them, but a merged block may not paste cleanly once its rows and columns swap. Unmerging first is the safer route; Merge and Center not working in Excel shows how, along with Center Across Selection as an alternative. If the data has repeated rows you plan to clean up, How to remove duplicates in Excel is easier to run before the rotation, while each record is still on its own row.

Excel for the web and Excel for Mac

Excel for the web: both Microsoft articles list Excel for the web, and the TRANSPOSE function is on the list too, so Method 2 is the dependable route in a browser. The Transpose article has a Web tab but doesn’t give separate steps for it. The paste options in the browser may be fewer than on the desktop; if Transpose isn’t offered when you right-click, use the function or open the file in the desktop app.

Excel for Mac: Microsoft has a separate article on transposing data in Excel for Mac, which wasn’t read for this guide. The function page lists Excel for Microsoft 365 for Mac, so TRANSPOSE works there. Shortcut keys differ on a Mac (Command instead of Ctrl), so check that article for the exact paste steps.

When transposing doesn’t work

The causes below are possibilities to check, not a diagnosis.

What you seePossible causeWhat to try
No Transpose option when pastingData was cut, not copiedCopy with Ctrl+C and paste again (Method 1)
Transpose unavailable on a tableSource is an Excel tableConvert to a range, or use TRANSPOSE
Paste is refusedPaste area overlaps the copied cellsPaste into an empty area or another sheet
Formulas point at wrong cellsRelative references movedSwitch to absolute references first
#SPILL! instead of a resultCells in the spill range aren’t emptyClear the blocking cells (Method 2)
Result doesn’t updatePasted copy is staticUse the TRANSPOSE function instead

Sources

How we write our guides: read our editorial policy.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *