Excel: Delete row if cell in certain column is blank?
Solution 1:
You can do this very quickly if the cells are truly blank using SpecialCells
Manual
- Select Column C
- Press
F5
, thenSpecial
- Check
Blanks
, thenOK
(see this step in the pic at bottom) - Delete the rows that are now selected (e.g. right click in selection > Delete cells... > Entire row or via the ribbon (see second screenshot))
VBA
Sub QuickCull()
On Error Resume Next
Columns("C").SpecialCells(xlBlanks).EntireRow.Delete
End Sub
Solution 2:
Here's an easy manual method
- Apply an
Auto Filter
to your sheet - Filter on column
C
Blank - Select all visible rows
- Delete Rows
- Remove filter
This process can be automated with VBA if required. Try running the macro recorder to get a start
Solution 3:
I think the easiest thing assuming you don't have a bunch of other formulas in the other cells is to just sort everything by Column C and then delete all the rows that have a blank for column C(the sort function will put the blank values for column C at the top of the file).
In summary:
- Click on the folded paper cell above cell marked "1" and to the left of cell marked "A" (to highlight all)
- Click on Data, and then sort
- Sort by Column C, and make smallest values be first
- Just highlight the rows down until you hit the first row with a value for Column C, and delete everything you highlighted