How to delete empty rows in excel
Tutor 5 (273 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Deleting empty rows in Excel can improve spreadsheet clarity and make data analysis more efficient. There are several methods to remove empty rows depending on your needs.
Method 1: Using the Filter Feature
-
Select the entire dataset or the columns that contain data.
-
Go to the Data tab on the Ribbon.
-
Click Filter to enable filter dropdowns on each column header.
-
Click the filter dropdown for a column that might have empty rows.
-
Uncheck all values except Blanks.
-
Select all visible blank rows by clicking their row numbers on the left.
-
Right-click the selected rows and choose Delete Row.
-
Remove the filter to view the cleaned dataset.
Method 2: Using Go To Special
-
Select the entire dataset or the columns to check for empty rows.
-
Press Ctrl + G (Windows) or Command + G (Mac) to open the Go To dialog.
-
Click Special, then select Blanks and click OK.
-
All blank cells are highlighted.
-
On the Home tab, click Delete → Delete Sheet Rows.
Method 3: Sorting the Data
-
Select your dataset.
-
Go to the Data tab and choose Sort.
-
Sort by a column that should have data.
-
Empty rows move to the bottom.
-
Select and delete the rows at the bottom.
Method 4: Using a VBA Macro (For Large Datasets)
-
Press Alt + F11 (Windows) or Option + F11 (Mac) to open the VBA editor.
-
Click Insert → Module.
-
Paste the following code:
Sub DeleteEmptyRows()
Dim R As Long
Dim LastRow As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
For R = LastRow To 1 Step -1
If Application.WorksheetFunction.CountA(Rows(R)) = 0 Then
Rows(R).Delete
End If
Next R
End Sub
Press F5 to run the macro.
-
All empty rows in the active sheet are deleted.
Tips
-
Always make a backup before mass-deleting rows.
-
Use Go To Special for quick manual cleaning of smaller datasets.
-
Use VBA for automated cleaning of large datasets with thousands of rows.
-
Deleting empty rows does not affect rows with formulas returning
"". To remove them, consider using a helper column with=COUNTA(A1:Z1)to identify truly empty rows.
This ensures a clean dataset ready for analysis, charts, or exporting.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to sort by highlighted cells in excel
Answers · 1
How to sort excel by column and keep rows together
Answers · 1
How to sort by time in excel
Answers · 1
How to sort alphabetically in excel by last name
Answers · 1