How to Switch Rows and Columns in Excel

Learn how to switch rows and columns in Excel with Paste Transpose for a separate copy or the TRANSPOSE formula for an updating result.

Contents

Don't Miss the Good Stuff

Get tech news that matters delivered to your inbox.

To switch rows and columns in Excel, copy your cells, select an empty destination, then choose Home > Paste > Transpose. This creates a separate copy with the rows and columns exchanged. Use the TRANSPOSE formula when you want the result to update as the original cells change. If your data is in an Excel table, paste transpose isn't available, so convert the table to a range first or use that formula instead.

The short version

  • Quick copy: Choose Transpose from the paste menu to exchange rows and columns.
  • Empty destination: Choose a separate area with enough room for the rearranged cells.
  • Updating result: Enter a TRANSPOSE formula to keep the output linked to the source.
  • Repeatable imports: Use Power Query to make transposition part of a refreshable query.

MethodUse it forMain catch
Windows ribbon transposeA separate rearranged copyDoes not stay linked to the source
Windows right-click transposeQuick access from the destinationRequires copying rather than cutting
Paste SpecialA full copy or values onlyChoose Values to omit formulas
Keyboard access to Paste SpecialOpening the desktop paste dialogShortcuts differ on Windows and Mac
Mac ribbon transposeA separate rearranged copyChoose a destination outside the source
Browser paste transposeCopying within a workbookNeeds empty destination cells
TRANSPOSEAn automatically updating resultNeeds empty output cells and omits formatting
TOROWOne output rowFlattens rectangular sources
TOCOLOne output columnFlattens rectangular sources
INDEXMapping individual output cellsRequires formulas for each position
Windows Power Query transposeA refreshable transformationDiscards original column headers
Mac Power Query transposeA refreshable transformationRequires Microsoft 365 version 16.69 or later
Browser Power Query transposeTransforming imported dataEditor functionality depends on your plan
Power Query unpivotTurning repeated columns into recordsChanges the data structure rather than rotating it
Power Query pivotTurning category values into columnsMay require aggregation
PivotTable field movementExchanging summary fieldsLeaves the original range in place
Chart Switch Row/ColumnChanging chart data seriesLeaves worksheet cells unchanged
Recorded macroRepeating a paste operationRecorded ranges remain fixed unless adapted
VBATransposing through a procedureRuns in desktop Excel
Office ScriptsTransposing through a scriptAccount eligibility and organizational settings apply
CopilotRequesting a workbook editInspect the result of your request
Python in ExcelTransposing a DataFrameRequires an eligible installation with Python enabled

Choose an empty destination and paste on Windows

Select the source cells, including any headings you want to carry across, then press Ctrl + C. Choose the top-left destination cell in a separate, empty area. A source with four rows and two columns needs an output area with two rows and four columns.

Pasting over occupied cells overwrites their content and formatting, so choose an empty destination with enough space. Select Home > Paste > Transpose. Excel creates a rearranged copy without maintaining a live link to the source.

For the right-click route, copy the source, right-click the first destination cell, then select Transpose(T) under Paste Options. Use copying for this operation because Cut and Ctrl + X do not work. These Windows paste methods apply to Microsoft 365 and Excel 2024, 2021, 2019, and 2016.

For a snapshot without formulas, copy the source range, select an empty destination, then open Home > Paste > Paste Special. Select Values, check Transpose, and select OK. Otherwise, retain All before checking Transpose and selecting OK.

In Microsoft 365 and Excel 2024 for Windows, you can open the dialog with Ctrl + Alt + V after copying with Ctrl + C and selecting the destination. Check Transpose, then select OK. The keyboard shortcuts use a US keyboard layout.

Transpose cells on Mac or in a browser

In Excel for Microsoft 365 for Mac, copy the source cells with Command + C, then select the first destination cell in a separate, empty area. Open Home > Paste > Transpose. The Paste arrow is under Edit on the Home tab.

In Microsoft 365 and Excel 2024 for Mac, you can instead copy with Command + C, select the destination, and press Command + Control + V. Check Transpose and select OK. These shortcuts use a US keyboard layout.

In Excel for the web, copy the source range within the workbook and select an empty destination. Choose Home > Paste, then select the transpose paste option.

Keep the result updated with TRANSPOSE

Use TRANSPOSE when you want source changes to appear in the rearranged result automatically. Select one empty destination cell outside an Excel table and leave the surrounding output area empty. For a source in A1:B4, enter this formula:

=TRANSPOSE(A1:B4)

Replace A1:B4 with your actual source range, then press Enter. The example produces two rows and four columns, spilling the result into the surrounding cells. Source formatting is not copied.

This single-cell workflow applies to Microsoft 365 on Windows and Mac, Excel for the web, and dynamic-array-capable Excel 2024 and 2021 editions. If you use Excel 2019 or 2016, choose the Windows paste method for a separate transposed copy.

You can also map individual cells with INDEX in Microsoft 365, Excel for the web, and Excel 2024 and 2021 on Windows and Mac. For source A1:B4, put =INDEX($A$1:$B$4,1,1), =INDEX($A$1:$B$4,2,1), =INDEX($A$1:$B$4,3,1), and =INDEX($A$1:$B$4,4,1) across the first output row. For the second output row, use those formulas with the final argument changed to 2. This manually maps source positions rather than using a separate transpose command.

Use Power Query for a repeatable transformation

On Windows, select a cell in an existing source table, then choose Data > From Table/Range. This opens Power Query Editor. The workflow applies to Microsoft 365 and Excel 2024, 2021, 2019, and 2016.

Transposing discards the original column headers, so preserve necessary headings as data before this step. Select Transform > Transpose. If the first resulting row should become headings, select the table icon at the upper-left of the preview, then choose Use first row as headers. Finish with Home > Close & Load.

In Microsoft 365 for Mac version 16.69 or later, open Data > Get Data (Power Query) > Launch Power Query Editor. Open or create the source query. Transposing discards original column headers, so preserve necessary headings as data before selecting Transform > Transpose. Choose Home > Close & Load.

In Excel for the web, select Data > Get Data to import a source, then select Transform data. Alternatively, open Data > Get Data > Launch Power Query Editor and select the source query. Transposing discards original column headers, so preserve necessary headings as data before selecting Transform > Transpose. Select Close & Load, then use Data > Refresh All for later refreshes.

Microsoft provides web query viewing and refreshing to all Microsoft 365 subscribers, with additional functionality for Business plans and Enterprise plans E3 and above. If your plan does not provide the editor functionality you need, use the browser paste method or TRANSPOSE for worksheet cells.

For repeated data columns that should become attribute/value rows, use unpivot instead of a full transpose. In Windows Power Query, open the query through Query > Edit, select the columns to convert, then choose Transform > Unpivot Columns. Alternatively, select the identifier columns to retain and choose Transform > Unpivot Other Columns. These Windows steps apply to Microsoft 365 and Excel 2024, 2021, 2019, and 2016.

To turn category values into column headings, select their column in Power Query Editor and choose Transform > Pivot column. In Value column, choose the column containing the values. Under Advanced, choose the required aggregation, or select Don't aggregate when each output intersection has exactly one value. This creates a cross-tab in supported Windows, Mac, and web editors, subject to the access requirements above.

Turn a single row or column into a list

Use TOROW to turn a column into one row. Select an empty cell and enter this formula, replacing the example range with your source column:

=TOROW(A1:A10)

Press Enter to produce the row. To turn a row into one column instead, select an empty cell and enter this formula with your source range:

=TOCOL(A1:J1)

Press Enter to produce the column. Both functions accept rectangular sources, but flatten the entire block into one row or one column rather than exchanging both dimensions. Use TRANSPOSE when you want to preserve that rectangular structure.

To omit blank cells, use =TOROW(A1:A10,1) or =TOCOL(A1:J1,1). These functions apply to Microsoft 365 on Windows and Mac, Excel for the web, and Excel 2024 on Windows and Mac.

Change chart and PivotTable layouts

When you make a graph in Excel, switching its rows and columns changes which cells supply its data series. Select the chart, then choose Chart Design > Switch Row/Column in the Data group. This changes the chart without rearranging worksheet cells.

If you need to rearrange the worksheet cells, use a paste method or TRANSPOSE. The chart path applies to Microsoft 365 and Excel 2024, 2021, 2019, and 2016 for Windows.

After you create a PivotTable in Excel, select it and find PivotTable Fields. Drag a field from ROWS to COLUMNS and the corresponding column field to ROWS. Alternatively, open a field's menu and select Move to Column Labels or Move to Row Labels.

This changes the summary layout while leaving the original worksheet range in place. You can use it in Microsoft 365 on Windows and Mac, Excel for the web, and Excel 2024 and 2021 on Windows and Mac.

Automate repeated transposition

In Microsoft 365 and Excel 2024 desktop editions for Windows and Mac, you can record the paste operation as a macro. With the Developer tab available, select Developer > Record Macro. Enter a Macro name, optionally assign a Shortcut key, and select OK.

Pasting overwrites destination content and formatting, so choose an empty output area. Perform the copy-and-transpose operation, then select Developer > Stop Recording. Recorded ranges remain fixed unless you adapt the macro.

Running the recorded paste again overwrites content and formatting in its destination. Select Developer > Macros to run it again.

For VBA-enabled desktop Excel on Windows and Mac, you can use the following lines inside a procedure after adjusting the ranges to your workbook. Pasting overwrites destination content and formatting, so choose an empty destination before running the procedure:

Range("A1:B4").Copy

Range("D1").PasteSpecial Paste:=xlPasteAll, Transpose:=True

Use xlPasteValues instead of xlPasteAll for values only. VBA is a desktop execution method, not an Excel-for-the-web execution method.

Office Scripts provides another option for eligible Microsoft 365 accounts in Excel for the web, Windows version 2210 or later, and Mac. Personal and Family support is in preview, and organizational policies can restrict access. Adjust the ranges in the following code for your workbook and place it inside an Office Script's main function. Copying into occupied destination cells overwrites their content and formatting, so choose an empty destination before running it:

const s = workbook.getActiveWorksheet();
s.getRange("D1").copyFrom(s.getRange("A1:B4"), ExcelScript.RangeCopyType.all, false, true);

Run the script from Excel's Automate surface. The final true enables transposition.

Use Copilot or Python for workbook reshaping

With an eligible Copilot subscription in Excel for Windows, Mac, or the web, select the Copilot icon in the lower-right corner, then select Allow editing. Submit a request identifying the source, an empty destination, and the desired transposition. For example, you can type:

Transpose A1:B4 into D1:G2, keeping the source unchanged.

Inspect the result after Copilot makes the edit. This is a suggested request rather than a guaranteed command. Organizational settings can affect access.

If Python in Excel is enabled on your eligible Microsoft 365 installation for Windows, Mac, or the web, select an empty destination cell and choose Formulas > Insert Python. Enter this expression to transpose the example range:

xl("A1:B4", headers=False).transpose()

Use the Python output menu to return the result as Excel values. This combines Excel range access with the pandas DataFrame transpose method. Personal and Family availability is in preview and depends on your update channel.

Fix problems with transposed results

If a paste transpose operation fails after cutting the source, select the source again and copy it instead. On Windows, use Ctrl + C, then choose an empty destination and repeat the paste operation. Cut and Ctrl + X do not work for this operation.

If a TRANSPOSE result cannot spill, choose a destination outside an Excel table with enough empty cells for the entire output. For A1:B4, that means two rows and four columns. If you expected the result to update after using paste transpose, use the TRANSPOSE formula instead.

If Power Query drops headings you need, preserve those headings as data before transposing. When the first resulting row should supply the new headings, choose Use first row as headers. If TOROW or TOCOL gives you a single list when you wanted a rectangle, use TRANSPOSE.

Frequently Asked Questions

What other shortcuts open Paste Special?

On Windows, Microsoft also documents Alt + E + S. On Mac, the alternatives include Control + Option + V and Command + Option + V. These shortcuts apply to current Microsoft 365 and Excel 2024 desktop editions and use a US keyboard layout.

Why do older tutorials mention a different array formula workflow?

Older tutorials may describe array formulas entered with a workflow that Microsoft retains for compatibility. Microsoft recommends dynamic arrays for new workbooks.

Can you assign a recorded transpose macro to a button?

Yes, desktop Excel supports assigning recorded macros to worksheet objects, buttons, and the Quick Access Toolbar. This applies to Microsoft 365 and Excel 2024 for Windows and Mac, as well as Excel 2021 and older documented desktop editions.

Should you install the standalone Power Query add-in?

The standalone Power Query add-in for Excel 2010 and 2013 is deprecated. For current Excel, use the built-in Data and Get Data interfaces.

Can you use Copilot editing or Python in Excel on a phone?

Microsoft says Copilot edit-mode support for iPad and iPhone is rolling out, while Android supports chat only. Python in Excel is unavailable on iPad, iPhone, and Android.

Share