Simple Sorting
- 05:30
Understand how to perform a simple sort
Glossary
Data Ribbon Sort Ascending Sort DescendingTranscript
So when we're sorting, there's a few things to bear in mind. The first thing is the way we arrange our data. So if we look at the data we've got in front of us here, we've got a transaction number, a name, a date of the sale, the product that was sold, the number of units, the sale amount, and the location it was sold in.
You'll notice that we don't have any breaks in the data, so we've got continuous rows and continuous columns. And this is important before we start our sorting. If we don't have that kind of data, then it's probably worth spending some time just tidying it up and making sure that we are in this situation, because it makes our lives much easier when we're doing any kind of sorting, filtering, or data manipulation of any kind. So we don't need to select the table if we're gonna sort. To do a simple sort, all we need to do is get the cursor somewhere in the column that we'd like to sort. Now, there are a number of ways to do sorting from the ribbon within Excel, one of which is to go via the home ribbon. So if we look at the home ribbon, across to the right hand side here, you'll see there are a couple of sort icons. So we can go this way.
You'll also notice that it's on the data ribbon as well. So if we go to data, we also have some sort icons. So which way is best? Well, I usually find that going via the data ribbon is an easier shortcut to remember. So to do that, all we need to do then is go Alt to access the ribbon, A for data, and then the shortcut to remember is SA, which is sort ascending, or SD, which is sort descending.
So let's just do that one again. It's Alt, and then A, and then I'm gonna do SA for sort ascending. And you can see my cursor is in the name column and now we've got our names all sorted. Okay, so that's a straightforward simple sort. Let's see how that works with numeric data. So obviously, as you might imagine, ascending order will be from lowest to highest, descending order would be from highest down to lowest. If we think about dates, it's very similar. So ascending order will be from oldest to newest and descending order will be from newest to oldest. So that's how we sort either textual items, dates, or numeric items. How about we wanna sort more than one column of data? Well, in that case, we can either do the sorts in reverse order and just by using those same keys we've just used, so Alt + SA or Alt + SD, we just go move to the column that we want to do to the last and then move our way progressively back to the first order sort we want to do, or we can do it all in one dialogue box through the sort dialogue. To access that, it's Alt + A and then SS. And that will bring up this dialogue box, which allows us to go and add in all the levels that we want to. So you'll see we've already got a sort primarily on name, sort on values, and the order we want is A to Z. Let's go and add another level. So all we need to do is add a level at the top here. And we are gonna say, well, actually what we want to do is we're gonna sort by product on its value and we're gonna sort in A to Z. Now what I'm gonna do is I'd like to actually sort by product as a primary sort and then secondarily by name. So you can use these arrows at the top here to move what is currently the secondary sort up to the primary sort. So I'm gonna do that one. So we are saying here, what we'd like to do is sort by product first and then as a sort of secondary sort, we'll sort by name. Once we've got all these things in order here, we can just click okay. Before I do, just worth noticing that it may not be obvious, but Excel's done something which it does automatically here which is assume that your data has headers. So it hasn't included in its sort the titles at the top of our data, so transaction number, name, date, product, those aren't included in our sort, because we've got this little tick box here that says, "My data has headers". If for any reason your data doesn't have headers and Excel is starting to think that it does for some reason, you can always come into the sort box here and turn that feature off. Okay, so back to the sort. Product first, secondary on name. So I'm gonna click okay here now. And then we should see that we have our product and we have eye liner. And as I scroll down our list here until we come to the end of Betsy's eye liner sales, although we are still within eye liner, we've now moved on to the next person. And likewise, we'll stay within the eye liner category and then we'll move on to the next person. So now we're on to Colleen and so on. And we'll move through alphabetically through our search.
Okay, so that's a simple sort and we've covered on how to do simple sorting.