Hello, and welcome to a video on subsetting in Excel. Subsetting data is when we take our
data frame and make a smaller, more manageable version of it by eliminating information
that we don't want to have from it. So for example,
this could work by sorting your data from largest
to smallest and getting rid of everything that doesn't meet a cutoff point, or you may only want zeros or
ones from your data frame. There are a lot of different ways that you might sort your data.
First, you want to make sure you have a copy of your data frame. You never want to work with the original data frame
when you're subsetting in Excel, because you may lose your data by doing that,
and you may not be able to get it back. So here, I've made a copy several
copies of my data frame to work with, so we're gonna go to sheet two, and I'm going
to select the entire data frame.
There we go. Now, I'll go to sort and filter,
sort smallest to largest, or you can do custom sort,
let's custom sort, because I'm interested in RDV in this instance, and I would like to
have only the instance of RDV that are over a thousand. So let's sort RDV,
smallest to largest. Actually, let's do largest to smallest and click OK.
Now, you can see all of my data has been sorted for me, and I can simply
delete anything that is not over a thousand, and because I'm not working with my original data frame,
it's safe for me to do this. So you can see I've selected at the cutoff point
of a thousand right here, and there we have it. Now I have just our
values over a thousand. There is another way to do this. Let's take a look
at my third sheet here. Let's once again select the entire data frame.
And now we'll go to format as table. You can select any one of these options. They're just for aesthetics.
I have selected the labels in this table, meaning the IV1, IV2, DB, et cetera. So I'm going to click
the my table has headers button, and then click OK.
Now we can see that we have these little arrows next to our
variable names. So I'll click one of these arrows, go to
number filters, and we'll say greater than
1,000. And click OK.
Now it's automatically filtered the data set, so that all of the values that are greater than 1,000 are present.
This would be the preferred way to filter your data in Excel, because it doesn't require the two to delete any of your
data, but still filters your data for you. But if for some reason you don't have the format as table, or if you can't figure
out how to do it in your version of Excel, then the first method will work just fine. All right, have a great day and have fun!
fun learning Excel.