How to remove blank or empty rows in Excel?

If there are hundreds of blank rows scattering through the whole worksheets, you will be frustrated about it. This tutorial is giving instructions on how to remove all the blank rows step by step.

Remove all the blank rows with Go To Special command

Remove all the blank rows with VBA code

Remove all the blank rows with only one click


arrow blue right bubble Remove all the blank rows with Go To Special command


1. Select the range containing blank rows you want to remove.

2. Click Home > Find & Select > Go To Special.

doc-delete-blank-rows1

3. In the Go To Special dialog box, check the Blanks option.

doc-delete-blank-rows2

4. And then click OK, all of the entire blank rows are highlighted. Then click Home > Delete > Delete Sheet Rows, the blank rows have been deleted from the selected range. See screenshots:

doc-delete-blank-rows3
-1
doc-delete-blank-rows4


arrow blue right bubble Remove all the blank rows with VBA code

The following VBA code also can help you to delete the blank rows of the selected range. Please do as this:

1. Select the range that you want to remove the blank rows.

2. Click Developer > Visual Basic, a new Microsoft Visual Basic for applications window will be displayed, click Insert > Module, and input the following code into the Module:

VBA: Remove blank rows of the selected range.

Sub DeleteBlankRows()
'Update 20131107
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xRows = WorkRng.Rows.Count
Application.ScreenUpdating = False
For i = xRows To 1 Step -1
    If Application.WorksheetFunction.CountA(WorkRng.Rows(i)) = 0 Then
        WorkRng.Rows(i).EntireRow.Delete XlDeleteShiftDirection.xlShiftUp
    End If
Next
Application.ScreenUpdating = True
End Sub

3. Then click doc-merge-multiple-workbooks-button button to run the code. And the entire blank rows in the selection will be removed.


arrow blue right bubble Remove all the blank rows with only one click

You can use the third party add-in Kutools for Excel to quickly merge multiple columns. What is Kutools for Excel?

Kutools for Excel: with more than 120 handy Excel add-ins, free to try with no limitation in 30days. Get it Now.

1. Click Kutools > Delete > Delete Blank Rows, see screenshot:

doc remove blank rows 01

2. Then you can choose the scope to delete the blank rows. You can delete the blank rows in the selected range, in active sheet, in selected sheets and in all sheets of Excel. For more detail information about this utility, please visit here.

Tip: If there is a row which looks like a blank row but it contains invisible characters in its cells, this utility cannot delete such blank rows.


Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 200 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more      btn download     btn purchase

Comments  

Permalink +6 ejohns74
When I do this, the text gets deleted. Help please.
2014-01-14 15:20 Reply Reply with quote Quote
Permalink +5 W. Halyn
Don't know if you've solved the issue about additional text getting deleted, but I've posted a solution to what might be your problem.
It's listed below your question.
2014-03-11 12:20 Reply Reply with quote Quote
Permalink +35 W. Halyn
"Blank rows deletion" is awkward by most methods. I had a set of three columns of data. The first column had title lines every five or six rows. The remaining two columns had random data at various rows all the way down. Sometimes a row in column two was blank, but the cell beside it in column three had data. Or vice versa.
Only SOME of the rows (1,242 in this case) were blank all the way across.
The PROBLEM was that selecting BLANK cells would DELETE ENTIRE ROWS that had data in other columns.
I found a perfect solution.

I created a fourth column in which I used the COUNTA function.
The formula went =COUNTA(A1:C1) and then copied it down thru several thousand rows of data.
So, my D column had a stack of 3s,2s,1s & 0s.
Then I used the FILTER command on Column D to only show the rows that equalled 0. The result was a sheet of empty cells with 0s in column D... ONLY the totally blank rows had been selected!
Then I clicked and dragged down the left-side ROW NUMBERS (those in the margin) to select those rows, right-clicked and selected DELETE. They all vanished.
When I turned OFF the filter, I had a perfect set of cleaned data.
In less than a minute! Done!
= = = = = = =
That was so easy, I then got fancy and changed the COUNTA function to only select items from the A column that had data in them. (Those rows happened to be "Title" rows for clumps of data below them.) It read =COUNTA(A1) and copied IT down the D column to the end. The result was a column of 1s and 0s.
When I turned FILTER on again and selected for "1", only the Title rows appeared. I selected those rows and BOLDed them. Then turned the Filter off, and again, perfect formatting down thru thousands of lines.
LOVE THAT FILTER FUNCTION!
2014-02-10 16:11 Reply Reply with quote Quote
Permalink +4 Tony_L
This is a great solution, thanks!
2014-04-09 16:28 Reply Reply with quote Quote
Permalink +2 Ashik
Great, Thank you very much
2014-07-02 09:19 Reply Reply with quote Quote
Permalink 0 Alan
This is genius - thank you!
2014-10-23 17:29 Reply Reply with quote Quote
Permalink 0 Uttam
Perfect solution, it just worked out seamlessly.
Thanks :-)
2014-11-26 07:28 Reply Reply with quote Quote
Permalink 0 DatabaseMN
Excellent - perfect simple solution.
2015-01-29 04:22 Reply Reply with quote Quote
Permalink 0 keyur
great help this filter function is best solution if we think and use it
2016-04-21 06:05 Reply Reply with quote Quote
Permalink 0 RAj
Great some time Users provide more practical solution than developers and experts
2016-10-18 07:25 Reply Reply with quote Quote
Permalink +4 zahra
Thank you very much for the advice. It was great.
2014-02-17 08:01 Reply Reply with quote Quote
Permalink +7 Ned
This is awesome.

Thank you very very very much

Ned
2014-02-26 04:51 Reply Reply with quote Quote
Permalink +3 Daysha
You've just saved my life. :-)
2014-03-10 21:57 Reply Reply with quote Quote
Permalink +2 Wasamut
The visual basic route was new to me and did the trick. Many thanks!
2014-03-10 23:57 Reply Reply with quote Quote
Permalink +6 Jay
This is Cool!!! @ # W. Halyn. Thank You.
2014-03-14 20:14 Reply Reply with quote Quote
Permalink 0 Darko Loncar
I can't delete. I am using Excel 2010 and I want to delete blank rows from A147533 to (after ctrl - End) T448140.

What ever i did all rows stay undeleted in my spreadsheet. After ctrl-End I am again at T448140.
2014-03-17 09:04 Reply Reply with quote Quote
Permalink -1 W. Halyn
Darko.
Your first step in the extra column (which should be "U" column for the filtering), the formula in U147533 should read (judging from your supplied data) =COUNTA(A147533 :T147533) and then COPY that down to row 448140. You should get a column of numbers, SOME of which will be zeroes.
Then click on the "U" letter at the top of the column (in the ruler margin) to highlight the entire column.
Then select the Filter function (Data tab, Filter), click on the little pull-down triangle, and delete all the checkmark choices except the one beside the "0" choice (OR the "Blanks" choice, if visible). Click on OK.
You should then see only rows that have zero data in them.

Then as described previously, with the Filter function still active, highlight the rows from 147533 to 448140 that are containing those selected row numbers (by clicking/draggi ng down the left ruler margin OR clicking top one and shift-clicking last one), and DELETE them. (Right-click, Delete).
When they vanish, turn the Filter function off and all other data will reappear.
Good luck!
2014-04-11 13:40 Reply Reply with quote Quote
Permalink -1 Darko Loncar
It doesnt work for me. Now I am using EXCEL 2013 and have this situation : my data are in range A1 to AF52222. When I click
Ctrl-End I come to cell AG56367. So I have all blank rows from 52223 to 56367.
After COUNTA(a2;af2) copied to row 56367 and highlighting rows 52223 to 56376 on Right-click EXCEL offers DELETE ROW and I deleted this rows.
After that I turn off Filter: with Ctrl-Home I come to cell A1, with Crtl-End I come to cell AG56367. So all was the same
2014-04-18 08:18 Reply Reply with quote Quote
Permalink -1 mzmolek1
I tried this but when I used Kutools function: delete tools > In Selected Range I get message: "Successfully deleted 0 rows" and nothing changes.
2014-03-28 08:43 Reply Reply with quote Quote
Permalink -1 W. Halyn
Instead of using Kutools, try the method I described above. It uses plain old Excel, using the features available in all recent versions.
(That's if you're trying to delete ONLY all-blank rows, not partially-blank ones.)
2014-03-31 14:01 Reply Reply with quote Quote
Permalink -1 outofmyleague
can you just do all of this with a macro to be executed at the bottom of a sheet once all the data is collected and analyzed? I am doing an "IF/THEN" analysis for some folks and sin=ce that works automatically the above solution, while elegant, may be beyond their capacity(maybe mine too ...) So, once the data is completed I was looking to point then to a cell and click "go" and the blank rows would be eliminated ..... any ideas?
2014-04-11 04:33 Reply Reply with quote Quote
Permalink -1 W. Halyn
It would take about ten times longer to write such a macro (which would have to auto-calc total columns, total vertical fill in ALL columns, then calc which column to do the counts in, then execute the operation, etc.) than to just do the steps.
Really, the whole operation takes less than two minutes if you read over the instructions step by step. Maybe try displaying steps side-by-side with the work you're doing (or print the steps out, then follow along). Once you see it work the first time, you'll feel a lot more comfortable with it, and you'll definitely be wiser in the operation of the Filter function.
Re the folks you're doing the work for, just bring them the results; they probably don't care "how", they just wanna know "what". A quickly-cleaned -up database will look more impressive than watching how it got that way, especially if you're just learning how. Give it a practice run or two. Oh, and make a backup copy, of course, just in case Undo fails or something while trying it out.
(Mind you, at your first query, I envisioned a macro that would have to work in all environments. What YOU would find is that once you've got a fixed-structure data set going, you'll know exactly how the procedure works and could just record steps into a macro of your own, just for the speed factor.)
2014-04-11 13:13 Reply Reply with quote Quote
Permalink -1 outofmyleague
Can you turn all of this into a macro that could be executed at the bottom of a spreadsheet when the data is fished being collected?
2014-04-11 04:28 Reply Reply with quote Quote
Permalink -2 Dana FitzGerald
Nice tutorial
--helped me greatly! Thanks!
2014-04-16 00:40 Reply Reply with quote Quote
Permalink -2 guru
Deleting the blank rows using the special command "Blank" doesnt work correctly in case i have multiple rows and multiple columns with some blank columns in between.The operation is deleting the rows with data and providuing the unexpected result.
Example : Columns : A to F having 5 rows of data as follows . When we do the blank operation we get unexpected reults (result doesn't show 5 rows..!!)

A B C D E F
Check1 Check2 Check3 Check4 Check6 Check7

Check1 Check2 Check3 Check4 Check7



Check1 Check2 Check3 Check4 Check7


Check1 Check2 Check3 Check4 Check6 Check7

Check1 Check2 Check3 Check4 Check6 Check7


any idea , why?
2014-04-30 07:04 Reply Reply with quote Quote
Permalink -2 KennKelley
W. Halyn: your solution worked perfectly for me. Using Excel 2007 and 2013.
2014-06-16 15:16 Reply Reply with quote Quote
Permalink -2 khachedu lal
great suggestion...............
thanks :lol:
2014-06-18 10:41 Reply Reply with quote Quote
Permalink -2 nanda
Its awsome it was very help full for me thanks a lot.
2014-07-07 21:23 Reply Reply with quote Quote
Permalink -2 Karthik
Hi,

If i follow above the procedure, getting error message as 'Selection is too large'. Then how to remove empty cells for large list.
2014-07-17 11:03 Reply Reply with quote Quote
Permalink -2 W. Halyn
Quoting Karthik:
Hi,
If i follow above the procedure, getting error message as 'Selection is too large'. Then how to remove empty cells for large list.


The first thing I would try is selecting half the database, or a quarter. If that works, repeat on remaining sections. If it does not, see if your computer has enough RAM available for processing such a large chunk of data. Without actually seeing the file, it's hard to say.
2014-07-19 13:54 Reply Reply with quote Quote
Permalink -2 Ahmad H.
Great tips, so helpful
2014-07-31 18:48 Reply Reply with quote Quote
Permalink -1 raj
thank you it helped me
2014-08-13 04:37 Reply Reply with quote Quote
Permalink 0 Gajeswari
Thank you So much very useful
2014-08-18 06:43 Reply Reply with quote Quote
Permalink -1 ashwani
very easy way if you want to delete blank rows. go to first column insert a new column and fill the series, then go to filter option and now in next column select blank. its the very easy way to remove or delete blank rows
2014-08-21 08:38 Reply Reply with quote Quote
Permalink +1 Darko Loncar
It doesnt work for me. I am using EXCEL 2013 and have this situation : my data are in range A1 to P2373. When I click
Ctrl-End I come to cell AW7335. So I have all blank rows from 2374 to 7335.

So, what for is Ctrl-End?
I can upload my file so anybody can delete blank rows for me.
2014-08-22 06:55 Reply Reply with quote Quote
Permalink 0 Ashwani Bahuguna
ok.

i can try

Quoting Darko Loncar:
It doesnt work for me. I am using EXCEL 2013 and have this situation : my data are in range A1 to P2373. When I click
Ctrl-End I come to cell AW7335. So I have all blank rows from 2374 to 7335.

So, what for is Ctrl-End?
I can upload my file so anybody can delete blank rows for me.

Ashwani
2014-09-11 11:02 Reply Reply with quote Quote
Permalink +1 Ashwani Bahuguna
OK .
2014-09-11 11:04 Reply Reply with quote Quote
Permalink +1 sadiq
it very nice is use full for me
2014-09-11 09:54 Reply Reply with quote Quote
Permalink 0 CJ Sandham
I have a spreadsheet which list 200 different problems in row 2, in row 1 there is an index, 1.1, 1.2, 1.3, 1.4, 2.1, 2.2 etc etc.
I then have in row 3 4 and 5 the choice of, no action, low action and high action.
I review the problems and enter an "x" in the appropriate column.
I want to make a condensed list of only the items with an "x" in the high action column but I also need to keep the complete spreadsheet so can just filter.

is there a reference/index /lookup type function I can use?
2015-02-12 11:08 Reply Reply with quote Quote
Permalink 0 Adel
THANK YOU!! That was really helpful
2015-03-06 11:39 Reply Reply with quote Quote
Permalink 0 Kanchan Mudgal
This really helped me in my testing activity. Thank you very much
2015-05-22 07:32 Reply Reply with quote Quote
Permalink 0 Lily Podjan
Thank You very much !!!

It's really great help me :D
2015-06-08 02:16 Reply Reply with quote Quote
Permalink 0 s
thanks a lot, it saved lot of time
2015-07-01 09:03 Reply Reply with quote Quote
Permalink 0 sohail
oh bro thankyou very very much .....
2015-11-04 07:23 Reply Reply with quote Quote
Permalink 0 nigel
only usefull if you want to delete ANY row with ONE blank cell, not delete rows with ALL cells being blank.
Isn't this titled "How to remove blank or empty rows in Excel?" not "How to remove rows with blank cells?"
2016-04-13 11:12 Reply Reply with quote Quote
Permalink 0 Sanjay Rajput
This is simple VBA code to delete the entire rows based on particular column:-

Sub DeleletBlankrows()
Range("A1:A10000").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
2016-12-13 15:49 Reply Reply with quote Quote

Add comment


Security code
Refresh