56 free macros indexedAll toolsHow to runBlogGitHub ↗

How to Delete Empty Columns in Excel

How to delete empty columns in Excel: manual right-click, Power Query Remove Other Columns, and a free macro that scans and removes empty columns at once.

2026-04-28

The "47 columns, only 8 have data" problem

CSV exports and Power Query refreshes often produce columns that are entirely blank. Maybe the source system had a "Notes 2" field nobody fills in. Maybe Power Query added a join column that ended up empty after a filter step.

TL;DR — Key takeaways

  • Manual scroll-and-delete works for a few columns but is tedious for a wide CSV.
  • Power Query Remove Other Columns lets you keep only the columns you want.
  • F5 > Special > Blanks doesn't directly delete empty columns (it's row-oriented).
  • A VBA macro scans your selection and deletes any column that's entirely blank, right-to-left for index stability.

Method 1: Manual scroll-and-delete

Scroll right. Find empty columns. Ctrl+click headers. Right-click > Delete.

For 22 empty columns scattered across a 47-column CSV, expect about 4 minutes of fiddly Ctrl+clicking. Plenty of room for misclick.

Method 2: Power Query Remove Other Columns

  1. Load data into Power Query.
  2. Select the columns you want to keep. Right-click > Remove Other Columns.
  3. Close & Load.

Inverse of "delete empty": keep only what you want. Works well for recurring CSV imports.

The catch: Power Query setup is more than the payoff for a one-off.

Method 3: The free VBA macro

Download Delete Empty Columns. Free .xlsm with one macro.

  1. Select the range to scan. The macro deletes columns that are entirely blank within your selection.
  2. Alt + F8, pick the macro, click Run.
  3. Empty columns are deleted right-to-left so column indices stay stable. Reports the count.

Sibling to Remove Blank Rows

The pair: Remove Blank Rows deletes rows that are entirely blank, Delete Empty Columns does the same for columns. Both are safer than the F5 trick on data with sparse blanks.

Always select the full height of your data

The macro only checks cells inside your selection. If you select rows 2 through 500 but a column has data in row 501, the macro thinks the column is empty (rows 2-500 are blank in that column) and deletes the entire column, including row 501's data.

Always select the full height: Ctrl+A to select the data block first.

What counts as empty

A column is treated as empty if every cell within your selected row range is:

  • Truly empty, or
  • An empty string, or
  • Whitespace-only.

So a column where every cell has just a stray space gets deleted. This catches the "stealth empty" problem where copy-paste introduced invisible spaces.

A common scenario: campaign performance CSV

Marketing analyst pulls daily campaign performance from the ad platform. Export has 47 columns. 22 are always empty because the account doesn't use those features.

  1. Select the full data block.
  2. Run Delete Empty Columns.
  3. 22 columns disappear. Pivot becomes manageable.

Versus scroll-and-Ctrl-click: about 1 second versus 4 minutes.

Frequently asked questions

What about columns with only headers (data row blank)?

If the header cell has any text, the column counts as not-empty and stays. To remove header-only columns, exclude row 1 from your selection (start at row 2).

Will it delete columns with formulas evaluating to blank?

Yes. A formula returning "" is treated as blank. If you don't want those columns deleted, copy them to values first or run the macro on a different selection.

Does it work on filtered data?

The macro checks every cell in the selection regardless of filter. To check only visible cells, copy the visible rows to a fresh sheet first, then run.

Will it preserve the columns to the right's formatting?

Yes. After deletion, columns shift left and their formatting comes with them.

Can I undo it?

Yes, Ctrl/Cmd + Z right after running undoes the deletions.

What to do next

For the row-direction sibling, Remove Blank Rows. For visualizing which columns or rows are sparse before deciding what to delete, Highlight Blank Cells.