Microsoft Excel is a spreadsheet application that allows users to input, store and manage data. Many professionals use Excel, including those working in business, scientific research, management, marketing and banking. If you use Excel to organize data, it may be helpful to learn how to switch the values associated with certain cells in a spreadsheet. In this article, we explain what it means to swap cells, express when doing so may be important, describe how to swap cells in Excel and include several tips to help improve your related Excel knowledge.

What does it mean to swap cells in Excel?

Swapping cells in Excel is the process of switching the values of two cells. You may swap cells that contain text, numbers or formulas. You can also include formatting elements such as background colors and fonts in your cell swaps. While it's possible to switch the cells manually by cutting and pasting or retyping the values, there are also several methods for swapping cells that may save you time and increase efficiency.

When is it important to swap cells in Excel?

There may be situations that arise in which you enter a set of data into Excel and realize later that you can improve your layout or spreadsheet readability by swapping cells. You may also wish to swap cells to preserve the accuracy of your spreadsheet if you notice a discrepancy or if there has been a change in the data parameters. If you're planning to share your spreadsheet with others, you may also swap cells to create a visually appealing design.

Swapping cells instead of retyping the values can also save you time, particularly if you're swapping the values of multiple cells at once. If the cells you want to swap include complex formulas, detailed values or formatting, it may be simpler to swap the cells than it would be to recreate the values and formatting elsewhere.

How to swap cells in Excel

Here are three techniques you can use to swap cells in Excel:

Swap adjacent cells

You can swap adjacent cells in Excel easily by adhering to the following steps:

  1. Click on the first cell you'd like to swap.
  2. Press and hold down the "Shift" key on your keyboard.
  3. Move your cursor to the cell border on the right until the mouse changes from a white plus (+) sign to a plus sign made of black arrows.
  4. Click the mouse and drag it to activate a bracket icon.
  5. Continue dragging the mouse until the bracket aligns with the far wall of the cell you'd like to swap.
  6. Release the mouse to swap the cells.

Swap cells using Kutools

Kutools is an Excel extension that can help simplify complex processes for Excel users. After downloading this application, you may use it to swap cells by following the instructions below:

  1. First, open the "Swap Ranges" dialog box. To do this, click on the "Kutools" tab in your toolbar, then click the small down arrow below the "Range" option and click "Swap Ranges..."

  2. Click the icon with blue Excel boxes and a red arrow, located next to the "Swap Range 1" label, and then click on the cell you'd like to swap on your spreadsheet. Alternatively, you may enter the cell location manually by typing in the code "$[Letter]$[Number]."

  3. Repeat this process for the second cell range.

  4. Click "Ok" to swap the cells.

    Swap cells using VBA code

    You can also swap cells from anywhere in your spreadsheet by using the Visual Basic for Applications (VBA) programming language in Excel. To swap cells using VBA code, follow these steps:

    1. Select your first cell

    First, click on the first cell that you'd like to swap. While you can skip this step, completing it can help simplify the process later. This is because when the time comes to run the program and input the cells you'd like to switch, Excel can automatically populate the location of your first cell.

    2. Input VBA code

    To open the VBA code window, press "ALT + F11" on your keyboard. Next, go to "Insert" and select "Module." This opens a new window where you may copy and paste the following code:

    Sub SwapTwoRange()


    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

    3. Run the code and select the cells you'd like to swap

    To run the code, click the small green forward arrow icon in the "Module" toolbar. You can also run the code by clicking "Run" in the toolbar at the top of the window and then selecting "Run Sub/User Form" or by pressing "F5" on your keyboard. This activates a pop-up window with the title "KutoolsforExcel" and the label "Range1." If you selected your first cell before opening the VBA window, the range may already contain the code "$[Letter]$[Number]," in which [Letter] and [Number] identify the first cell you selected to swap.

    You can also change the cell at this point by manually adding or altering the identifying information or by navigating back to your workbook and clicking on the first cell you'd like to swap. After verifying that it references the correct cell, press "Ok." This activates a second pop-up window, which asks for "Range2." You can enter the identifying information for your second cell manually or by clicking on it in your spreadsheet. Next, press "Ok" again. This swaps the two cells.

    Tips for swapping cells in Excel

    Here are some tips that may help clarify more advanced swapping techniques in Excel:

    Try to swap adjacent rows or columns

    You can use the same method described above for swapping adjacent cells to swap rows or columns in Excel. To do this, click on the first cell in the row or column that you'd like to swap, and then hold the mouse down while you drag the cursor across or down the row or column to select a range of cells. Doing this causes a green box to appear around the cells you've selected.

    Next, hold down the "Shift" key, place your cursor on the green border and click and drag it until the bracket icon aligns with the opposite wall of the cells you'd like to swap with your selected cells. Finally, release the cursor to swap the row or column.

Consider swapping cell ranges anywhere on the spreadsheet

You can use either the Kutools or the VBA code method to swap a range of cells from anywhere on your spreadsheet. To do this, select a range of cells rather than a single cell at the point at which the process prompts you to identify the range you'd like to swap. You can also type in a range manually by using the appropriate code. You can signal a range in the code by listing the cell in the upper left corner of your range and the cell in the bottom right corner, separated by a colon.


In conclusion, mastering the art of swapping cells in Excel is a valuable skill that can save you time and frustration when working with data. Whether you're reorganizing your spreadsheet, correcting errors, or simply looking to streamline your workflow, the ability to swap cells efficiently is a must-know Excel trick.

Remember that you have multiple methods at your disposal, from the straightforward cut-and-paste approach to the more advanced drag-and-drop technique. Choose the method that suits your workflow best, and practice it until it becomes second nature.

Excel is a powerful tool, and knowing how to manipulate your data effectively will make you a more proficient and productive user. So, next time you find yourself needing to swap cells in Excel, you'll be well-prepared to do so seamlessly. Happy spreadsheet swapping!