Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Ensuring Rows and Columns are Empty.

Ensuring Rows and Columns are Empty

by Allen Wyatt
(last updated June 4, 2016)

5

It is a well-known fact that if you delete a row or column, Excel dutifully does your bidding, removing whatever was in that row or column. This means that it is easy to delete rows or columns you think are blank, which in fact contain information you cannot see on the screen.

So how do you tell if there is any data without scrolling through the gazillion rows and columns in your worksheet? There is a quick way you can check for data in a row or column. To check a column, follow these steps:

  1. Click on the first cell of the column (A1, H1, etc.).
  2. Press the End key once. The phrase "End Mode" should appear near the left side of the status bar.
  3. Press the down arrow if checking out a column or the right arrow if checking out a row.

If you prefer, you can accomplish this same task using only two steps:

  1. Click on the first cell of the column (A1, H1, etc.)
  2. Hold down the Ctrl key as you press the down arrow or right arrow.

Performing these simple steps causes Excel to move to the next cell containing data. If there is no data, Excel selects the last cell in the column (at row 1,048,576) or the last cell in the row (at column XFD). You then know that the row or column is empty and you can safely delete it.

There is a "gotcha" to be aware of if you use have hidden rows or columns in your worksheet: The first approach (pressing the End key first) will detect and stop at hidden rows or columns, but the second approach (holding down the Ctrl key) will not. Thus, if you have hidden data in your worksheet, you'll want to use the first approach instead of the second.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12079) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Ensuring Rows and Columns are Empty.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Removing Shading from Many Paragraphs

Need to format a bunch of paragraphs within your document? Word provides some very easy ways to apply the same formatting ...

Discover More

How Operators are Evaluated

Operators are used in formulas to instruct Excel what to do to arrive at a result. Not all operators are evaluated in the ...

Discover More

Word's Native Measurement Unit

Word allows you to specify distances using a number of different measurement units. Figuring out how those measurement units ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Concatenating Ranges of Cells

Putting the contents of two cells together is easy. Putting together the contents of lots of cells is more involved, as ...

Discover More

Entering Dates in Excel

When you type information into a cell, Excel tries to figure out what type of information you are entering. If Excel can ...

Discover More

Getting Rid of 8-Bit ASCII Characters

When working with data created outside of Excel, you may need to check that data to make sure it contains no unwanted ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 + 8?

2017-06-19 16:02:41

Dennis Costello

An interesting tip - and it's interesting how these "simpler" issues seem to generate the most discussion. Ciaran and Carla are both looking, I think, at what from the VBA perspective would be called the worksheet's Used Range - "active" has a different connotation. And I think Allen is, too. I think it's impossible to have data in a cell on a worksheet that is outside the Used Range, but then again I haven't tried to come up with warped use cases to test that assumption.

But ... it's pretty easy to have large parts of the Used Range not contain any data. Not sure how that happens - it would be pretty easy to, for instance, put data into a cell way off to the right (e.g., XA5), then just clear that cell. The Used Range would still extend out to column XA even if there was no data beyond, say, column F. Hiding column (even empty ones) puts the hidden columns inside the Used Range, and they stay there even if you undo the Hide Columns operation. Applying a format to an entire row does not change the Used Range to column XWD, nor does applying a format to an entire column change it to row 1048576. Applying a format to a single cell does change the Used Range to include that cell; undoing that operation resets the Used Range to what it was before. I'll bet that setting a print area, or a defined name, or a pivot table source, all would include the referenced cells in the Used Range, but I haven't played with all that. So the Ctrl-End, Ctrl-Enter, and similar tricks are all useful but might lead you to think a column or row is occupied when in truth it has no data. By the way, I think the only way to make the Used Range smaller is to in fact delete entire rows and/or columns (and isn't that how we got to this tip in the first place?).

On the other hand, Vishal's simple technique has a different flaw. If you click on a row or column header, the Count value in the right end of the Status Bar will indeed show the number of occupied cells - but only if it's greater than 1. Oops. The only way to tell if a row has a single occupied cell (and remember it might be occupied with a single space character, or a formula that resolves to blank or spaces) is to find a row, or column, that you know has multiple occupied cells, note the count, and then slide right or left or up or down to include more columns or rows, and see if the count gets bigger. I end up doing that a lot...


2016-08-16 00:30:15

Vishal Katti

Another easier and quicker way to do this is to click the row header (which will select the entire row) or column header (which will select the entire column) and view the "Count" value in the status bar. A non-zero count means there is data in that row or column.


2016-06-08 08:10:10

Carla

Yes, Place your curser in any column in row A that you want to check. Hold the CTRL button down on your keyboard and click the end button. That will take you to the farthest right and farthest bottom active cell.


2016-06-07 16:20:07

Ciaran

Fair enough, the tip is intended to test if the column is empty: finding data in a cell confirms it isn't. Carla is right in that you don't know what else is below. You can repeat the test to move to the next occupied cell, but that is tedious in the long run.

I know that, as well as the two methods in the tip, you can hit the END key and then ENTER, which will bring you to the actual last cell in the current row. Does anyone know how to do the same for the current column?


2016-06-07 11:28:37

Carla Wood

This technique only takes the curser to the first blank cell and does not account for cells beyond that cell. in other words if you have info in a row from a1 - z1 but no info in cell d1 the curser stops as d1. You may still have additional information in e1 and beyond but the curser does not go to that cell.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.