3. Create a categorical variable from a continuous variable

 

STEPS:

Using the new annual income variable we have just created, we are going to create a new variable called "inccat", which will be annual income categorised into groups.

   

1. Insert a new column next to the "incann" variable column.  Label this variable "inccat".

2. For this exercise, we are going to assign and label the income categories as follows:

1: $0

2: $1 to $10,000

3: $10,001 to $50,000

4: $50,001 or more

 

3. To derive income categories for the new variable "inccat", we will use the variable "incann" and a nested "if" function as follows:

In the first data cell for the inccat variable (in this example, cell "AI2"), you need to type the following formula:

=if(AH2=0,1,if(AH2<10001,2,if(AH2<50001,3,if(AH2>50000,4)))) 

 


 

This formula 'nests' several IF statements within each other, so that you can apply multiple categories for the same variable at once.  There are other ways you can do this, and you might decide that you prefer a different way of calculating this, but this formula will get the result we are after, and is relatively simple.

4. Fill down the formula for the entire column, as you did in previous examples.  This should mean that all participants have data for the inccat variable.  

It is worth having a quick look through your data for this new variable to check whether the formula has actually worked (done what you intended), by checking whether the value in the "inccat" variable actually fits within the income category that has been assigned through the use of the formula.

 

You should now be able to:

1.  Derive new variables from existing variables

2.  Create categorical variables from continuous variables in Excel!