You are on page 1of 7

BCOM 212 – Financial Modelling Lab Yash Jain (Roll no.

03914788818)
Date: 20/03/2021 BCOM 4A

ASSIGNMENT 3 – ELECTION DATA CONTD.


Tasks:
1. Categorize the voters If function – less than 30 as young, 31-50 middle age and above 50
as seniors.
2. Count the number of voters below the age group of 51. (use the appropriate function)
3. Maximum voters belong to which age group? (use pivot table)
4. Count the voters for Republic and Democrat party. (use pivot table)
5. How many voters declined to vote? (use pivot table)

STEPS:
1. Open the excel sheet that has the data. First, we need to categorize the data. For that,
we use the if() function. Since we do not have the option to input multiple ifs in one go,
we need to do it in the following way:
=IF(Data1!E2<"21-30","Young",IF(AND(E2>="21-30",E2>="31-40",E2<="41-
50"),"Middle Age","Seniors"))

2. Next, to count the number of voters that have age greater than 50, we simply used the
countif() function, and selected our data as follows:

=COUNTIF(E2:E100,”>41-50”)
BCOM 212 – Financial Modelling Lab Yash Jain (Roll no. 03914788818)
Date: 20/03/2021 BCOM 4A

3. Now, to use the pivot tables, we need to first, select the data, and then go to Insert -----
--->Pivot Tables.
BCOM 212 – Financial Modelling Lab Yash Jain (Roll no. 03914788818)
Date: 20/03/2021 BCOM 4A

4. Now, after clicking on the pivot table, the following dialog box will appear –

5. Click on Ok, and the pivot table would appear. Now, it is time to select the fields for
the pivot table.

6. Now, select Party, and drag it onto the Rows part of the Pivot Table Fields. After that,
select Voter Id and move it to the Values part of the Pivot table fields. Now, click the
drop down box in the Voter Id selection under Values, and go to Value field settings,
where we would select ‘Count’, instead of ‘Sum.
BCOM 212 – Financial Modelling Lab Yash Jain (Roll no. 03914788818)
Date: 20/03/2021 BCOM 4A

With this, our Pivot table is created. Now, we can see the maximum number of voters are for
Democrat Party.

7. Now, we can filter the table, and select Republican and Democrat to know how many
voters were from which party. This is done as below:
BCOM 212 – Financial Modelling Lab Yash Jain (Roll no. 03914788818)
Date: 20/03/2021 BCOM 4A

The output would show us the table as below :


BCOM 212 – Financial Modelling Lab Yash Jain (Roll no. 03914788818)
Date: 20/03/2021 BCOM 4A

8. Now, we will use a similar method to see how many voters declined to vote. For that,
in the filters column, we would select just ‘Declined’, and the results would be out. This
is done in the following way –

9. After this, the table would look like the one below:
BCOM 212 – Financial Modelling Lab Yash Jain (Roll no. 03914788818)
Date: 20/03/2021 BCOM 4A

THE TABLE, AFTER ALL THE FORMATTING, WOULD


LOOK LIKE THIS:

The link to the worksheet:


https://drive.google.com/file/d/1KQP5nnd83q35FM3VBOECAFeeXIq02vvV/view?usp=shar
ing

You might also like