Delete Columns in Excel (6 Different Cases)

Here’s an overview of deleting columns in Excel. We’ll go through each method in more detail below.

Delete Columns in Excel


Download the Practice Workbook


Delete Columns in Excel: 6 Different Cases with Ways

Case 1 – Use the Delete Feature to Remove Multiple Contiguous Columns

  • Select the columns by holding the left click and dragging over column headers.
  • Alternatively, you can select all columns by pressing the Ctrl key and selecting column headers.
  • Right-click on the selection and choose Delete.

Use of DELETE Feature for Removing Multiple Contiguous Columns

  • All the selected columns are deleted.

After Deleting Columns

Alternatively:

  • Save your workbook with the .xlsm extension.
  • In the Developer tab, go to Visual Basic.

Opening VB Editor in Excel

  • The VBA Editor will appear. From the Insert tab, select Module.
  • Copy the following code in Module1.

Using VBA code to Remove Columns

Sub SelectDeleteAjacentColumns()
Worksheets("Dataset").Select
Range(Columns(7), Columns(10)).Delete
End Sub
  • In the Range property, you have to set the column range. Put the first and last columns as arguments of the Range that you want to delete.

Case 2 – Deleting Columns in Excel That Go on Forever

We have some unwanted values in a single row across many columns (from the E column to the rest of the columns).

  • Select the E4 cell (the first cell with a value that you want to delete).
  • Press Ctrl + Shift + Right Arrow to select all cells to the right.
  • From the Home tab, under the Cells group, select Delete and choose Delete Sheet Columns.

Deleting Columns in Excel That Go on Forever

  • We removed all the columns.

After Deleting Unnecessary columns


Case 3 – Using Formula to Remove Blank Columns

  • Select the cell above which you want to insert the row, right-click, and select Insert.
  • From the Insert dialog box, select Entire row and press OK.

Inserting Rows in Excel

  • In the C6 cell, enter the following formula:
=IF(COUNTA(C7:C15)=0,TRUE,FALSE)

In this formula, the COUNTA function will count the cells which are not empty. So, the logic in the IF function will be whether all the cells contain a value or not.

  • Use the Fill Handle icon row-wise to copy the formula for the rest of the cells in the row.

Using Formula to Remove Blank Columns

  • From the Home tab, go to the Editing group, then to Find & Select and choose Find.

Use of Find & Select Feature in Excel

  • You will get the Find and Replace dialog box. Write TRUE in the Find what box.
  • Choose Values in the Look in box.
  • Select Find All.
  • You will get a list of all the cells having TRUE below.
  • Click on a result from the list, then press Ctrl + A to select them all.

Find the Cell Value having TRUE

  • From the Home tab, go to the Cells group, select the Delete section, and choose Delete Sheet Columns.

Remove Sheet Columns

  • Delete the row added for the check in a similar way.

Delete Sheet Rows

  • You will get the dataset without empty columns.

Remove Fully Blanked Columns


Case 4 – Using VBA to Delete Columns with a Certain Text

  • Check out the following article if you don’t have the tab on your ribbon: How to Display Developer Tab on the Ribbon in Excel.
  • From the Developer tab, click on Visual Basic, and the VBA Editor will be opened.
  • From the Insert tab, click on Module.
  • Insert the following code in the module.
Sub Delete_Columns_having_Specific_text()
Dim my_cell As Range
For Each my_cell In Range("C5:N5")
If my_cell.Value = "Mar" Then
my_cell.EntireColumn.Delete
End If
Next my_cell
End Sub

Here, this code will remove all the columns (from the C column to the N column) if the cell value is “Mar”.

  • Save the code and go back to the worksheet.
  • From the Developer tab, select Macros.
  • In the Macro dialog box, select the name of the macro Delete_Columns_having_Specific_text and press Run.

Using VBA to Delete Columns Having Certain Text

The code checks for the value “Mar” but you can change that to a string or value you need to remove.


Case 5 – Use Go To Special to Delete the Columns without Data

  • From the Home tab, go to the Editing group, click on Find & Select, and choose Go To Special.
  • Select Blanks in the Go To Special dialog box and press OK.

Use of Go To Special to Delete the Columns Having no Data

  • You will get all the blank cells selected.
  • From the Home tab, go to the Cells group, select the Delete segment and choose Delete Sheet Columns.

Deleting All the Columns Having Blank Cells

Note: If a column has at least one blank value, it will be deleted regardless of how many non-blanks it has, so proceed with caution.


Case 6 – Reducing Columns from Power Query

  • Select the entire dataset.
  • In the Data tab, go to the Get & Transform Data group and select From Table/Range.
  • You will get the Create Table dialog box. Check My table has headers (if your dataset contains the headers) and press OK.

Note: As there is a blank column in the dataset, Excel can’t define the headers.

Creating Table in Excel

  • In the Power Query Editor, go to the Home tab.
  • From the Manage Columns group, click on Remove Columns.
  • Select the columns you want to keep.
  • Press Remove Other Columns.

Remove columns in Power Query

  • From the File tab, choose Close & Load.
  • You will get your updated data in the worksheet.

Removed Columns from Power Query

  • If you have a created Power Query, click on any cell of the table.
  • From the Query tab, press Edit and you’ll get the Power Query Editor.
  • Use the Manage Columns group for deleting columns. In Power Query, there is a section named APPLIED STEPS, which can be used to revert various functions.

Editing the Excel Power Query to Delete Columns

Read More:


How to Delete Rows in Excel

  • Select all the rows by clicking and dragging through their index numbers. Use Ctrl + click for non-contiguous selection.
  • From the Home tab, go to the Cells group.
  • In the Delete section, select Delete Sheet Rows.

How to Delete Rows in Excel

Read More:


How to Delete Cells in Excel

  • Select a cell or a group of cells.
  • Go to Cells, then Delete, and select Delete Cells.
  • You will get a dialog box of Delete.
  • Choose the option you want to apply from the list (shifting the cells in the row or column, or deleting the entire row or column).

Deleting Cells in Excel

  • We have chosen Shift cells left, so the selected cell is removed, and all the other cells of the right-hand side shift towards the left, so the last column in the row doesn’t have a value any more.

Shifting Cells towards left

Read More:


Frequently Asked Questions

What is the Shortcut for deleting columns?

Press Ctrl + Minus() keys together to delete the selected column(s).

How do I remove columns from all sheets in Excel?

Press Ctrl + A, then go to Delete and select Delete all columns.

How do I delete 1000 columns in Excel?

Select the first column you want to delete, hold down the Shift key, and press the right arrow key (→) 999 times. This will select a range of 1000 columns. Press Ctrl + minus (-) to delete them, then confirm your choice.


Delete Columns in Excel: Knowledge Hub


<< Go Back to Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Musiha Mahfuza Mukta
Musiha Mahfuza Mukta

Musiha Mahfuza Mukta is a marine engineer who loves exploring Excel and VBA programming. To her, programming is a time-saving tool for dealing with data, files, and the internet. She's skilled in Rhino3D, Maxsurf, C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. With a B.Sc in Naval Architecture & Marine Engineering from BUET, she's shifted gears and now works as a content developer. In this role, she creates techy content exclusively focused on Excel... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo