Using Sort to eliminate empty rows and columns
Video: Using Sort to eliminate empty rows and columnsSometimes in order to clean up your data, you may need to add temporary columns and use various sorting techniques to give you the tools for eliminating empty rows or unnecessary rows in a list. In this particular worksheet called ExtraRows, recognize that when there is a department change here, a row has been added to indicate the department name over here in Column A. And these are going to get in the way when we do sorting and filtering and trying to do pivot tables on a worksheet like this. And similarly, the next sheet over called EmptyRows has a similar layout, except here there are empty rows. And perhaps that's going to look nice on a sheet of paper when it's printed--it nicely delineates the departments-- but in order to use Excel efficiently, when it comes to database tools like sorting and filtering, we need to get rid of rows like this.
- Next steps
Viewers: in countries Watching now:
In this course, Dennis Taylor explores the functions, commands, and techniques in Excel that restructure data, remove unwanted characters, convert date data into the desired format, and prepare data for efficient analysis. This course helps get data from a business management system file, other database software, a text file, or a poorly designed Excel worksheet into optimal shape for working with in Excel.
- Moving or inserting rows and columns of data with a simple drag
- Using Text to Columns
- Harnessing the Find and Replace command to replace data at the character level
- Dealing with special characters and wildcards during search
- Converting dates with text functions
- Converting text data to values/numbers
- Checking and correcting spelling mistakes
- Splitting data into multiple columns via the Text to Columns feature
- Combining data from different columns via concatenation
Using Sort to eliminate empty rows and columns
Sometimes in order to clean up your data, you may need to add temporary columns and use various sorting techniques to give you the tools for eliminating empty rows or unnecessary rows in a list. In this particular worksheet called ExtraRows, recognize that when there is a department change here, a row has been added to indicate the department name over here in Column A. And these are going to get in the way when we do sorting and filtering and trying to do pivot tables on a worksheet like this. And similarly, the next sheet over called EmptyRows has a similar layout, except here there are empty rows. And perhaps that's going to look nice on a sheet of paper when it's printed--it nicely delineates the departments-- but in order to use Excel efficiently, when it comes to database tools like sorting and filtering, we need to get rid of rows like this.
So let's tackle both cases. Back to the sheet that has the extra rows. If we could somehow sort the data to pull these all together, then we can easily delete them without having to painstakingly go through and delete these one by one. So let's insert a new column to the left of Column A. Right-click Column A and insert. And starting on A2, let's put in the number 1, and then right below it, the number 2. The data in Column B is contiguous all the way to the bottom. So we can simply select Cells A2 and A3, double-click the lower right-hand corner, and if we now press Ctrl+Period-- this will take us down to the bottom-- we can see that we've copied in a sequence number for every one of these rows.
Let's go back to the top. Give it a temporary heading. It doesn't really have to be anything really, but just to make sure that we've got some kind of a heading up there, we'll call it sequence. Remember, we are going to be getting rid of that column. Let's sort the data now in such a way that these kinds of rows, like this one and this one, end up at the top or the bottom. So all we really need to do is to click, for example, in one of our columns that's got an empty cell in it, like this. Now we wouldn't do this in Column I, because there, there are some empty cells that have a reason for being empty.
Some people don't have benefits. But in Column C, let's say we've got our data all filled in. No empty cells here, except in these kinds of rows, like these two. So we can just click somewhere in Column C and then on the Data tab use the AZ button to sort our data based on the data in Column C. There we are. And at the bottom of this list, we hope we'll have all of those Column C entries that were empty. This should be at the bottom. And we don't need them.
We want to get rid of them. So let's select the rows over here and simply right-click and delete those rows. And now we want to go back to the original sequence here. It looks like it might be there anyway, but just in case, we do have our data still available in Column A, we can click AZ just to make sure, jump to the top here. It looks like things are looking pretty good. We don't need that sequence column anymore. Simply right-click and Delete. And similarly, in the EmptyRows worksheet, same general idea.
Slightly different here because as we create our formula, we are going to have special needs for copying it down the column. So we need to insert a new column here, and as in the previous example, put in a 1 and 2, but we really can't double- click here because it will just stop right there at Row 6. So what we'll need to do here, starting here or from the top, just drag this to the bottom--and hopefully you don't have thousands and thousands of rows. So that's taking a little bit of time to do this, a little bit longer perhaps. But other than this, the same general idea that we saw in the previous example.
We've got our data there. Pressing Ctrl+Period to go back up top there. There we are. Let's put a temporary name up there again. And simply sort on one of our columns, any column, Column B, for example. Let's try ZA, just to show what would happened. It still puts the empty rows at the bottom, and there they are down there. And so, we don't really need any of these data down here. We don't really have to delete the entire row; just delete the sequence numbers. Even there, possibly you don't even need to do that. But as we click here in Column A and do another AZ Sort, press Ctrl+Home.
Our data is together. We don't have any empty rows. Let's get rid of Column A, and we've cleaned up our data. So sorting techniques do help us at different times for getting rid of those rows that have unusual characteristics that we don't need. And whether it's empty rows, as we saw in this example, or in the previous example on the other worksheet where we had data in those rows, sorting allows us to pull those rows together so we can easily eliminate them.
Find answers to the most frequently asked questions about Cleaning Up Your Excel 2010 Data .
Here are the FAQs that matched your search "" :
- Q: Where can I learn more about Excel formulas?
- A: Discover more on this topic by visiting Excel formulas on lynda.com.
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.