How to Swap Two Columns in Excel
How to swap two columns in Excel safely: cut-paste-with-shift method, the Shift drag, and a free macro that swaps without breaking formulas elsewhere.
2026-04-28
The "I built it in the wrong order" problem
You created a table. First Name in B, Last Name in A. The mail merge wants A=First, B=Last. So you need to swap two columns. Excel doesn't have a "swap" command. The workarounds either break formulas or take too many steps. Here are the real options.
TL;DR — Key takeaways
- Shift + drag is the fastest manual method but only works for adjacent columns and can confuse formulas elsewhere.
- Cut-paste-with-shift also works but takes 3 steps with a lot of room for misclick.
- A VBA macro swaps two columns by exchanging values, leaving formulas elsewhere in the workbook untouched.
Method 1: Shift + drag
The keyboard-mouse trick:
- Click the column header (e.g., column B header letter).
- Hold Shift and drag the column to its new position. A green I-beam shows where it'll insert.
- Release.
The catch: this method shifts cells around, which changes the address of every cell that moved. Formulas elsewhere in the workbook that referenced the moved cells now point to wrong locations. For self-contained tables this is fine; for cross-tab models, it can silently corrupt.
Method 2: Cut, paste-with-shift, re-cut
Step-by-step:
- Select the second column. Cut.
- Click the first column. Right-click > Insert Cut Cells. The columns swap and the rest shift accordingly.
This is similar to Shift+drag. Same caveats about cross-tab formula references.
Method 3: The free VBA macro
Download Swap Two Columns. Free .xlsm with one macro.
- Select 2 columns (adjacent or Ctrl+click for non-contiguous).
- Alt + F8, pick the macro, click Run.
- The macro reads each column's values into memory, then writes column A's values into column B's range and vice versa.
Crucially, the macro doesn't shift cells around — it swaps values in place. So formulas elsewhere that reference column A still reference column A; they just see different values now (the values from old column B). For most "I want them to switch" scenarios this is exactly what you want.
What about formulas inside the swapped columns?
If column A has formulas with relative references (=B2*2), those formulas get swapped into column B's range. Now they're sitting at column B's position but still say =B2*2, which now references column B's new value. The formulas don't auto-adjust because the macro is doing a value swap, not a structural move.
For columns with relative-reference formulas, freeze them first with Convert Formulas to Values, then swap.
A common scenario: post-import column reorder
CSV import lands with date in column C and amount in column B. You want amount first.
- Select columns B and C.
- Run Swap Two Columns.
- Done.
Other tabs that referenced column B continue working. They now see what was in column C, which (since columns B and C share the same row context) is usually the intent.
Frequently asked questions
Can it swap rows?
No, this macro is column-only. For row swaps, just cut-paste manually for one-off cases.
What if my two columns have different numbers of rows?
The macro errors. Both columns must have the same row count.
What about merged cells?
Merged cells in either column cause unpredictable results. Run Unmerge Cells and Fill Down first.
Can I swap 3 or more columns at once?
No, exactly 2. For multi-column reordering, run the macro multiple times, or use cut-paste manually.
Can I undo it?
Yes, Ctrl/Cmd + Z right after running.
What to do next
If you actually want to flip the entire data orientation (rows become columns), use Transpose Rows and Columns. For reversing row order, Reverse Row Order.