Add a helper column with =COUNTA(A2:C2), fill it down, filter it for 0, check those rows, then delete them. Only rows that are empty in every column go; a row with one missing value stays.
=COUNTA(A2:C2)
You pasted data from another system or combined several sheets, and now empty rows break your sorting, totals and charts.
The safe way removes only rows that are empty in every column. Quicker tricks like Go To Special › Blanks also delete rows that have just one gap, such as an order with no customer name.
Step by step
- In the first empty column next to your data (here D), type a header such as Filled in D1, then enter =COUNTA(A2:C2) in D2. Change A2:C2 so it covers every column of your table.
- Copy the formula down: select D2 to the last row of your data and press Ctrl + D. (Double-clicking the fill handle can stop at the first gap in the column next to it.)
- Click any cell in the table and press Ctrl + Shift + L to turn on Filter. Open the filter on the helper column and tick only 0.
- Check the rows that are left: each one should be empty in every column. Then select their row numbers, right-click and choose Delete Row.
- Press Ctrl + Shift + L again to clear the filter, check your data, then delete the helper column.
On a Mac: The steps are the same. Fill down with Control + D, turn on Filter with Cmd + Shift + F, then Control-click a selected row number and choose Delete Row.
Before and after
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Order | Customer | Amount | Filled |
| 2 | 1001 | Ana | 250 | 3 |
| 3 | 0 | |||
| 4 | 1002 | Ben | 180 | 3 |
| 5 | 0 | |||
| 6 | 1003 | 320 | 2 | |
| 7 | 1004 | Dan | 90 | 3 |
| A | B | C | |
|---|---|---|---|
| 1 | Order | Customer | Amount |
| 2 | 1001 | Ana | 250 |
| 3 | 1002 | Ben | 180 |
| 4 | 1003 | 320 | |
| 5 | 1004 | Dan | 90 |
The macro
Press Alt+F11, choose Insert › Module, paste the code, then press F5 to run it. Save the file as .xlsm to keep the macro.
Delete rows that are empty in every column of the selection
Sub DeleteBlankRows()
' Select your table first. Deletes only rows that are empty in every
' selected column, so rows with a missing value are kept.
Dim rng As Range, i As Long
Set rng = Selection
For i = rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(rng.Rows(i)) = 0 Then
rng.Rows(i).EntireRow.Delete
End If
Next i
End SubWith a formula instead
| Formula | Use it when |
|---|---|
=FILTER(A2:C7,(A2:A7<>"")+(B2:B7<>"")+(C2:C7<>"")) | You want a clean copy without changing the original: keeps every row that has a value in any column (Excel 2021 and Microsoft 365). |
=FILTER(A2:C7,BYROW(A2:C7,LAMBDA(r,COUNTA(r)>0))) | The same for wide tables, without listing each column (Microsoft 365). |
Practise it
Free exercises with instant feedback. No sign-up needed.
Common mistakes
- Go To Special › Blanks, then deleting entire rows, removes every row with any empty cell, including an order with a missing customer name but a valid amount. Count each row's filled cells with =COUNTA(A2:C2) and delete only the rows where it is 0.
- Filtering one column for (Blanks) deletes rows that are only missing that one value. Filter the COUNTA helper column instead: it checks every column of the row.
- Rows that look empty contain spaces or formulas returning "", and COUNTA counts those as filled. Use =SUMPRODUCT(--(LEN(TRIM(A2:C2))>0)) in the helper column: it counts only cells with visible text or numbers.
- Deleting cells instead of rows shifts data sideways and mixes up columns. Right-click the row numbers and choose Delete Row, so whole rows are removed.
Questions people also ask
Why not use Go To Special › Blanks?
It selects every empty cell, so deleting entire rows also deletes rows that have just one missing value. It's only safe on a column that is always filled, like an ID column with no gaps.
Can I remove blank rows with a filter?
Yes: filter the COUNTA helper column for 0. Filtering a single data column for (Blanks) also catches rows that are only missing that column's value.
How do I remove blank rows without deleting hidden data?
Unhide all rows first (select all, right-click a row number, Unhide), so the helper column and the filter see every row.
Does removing blank rows break formulas?
Formulas that refer to whole columns or structured table references adjust automatically. Direct cell references may need checking.
Functions used
Steps written for Excel for Microsoft 365 on Windows. All how-to guides