How to Remove Blank Rows in Excel: A Step‑by‑Step Guide
Why Blank Rows Matter
Blank rows look harmless, but they can cause real problems in an Excel workbook.
| Issue | Typical Symptom |
|---|---|
| Misleading calculations | Averages that are lower than expected |
| Disordered sorting | Related rows split by blank lines |
| Cluttered PivotTables | Extra “(blank)” category in rows/columns |
| Slower workbook performance | Longer recalculation times, laggy scrolling |
| Import errors | Destination system rejects the file or adds empty rows |
- Data analysis gets skewed – Functions such as
AVERAGE,COUNT, orSUMIFStreat empty rows as part of the range, which can produce incorrect totals or averages. - Sorting and filtering break down – Blank rows are moved to the top or bottom when you sort, separating related records.
- PivotTables lose continuity – Blank rows become separate “(blank)” groups, cluttering the report.
- Performance suffers – Even empty rows increase file size and the amount of data Excel must scan, slowing recalculation on large sheets.
- Import/export issues – External systems often interpret blank rows as missing records, causing errors or unwanted empty rows downstream.
Removing blank rows keeps your data clean, ensures formulas work as intended, and improves overall workbook efficiency.
1. Using Filters to Hide and Delete Blank Rows
Filtering is the quickest way to locate and purge blank rows without writing a formula. The steps are identical in Excel (Windows/macOS) and Google Sheets (menu names differ slightly).
| A | B | C |
|---|---|---|
| Name | Date | Amount |
| Alice | 1/5/2024 | 120 |
| Bob | 2/10/2024 | 85 |
| Carol | 3/15/2024 | 210 |
Steps
- Select the whole data range (including headers).
- Turn on the filter
- Excel: Data ► Filter (or Ctrl + Shift + L).
- Google Sheets: Data ► Create a filter.
- Click the dropdown arrow in any column header.
- Choose “Blanks” (or uncheck everything except “(Blanks)”). This hides every row that contains data and leaves only completely empty rows visible.
- Select the visible blank rows – click the first row number, then Shift‑click the last one.
- Delete the rows
- Excel: right‑click ► Delete Row ► Table Rows (or Ctrl + -).
- Google Sheets: right‑click ► Delete rows X‑Y.
- Clear the filter to reveal the cleaned table.
Result
| A | B | C |
|---|---|---|
| Name | Date | Amount |
| Alice | 1/5/2024 | 120 |
| Bob | 2/10/2024 | 85 |
| Carol | 3/15/2024 | 210 |
2. Go To Special (Excel) – Selecting and Deleting Blank Rows
The Go To Special command lets you highlight every blank cell in a selected range and delete the rows that contain them.
Steps in Excel
- Select the range you want to clean. To select the entire worksheet, press Ctrl + A twice.
- Press F5 (or Ctrl + G) → Special… → choose Blanks → OK. All blank cells are now highlighted.
- With the blanks still selected, press Ctrl + - → choose Entire row → OK. Excel removes every row that contained a blank cell in the original selection.
Tip: If you only want to delete rows where all cells are blank, first filter each column for blanks, then delete the visible rows.
Google Sheets Equivalent
Google Sheets does not have a built‑in “Go To Special”. You can achieve the same result with a filter (see Section 1) or with a short Apps Script:
function deleteBlankRows() {
const sheet = SpreadsheetApp.getActiveSheet();
const data = sheet.getDataRange().getValues();
for (let i = data.length - 1; i >= 0; i--) {
if (data[i].every(cell => cell === "")) {
sheet.deleteRow(i + 1);
}
}
}
Running the script removes any rows that are completely empty.
3. Removing Blank Rows with a Formula
A helper column can flag rows that contain data, letting you filter or copy only the rows you need. The same formula works in modern Excel (Office 365/2021 or later) and in Google Sheets.
3.1 Create a helper column
Assume your data starts in A2 and spans columns A:C. In D2 enter:
=IF(COUNTA(A2:C2), ROW(), "")
| A | B | C | D (helper) |
|---|---|---|---|
| John | 10 | 2023‑01‑01 | 2 |
| Mary | 15 | 2023‑01‑02 | 4 |
| Tom | 12 | 2023‑01‑03 | 6 |
Result: The formula returns the row number when at least one cell in the row is non‑blank; otherwise it returns an empty string.
3.2 Filter out the blanks
- Excel: Turn on AutoFilter (Home ► Sort & Filter ► Filter). Click the dropdown on column D, uncheck (Blanks).
- Google Sheets: Data ► Create a filter ► filter column D by clearing the check‑box for Blanks.
Only rows with data remain visible.
3.3 (Optional) Copy the cleaned list
Select the visible rows, copy, then paste‑special → Values to a new sheet or range. Delete the helper column if you no longer need it.
Why it works
COUNTA(A2:C2)counts any non‑empty cells in the row.IF(..., ROW(), "")returns the row number only when the count > 0, giving a unique, sortable key.- Filtering on a non‑blank helper column removes all‑blank rows without altering the original data.
4. Best Practices for Avoiding Blank Rows
Blank rows are usually the result of sloppy data entry or copy‑pasting from other sources. Preventing them in the first place saves time and keeps formulas, filters, and PivotTables working smoothly.
| Practice | Why it Helps | Quick Implementation |
|---|---|---|
| Use Excel Tables | Tables expand automatically and keep rows contiguous. | Select the range → Ctrl + T. |
| Validate Input with Data Validation | Forces users to fill required fields. | Select a column → Data ► Data Validation → set criteria and tick Reject input that does not meet the criteria. |
| Turn off “Show blanks” in filters | Prevents hidden blanks from re‑appearing after a filter is applied. | In a filtered column, uncheck (Blanks). |
| Use Structured References | Formulas like =SUM(Table1[Amount]) ignore empty rows automatically. |
Write formulas using the table name and column header. |
| Apply a “Remove Blank Rows” step in Power Query | Strips blanks before data reaches the worksheet. | In Power Query Editor → Home ► Remove Rows ► Remove Blank Rows. |
| Standardize import processes | Import scripts that trim empty rows keep the sheet clean. | After import, run =FILTER(A2:C100, LEN(A2:A100)>0) to drop rows where column A is empty. |
Additional Tips
- Consistent data‑entry forms – Use Microsoft Forms, Google Forms, or a shared template that marks required fields.
- Regular audits – Place
=COUNTBLANK(A:A)in a spare cell to monitor growing blanks. - Lock cells that must never be empty – Protect the worksheet and lock required cells to prevent accidental deletion.
5. Troubleshooting Common Issues
| Problem | Likely Cause | Quick Fix |
|---|---|---|
| Blank rows remain after Filter → Delete Row | Cells contain spaces, non‑printing characters, or formulas returning "". |
Use Ctrl + H → Find a space (or the suspect character) → Replace with nothing → Re‑apply filter and delete. |
| Go To Special → Blanks deletes rows you need | Some “blank” rows actually contain hidden values (e.g., 0 dates). |
Use Filter instead, so you can preview which rows will be removed. |
| Power Query removes rows but the output still shows blanks | The “Remove Blank Rows” step is placed before an Expand or Merge step that re‑introduces blanks. |
Move the Remove Blank Rows step after any expanding/merging steps. |
XLOOKUP or VLOOKUP returns #N/A after rows are deleted |
The lookup range still includes the deleted rows, causing mismatched array sizes. | Convert the source data to a Table (Ctrl + T) so ranges adjust automatically, or redefine the range manually. |
Google Sheets =FILTER returns an error after removing rows |
The filter range still contains empty rows that break array dimensions. | Use =QUERY(A2:C, "select * where A is not null", 0) or wrap the range in ARRAYFORMULA. |
Common Mistakes & How to Avoid Them
- Deleting rows instead of clearing contents – If you only need to remove the blank values but keep the row structure, use Clear Contents (
Delete ► Clear Contents) rather than deleting the entire row. - Running a macro on a filtered list – Deleting rows while a filter is active can skip hidden rows. Always remove the filter before running a macro that deletes rows.
FAQ
How can I delete blank rows without affecting data in other columns?
Use a filter to show only completely blank rows, then delete the visible rows. Because the filter isolates rows that are empty across all columns, no data in other columns is touched.
What is the fastest way to remove blank rows in Excel?
The quickest native method is Go To Special → Blanks → Delete → Entire row. It highlights every blank cell in one step and removes the associated rows instantly.
Can I automate the removal of blank rows using a macro?
Yes. A simple VBA macro can loop through a range from the bottom up and delete any row where all cells are empty:
Sub DeleteBlankRows()
Dim ws As Worksheet, r As Long, lastRow As Long
Set ws = ActiveSheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
For r = lastRow To 1 Step -1
If Application.WorksheetFunction.CountA(ws.Rows(r)) = 0 Then ws.Rows(r).Delete
Next r
End Sub
The macro works in all recent versions of Excel (including Office 365) and removes rows without disturbing other data.
By following the methods and best‑practice tips above, you can keep your worksheets free of stray blank rows, ensure calculations stay accurate, and maintain optimal performance. Happy cleaning!