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:
If you prefer, you can accomplish this same task using only two steps:
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.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
When you are working on a worksheet (particularly a large one), you may want to search for and possibly copy information ...
Discover MoreWhen importing Excel information into Access, you need to be concerned with the condition of the data. Here's how to make ...
Discover MorePaste information into a worksheet, and you may be surprised to see leading zeroes disappear before your eyes. Here's how ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2021-08-03 04:46:29
Caroline Coussement
You could press End - Home to get to the last used cell of the worksheet (which is not necessary the last non-empty cell), then press End - arrow up to find the last cell in the column that's not empty and End - left arrow to go to the last cell in the row that's not empty. It's a way to find empty rows and columns that can be deleted in order to reduce the file size.
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
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.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2022 Sharon Parq Associates, Inc.
Comments