How to swap columns and rows in Excel?

As in any activity, it is not always possible to build a table the first time when working with an Excel file and enter the data in such a way that it does not require changes in the future. In particular, there are situations when it is necessary to change the location of elements: columns or rows.

Moving a column in a table

There are several ways to swap columns and rows in Excel. Let us focus on moving the columns. Select the column that you want to move to another place by clicking on the heading. Move the mouse cursor to the edge of the selection so that it turns into a crossed bidirectional arrow icon.

What does the cursor look like to move?




Now, if you have a version of Excel 2007, just drag the column to a new location. If your program version is 2010 or higher, drag and drop must be done with the Shift button held down. This way you can move one or more columns. If you need to move adjacent columns, just select them with the mouse. To select non-adjacent columns, use the Ctrl button.

Insert columns

Another way to change the serial number of a column is to copy and paste. Before swapping columns in Excel, decide on the column where you want to place them. Select the column in front of which the inserts will be placed, and insert the empty column. This can be done using the "Insert" context menu or the "Insert" item in the "Cells" toolbar on the "Home" tab. You need the "Insert columns on sheet" element.





Insert columns




Next, select the desired column and copy it. To do this, use the “Copy” button on the “Clipboard” toolbar of the “Home” tab. Another method is to use the right-click “Copy” context menu. And finally, just pressing Ctrl + C.

Then select the top cell of the new column and paste the copied data with the right mouse button, the “Paste” operation on the clipboard panel, or with Ctrl + V.

After we swapped the columns in Excel, we got two identical columns in our table. You can remove the old one by selecting it and selecting the "Delete" item in the right-click menu or by using the "Delete columns from sheet" element of the "Cells" panel.

To avoid deleting a column instead of copying, apply cuttings. Having selected the column, use the “Cut” command from the toolbar or the context menu of the mouse. Then mark the column in front of which you want to add data, and perform the operation “Insert cut cells”.

Paste cut cells




Many worry about whether data, formulas, and calculations will be preserved after the columns are swapped. In Excel, when you copy-paste formulas in cells, they continue to refer to the fields in the old range. Accordingly, an error will occur when deleting the old column.





When inserting a cut column, this procedure is painless. All information contained in the moved columns is saved, and the links in the cells are redirected to the new data location.

Moving lines

Often the user needs to change the order of the records in the table: raise one above, lower the others. It is not always possible to cope with such a task using sorting. And then you have to move the lines manually.

You can move a row or row of rows in the same way as you swap columns in Excel. That is, selecting the necessary records and dragging them while holding the Shift key to the desired location (or without Shift in Excel 2007) or by cutting and pasting.

Swap columns and rows

But sometimes the task is more difficult - to make the headings of the records become the headings of the columns and vice versa, in other words, to swap columns and rows. Excel has the ability to perform such an operation.

To do this, copy the entire table, select a new location where its modified (transposed) version will be located, and right click to paste. Select the “Transpose” insertion option and press the button. A similar command is also in the "Paste" menu of the clipboard panel.

Transpose a table




Using this information, you can easily change the arrangement of records and columns in Excel in the future.




All Articles