today i'm going to teach you about frequency function we have this data set here you can
see we have some people and their age so to understand frequency function let's actually
just first talk about count if function so basically conditional counting
so here we have all of these different people so let's say we want to know
how many people in this list are 24 years old so if i had 24 here i could do equals countif
open parenthesis and then if i select this range comma and then i can say
24 so as you can see i get a three because well if we go through this list there's one here
two here and three here now something we might want to do is to group them
in different brackets and say okay let's see how many people we have
that are between let's say 0 and 24 years old right so basically that would include 23 22
23 all of those so something like that we could do by doing this we could check let me not link
to the cell just to keep this simple i'm going to check if it's less than or equal to 24.
and as you can see i got h so again if we go through the list one two
three four
five six seven and eight so frequency function is gonna do something similar to this
so what we can do we can basically categorize what we call classes and then count
how many occurrences of a number we have within a class so let's
do an example of that let's just keep this one as is right here we know that
here i did less than or equal to 24 so up to 24 years old so let's say i want to get some
counts i want to get some counts for people between 0 and 24 and then between 25 to 30
and then finally 36 and up so how can we do this basically what we need to do we need to set the
upper limit for this so for example in this first group we have 0 to 24 24 is the upper limit i'm
going to do 24 and then for the next one i'm going to do 30 and then for this one i'm going to do 35
and then for this one there is really no upper limit so i'm gonna skip that one so
now what i'm gonna do i'm gonna go here and do frequency function and here we have two
arguments the first one is data which is gonna be this range of numbers comma and then we have what
we call classes which is going to be these upper limits right here if i close parenthesis and hit
enter see we got 8 2 3 2. so this 8 is going to be 0 to 24 so 24 included and that would be this
number then the next one is going to be after 24 so for example if you had 24.1 that would go in
this next class now for our numbers we just have whole numbers so we'll just say 25 but remember
that technically this is anything that's above 24. so now we go from 25 up to this number this
number included so if we check how many we have between 25 and 30 we'll get well these don't count
this is one that's 25. we have this 30 which is 2 30 is included
and that's it so we got two of those as you can see that's exactly what we have here and finally
we have three for this category which is going to be after 30 up to 35. so again if we count
through this you'll see we have three of those and then finally for anything that's above 35 in this
case it's going to be 36 and up we have two so if we check here see we have one and we have two
and that's it and that's how this works now these numbers that we have as classes they can be a
range like this you could also provide an array so you could do something like this and do 24
30 and then 35 this should probably be separated with semicolon let me try with commas to do a
column see what happens apparently it works like that too so should work both ways whether you do
this or this there it is so those would be our classes from here so now i have them hard coded
and finally one last thing to remember about these classes is that even though we have
them sorted here in this order if you don't have them sorted internally it's still going to sort
those values so if i did this like 30 and then 35 and then 24 i'm going to get the same results
because internally it's going to sort these to go 24 30 35 and then it's going to do its thing
so if i'd enter you'll see i get exactly the same results no matter how these are sorted
and that's all there is to it thanks for watching please subscribe and i'll see in the next video