Skip to main content

Remove Blank Rows in Excel: 4 Easy Methods

Learn how to remove extra rows quickly using sorting, formulas, and VBA, depending on what works best for you.
Apr 26, 2025  · 5 min read

Blank rows in Excel often appear when you export data from other systems, when you accidentally leave gaps, or when you combine different sheets. These gaps can disrupt important tasks such as data sorting, filtering, and analysis. They slow you down, and if you're not careful, they can lead to mistakes.

In this article, I'll show you four different ways to remove these blank rows.

Quick Answer: Remove a Blank Row

To delete a blank row in Excel:

  1. Select the row you want to delete. To select multiple rows, hold Ctrl while clicking each one.

  2. Right-click and choose Delete.

  3. In the pop-up window, select Shift cells up.

Delete blank rows in Excel.

Methods to Delete Blank Rows in Excel

Here’s a step-by-step breakdown of different methods you can use to delete blank rows with clear examples to guide you quickly.

Method 1: Delete only completely blank rows using COUNTA()

The COUNTA() function counts the number of non-empty cells in a range. We can use it to spot completely blank rows. This is quite helpful when we want to avoid removing rows with partial data.

Here’s how you can use this to delete a row:

  1. Create a helper column next to the dataset. In the first cell, enter =COUNTA(A2:C2)=0

  2. Drag the formula down to copy it. This will display True if the entire row is blank and False if it contains any non-blank values. 

  3. Now click on the True cells, go to the Home tab, and click Delete Sheet Rows to delete the whole row at once.

Deleting entire blank rows using the COUNTA() function in Excel.

Method 2: Use FILTER() for formula-based data cleanup

The FILTER() function doesn’t delete rows. It returns a new, blank-free version of your data in a separate range. You can use it to preserve your original data while working with a cleaned-up view. But note that FILTER() is only available in Excel 365 and Excel 2021.

Here I have a dataset with blank rows, and to clean the blank rows, I use the following formula (adjust ranges according to your data):

=FILTER(A2:A10, NOT(ISBLANK(A2:A10)))

In this formula:

  • FILTER() returns data from a range that meets a condition.

  • A2:A10 is the range being filtered.

  • ISBLANK(A2:A10) checks for blank cells.

  • NOT(...) reverses the result, so only non-blank cells from Column A are returned and skip any blanks.

This method only works with one column at a time. So if you’re working with multiple columns, you’ll need to adjust the formula by selecting the new column and dragging it horizontally.

Deleting the blank rows with FILTER() formula in Excel.

Method 3: Use sort to push blank rows to the bottom

Sorting in Excel reorders data based on the values in one or more columns. For example, sorting a name column from A to Z rearranges the entire table so names are in alphabetical order while keeping each row's data intact.

When you sort a column, Excel moves all blank rows to the bottom of the sheet. That makes it easy to scroll down and delete them in one go.

Here’s how to do it:

  1. Select your data.
  2. Go to the Data tab and click Sort.
  3. In the Sort dialog box, choose any column (except one with just numbers), leave the settings as-is, and click OK.
  4. Excel will sort your data in ascending order, pushing blank rows to the bottom.
  5. Select those empty rows, right-click, and Delete them.

To preserve your original order, add an index column before sorting. After deleting the blanks, sort again using the index to restore the original layout, then remove the index column.

Method 4: Use VBA to remove blank rows automatically

VBA (Visual Basic for Applications) automates many Excel tasks, including removing multiple blank rows simultaneously. Here’s a simple way to do it:

  • Press Alt + F11 to open the Visual Basic Editor.

  • Click Insert > Module to create a new module.

  • Paste the following code into the module:

Sub DeleteBlankRows()
    Dim rng As Range
    Dim row As Range

    On Error Resume Next
    Set rng = ActiveSheet.UsedRange

    For Each row In rng.Rows
        If Application.WorksheetFunction.CountA(row) = 0 Then
            row.Delete
        End If
    Next row
End Sub

Deleting entire blank rows using VBA editor in Excel.

Close the editor and press Alt + F8 to run the macro called DeleteBlankRows. This will delete only rows that contain all empty cells and won’t affect rows that have only a few blank cells. 

Running the macro to remove the blank rows in Excel.

Comparing the Different Methods

Here's a quick table to help you see how all the methods we talked about stack up against each other. 

Method Best for Pros Cons
COUNTA() Delete completely empty rows Very accurate and protects partially filled rows Takes a few extra steps
FILTER() Gives a clean list without deleting original data Updates automatically Handles one column at a time unless modified. 
Sort and delete Bulk delete blank rows when order doesn't matter Super quick for long sheets Changes the original row order, and we have to create the index as a helper column
VBA macro Instantly delete completely blank rows in large files Extremely fast and handles huge datasets automatically Requires using the VBA editor, so it is not beginner-friendly

Final Thoughts

Before you start deleting, remember that some blank rows might be intentional, like when they’re used to separate sections and make your data easier to read. In those cases, it may be better to hide the rows or use conditional formatting instead. Always choose the method that best fits your data and goals.

If you want to improve your overall Excel skills, check out courses like Data Analysis in Excel or Data Visualization in Excel. They’re great for building skills you’ll actually use. 

Advance Your Career with Excel

Gain the skills to maximize Excel—no experience required.

Start Today for Free

Laiba Siddiqui's photo
Author
Laiba Siddiqui
LinkedIn
Twitter

I'm a content strategist who loves simplifying complex topics. I’ve helped companies like Splunk, Hackernoon, and Tiiny Host create engaging and informative content for their audiences.

Excel FAQs

Can I use Conditional Formatting to highlight blank rows in Excel?

Yes, you can use Conditional Formatting to identify only the entirely blank rows. Here's how:

  • Select the range of rows you want to check.
  • Go to Home > Conditional Formatting > New Rule.
  • Choose Use a formula to determine which cells to format.
  • Enter this formula (adjust the range to match your table): =COUNTA($A2:$C2)=0
  • Set a format (like a fill color) and click OK.

Now, only the completely blank rows will be highlighted.

How to use the COUNTBLANK() function to identify and delete the blank rows in Excel?

COUNTBLANK() only removes completely blank rows. Here’s how you can use this:

  • Add a helper column and in the first cell enter =COUNTBLANK(A2:D2)

  • Copy the formula down.

  • Now apply Filter to the helper column and filter to show only rows where the count equals the total number of columns (e.g., 4).

  • Select and delete the filtered rows. 

  • Delete the helper column if you no longer need it.

Is there a difference between blank rows and rows with invisible characters?

Yes, rows with invisible characters, such as spaces or non-printable characters, aren’t truly blank and may need extra cleaning.

Can I use Power Query to remove empty rows in Excel?

Yes. To do so:

  • Load your range into Power Query (Data > From Table/Range).
  • In the Power Query Editor window, go to Home > Remove Rows > Remove Blank Rows.
  • Click Close & Load.

This will remove empty rows, and other empty cells will remain the same.

Tip: If you don't want to change the original formatting, then avoid this method.

Topics

Learn Excel with DataCamp

Track

Excel Fundamentals

0 min
Gain the essential skills you need to use Excel, from preparing data to writing formulas and creating visualizations. No prior experience is required.
See DetailsRight Arrow
Start Course
See MoreRight Arrow
Related

Tutorial

How to Insert Multiple Rows in Excel: 4 Different Ways

Learn to insert multiple rows in Excel using menus, shortcut keys, the copy-paste method, or the name box.
Laiba Siddiqui's photo

Laiba Siddiqui

3 min

Tutorial

How to Clean Data in Excel: A Beginner's Guide

Learn essential data cleaning techniques in Excel, including removing duplicates, handling missing values, and maintaining consistent formatting.
Laiba Siddiqui's photo

Laiba Siddiqui

15 min

Tutorial

How to Remove Duplicates in Excel: 5 Best Methods

Learn how to use Excel’s built-in features, formulas, and even Power Query to tackle duplicates, along with best practices and troubleshooting tips for handling complex datasets.
Laiba Siddiqui's photo

Laiba Siddiqui

6 min

Tutorial

How to Alphabetize in Excel: Sorting Columns, Rows, and More

Master alphabetizing in Excel with built-in tools and formulas. Learn to sort columns, rows, and entire datasets.
Allan Ouko's photo

Allan Ouko

5 min

Tutorial

How to Remove Spaces in Excel: 5 Good Methods

Remove unnecessary spaces, including leading, trailing, and extra spaces, to keep your data clear. This guide covers TRIM(), SUBSTITUTE(), and CLEAN() functions, plus practical tips to ensure spreadsheets remain accurate and easy to work with.
Laiba Siddiqui's photo

Laiba Siddiqui

6 min

Tutorial

VBA Excel: How to Get Started and Make Your Work Easier

Learn how to effectively use VBA in Excel to automate tasks, create macros, and enhance your data processing skills with practical examples and best practices.
Laiba Siddiqui's photo

Laiba Siddiqui

10 min

See MoreSee More