How to swap cells in Excel? In short, all you have to do to swap the adjacent cells in Excel is select the first cell, hold shift, and drag from the edge to the end of the next cell when the bracket icon pops up.
If you need a more detailed guide with screenshots or want to learn how to swap cells in Excel in the workbook, keep reading to learn more.
Table of Contents
How To Swap Cells in Excel
There are multiple ways I often use the Excel swap cells feature. Let’s take a look at some of these methods below.
How To Swap Two Cells in Excel by Clicking and Dragging
In my opinion, the clicking and ragging method is the most efficient way to switch cells. Below is a detailed on how to switch two cells in Excel:
- Select the cell that you want to swap.
- I want to drag the cell with the text “Gill” out of the column.
- Press and hold the Shift button on the keyboard.
- Move the mouse icon to the cell’s border on the right side of the spreadsheet until the cursor changes from a white plus sign to a black arrow plus icon.
- Click and drag the cell out of its original position.
- You will see a bracket-like icon at the border of the nearest cell.
- Keep dragging it until you align the mouse with the wall at the far end of the cell that you want to swap.
- Now, release the left mouse button to switch the cells.
The cell value that I dragged will be moved to the location of the bracket.
One thing to note is that if you drag the cell between two already populated cells, an extra space will be created between the two, with the cell’s value moving to the side. If I moved the cell to any neighboring cells, the values would be swapped between the two.
Watch Our Video To Swap Cells in Excel
Here’s a short video tutorial to teach you how to swap cells in Excel. Enjoy!
Use VBA Code to Swap Two Cells in Excel
Excel VBA is a development environment that allows its users to create and automate tasks within Excel. This also allows you to create a script to swap cells by pressing a button.
Here is how to swap cells using the VBA code:
- Select the cell that you want to swap.
- From your keyboard, press the Alt + F11 keys.
- For laptops, you may have to press the Alt + fn + F11 keys, depending on whether you have enabled the secondary function.
- This will open the “Visual Basic for Applications” window.
- Click the “Insert” option in the top bar of the window.
- Choose the “Module” option. In the pop-up window, copy and paste this code:
Sub SwapTwoRange() 'Updateby20131120 Dim Rng1 As Range, Rng2 As Range Dim arr1 As Variant, arr2 As Variant xTitleId = "KutoolsforExcel" Set Rng1 = Application.Selection Set Rng1 = Application.InputBox("Range1:", xTitleId, Rng1.Address, Type:=8) Set Rng2 = Application.InputBox("Range2:", xTitleId, Type:=8) Application.ScreenUpdating = False arr1 = Rng1.Value arr2 = Rng2.Value Rng1.Value = arr2 Rng2.Value = arr1 Application.ScreenUpdating = True End Sub
This code was taken from Indeed.com.
- Click on the green “Run” button in the main toolbar.
When the code runs, you will be prompted to enter the address for the first value. Input the cell address and press “Enter.” You will then be prompted to input the second cell address. Input the address and press “Enter,” the cells should then be swapped.
Want to learn more about using VBA? Check out these top Excel VBA courses on Udemy to upskill today.
What Does Swapping Cells in Excel Mean?
In Excel, swapping cells means changing the values of any two cells to the opposing cell’s value. Cells with text, formulas, and numbers can be swapped.
The Excel swap cells functionality may also include formatting components like fonts and background colors. While manually switching the cells by retyping, copying, and pasting the numbers is an option, other ways to swap the cells can help you work more quickly and efficiently.
When Should You Swap Cells in Excel?
If you need to add a large amount of data to your Excel worksheet but decide it would look better visually if the cells were swapped. An option I like to use is correcting the errors for accuracy’s sake.
Swapping cells can also save time by preventing the need to retype data.
How To Swap Cells in Excel: Extra Tips
Now that we have looked at how to swap cells in Excel let’s look at a few tips for switching cells in Microsoft Excel.
Swapping Adjacent Columns or Rows
The same procedure used to swap adjacent cells in Excel can also be used to switch rows and columns. Just select the row or column headers instead of individual cells.
This will also work with adjacent ranges. Just select the entire range instead of individual cells.
Swapping Cell Ranges From Anywhere in the Worksheet
You can use the VBA method or add-ons like KuTools to swap entire ranges instead of individual cells. Just make sure you use absolute values when entering the ranges.
Related: 11 Best Excel Courses Online in 2023
Frequently Asked Questions
How Can I Quickly Swap Two Adjacent Cells in Excel?
Follow the steps below to swap the contents of two adjacent cells:
- Click to select the cell and hold Shift on your keyboard.
- Move your cursor to either side of the cell box.
- Click and drag the cell’s contents to the far end edge of the cell with which you want to swap the contents.
- Now, let go of the cursor to swap the two cells.
Is There a Shortcut to Swap Cells Excel?
Yes, and it’s super simple to use! Just follow the steps below:
- Select the cell you want to swap and press the Ctrl + X keyboard shortcut.
- This will cut out the contents of the cell.
- Click the Ctrl + Shift + = keyboard shortcut to swap the cell’s contents.
Now you know how to swap cells in Excel in every way. While swapping adjacent cells is easy, using VBA code to swap further apart ranges is a little more complex. Hopefully, Microsoft will make it a little easier in the future.
If you found this article helpful and would like to support our site, consider checking out our premium template library to streamline your life. Remember to use the code SSP to save 50%.