7 Les

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Using logical functions in MS Excel

Exercise 1
The following worksheet contains Roll.Nos. & Marks in 5 subject of a student.
Calculate his grades as per the following :

Marks Grades

0-40 4
40-50 3
50-60 2
60 & above 1

A B C D E F
1 Roll No. ENG HINDI SCIENCE MATHS SO. SCI
2 110 45 56 67 78 60
3 GRADE
4
5
6
7
8
9
10
11

Answer:

Enter headings & data as shown in columns A to F

To calculate GRADES using HLOOKUP

1. Enter Marks & Grades in rows 8 & 9 as follows

A B C D E
8 MARKS 0 40 50 60
9 GRADE 4 3 2 1
2. At B3 enter =HLOOKUP(B2, $B$8:$E$9 , 2)
3. Grade is displayed for the first subject. Drag the formula up to F3 to get grades
for all the subjects.

Exercise 2
The following worksheet contains Names & Sale for 10 salesmen.

Calculate their bonus as per the following :

Sale Bonus
0-30000 0
30000-40000 3000
40000-50000 4000
50000-60000 5000
60000-70000 6000
70000-80000 7000
80000 & above 8000
A B C D H I
1 NAME SALE BONUS 0 0
2 Deep 30000 30000 3000
3 Jayesh 40000 40000 4000
4 Yash 45000 50000 5000
5 Sara 48000 60000 6000
6 Gita 55000 70000 7000
7 Jinal 32000 80000 8000
8 Kavita 66000
9 Minal 23000
10 Naresh 43000
11 Rima 37000

Answer:

Enter headings & data as shown in columns A to F

To calculate BONUS using VLOOKUP

1. Enter Sale & Bonus in columns H & I as follows

H I
0 0
30000 3000
40000 4000
50000 5000
60000 6000
70000 7000
80000 8000

2. At C2 enter =VLOOKUP(B2, $H$1:$I$7 , 2)


3. BONUS is displayed for the first salesman. Drag the formula up to C11 to get
bonus for all the salesmen.
Exercise 3
The following worksheet contains Customer No. , Number of units consumed for 10 customers.

Calculate their bill amount as per the following :

Number of units Rate


< 200 Rs. 3
>=200, < 500 Rs. 6
>= 500 Rs. 10

A B C D H I
1 Cust. No.of Rate Bill Units Rate
No. Units Amount
2 1101 340 0 3
3 1102 180 200 6
4 1103 400 500 8
5 1104 600
6 1105 350
7 1106 470
8 1107 890
9 1108 200
10 1109 500
11 1110 360

Answer:

Enter headings & data as shown in columns H to I

To calculate RATE using LOOKUP

1. Enter Units & Rate in columns H & I as follows

H I
0 3
200 6
500 8

2. At C2 enter =LOOKUP(B2, $H$2:$H$4 , $I$2:$I$4)


3. Rate is displayed for the first customer. Drag the formula up to C11 to get
bonus for all the customers.
4. In D2 enter the formula = B2*C2
5. Bill amount is displayed for the first customer. Drag the formula up to D11 to
get bonus for all the customers.
Exercise 4
A worksheet contains Roll Number , Marks in 2 subjects for 50 students in a class.
Calculate Result and Grade using the following:

A student is declared as PASS if he gets 40 or more in both the subjects , Otherwise


FAIL.

All FAILED students will be given Grade IV

For PASSED students Grade will be obtained as follows :

AVERAGE GRADE

>=60 I

<60 but >=50 II

<50 but >=40 III

Enter headings and data as shown above

To calculate AVERAGE

In cell D2 enter the formula = AVERAGE (B2:C2) or = (B2 + C2)/2 and press enter key

It shows AVERAGE for the first student

Drag the formula up to D51

To find RESULT

In cell E2 enter the formula = IF(AND(B2>=40,C2>=40),”PASS”,”FAIL”) and press enter key

It shows Result for the first student

Drag the formula up to E51

To find GRADE

In cell E2 enter the formula = IF(E2=”FAIL”,”IV”,IF(D2>=60,”I”,IF(D2>=50,”II”,”III”))) and


press enter key

It shows Grade for the first student

Drag the formula up to


Sorting data in MS Excel

Exercise 1

A worksheet contains following data:


A B C D E
1 NAME GENDER CLASS CATEGORY FEES
2 Deep M FY Open 3000
3 Jayesh M SY Reserved 1000
4 Yash M TY Reserved 1000
5 Sara F FY Reserved 500
6 Gita F FY Open 3000
7 Jinal F TY Open 5000
8 Kavita F SY Open 4000
9 Minal F SY Reserved 1000
10 Karan M TY Reserved 1000
11 Abhay M TY Open 5000
12 Bina F FY Open 3000
13 Seema F FY Reserved 500
14 Naresh M FY Reserved 500
15 Rima F TY Open 5000
16 Gajendra M SY Open 4000

Filter the worksheet to show

a) Female students from Reserved category


b) Male students from TY
c) Open category students paying fees > 3000

Answer:

a) To display female students from Reserved category

1. Copy paste the header row to some other location in the worksheet say G1
2. Under Gender and Category type F and Reserved respectively
3. Select the entire data A1 : E16
4. From the data tab select Filter Advanced
5. Advanced filter window is displayed
6. Under – Action, select Copy to another location say A20
7. It displays the list range as $A$1:$E$16
8. Click at criterion range. Select the range you have created along with the header row
9. Click at OK

b) To display Male students from TY

1. Copy paste the header row to some other location in the worksheet say G5
2. Under Gender and Class type M and TY respectively
3. Select the entire data A1 : E16
4. From the data tab select Filter Advanced
5. Advanced filter window is displayed
6. Under – Action, select Copy to another location say G20
7. It displays the list range as $A$1:$E$16
8. Click at criterion range. Select the range you have created along with the header row
9. Click at OK
c) To display Open category students paying fees > 3000

1. Copy paste the header row to some other location in the worksheet say G10
2. Under Category and fees type Open and >3000 respectively
3. Select the entire data A1 : E16
4. From the data tab select Filter Advanced
5. Advanced filter window is displayed
6. Under – Action, select Copy to another location say A20
7. It displays the list range as $A$1:$E$16
8. Click at criterion range. Select the range you have created along with the header row
9. Click at OK

Exercise 2
A worksheet contains name and marks in 3 subjects. Calculate Total Marks

A B C D E
1 NAME SUB 1 SUB 2 SUB 3 TOTAL
MARKS
2 Deep 30 34 44
3 Jayesh 40 35 45
4 Yash 45 36 47
5 Sara 48 32 50
6 Gita 35 32 43
7 Jinal 32 31 37
8 Kavita 36 28 38
9 Minal 23 25 40
10 Naresh 43 27 50
11 Rima 37 44 46

d) Construct 3D Pie Chart for Total marks


e) Construct 2D Line Chart for Subject 1 and Subject 3
f) Construct 2D Column Chart for Sub1,Sub2,Sub3
g) Construct Stacked Column Chart for Sub1,Sub2,Sub3

Answers:

3D Pie Chart for Total marks

1. Select entire column of Total Marks ie E1:E11


2. Insert Tab—Chart group – Pie option—3D Pie Chart
3. 3D Pie diagram appears
4. Click at Chart tools – layout– Chart Title – Above the chart
It displays a box above the chart.
Click inside the box and type the title as

3D PIE CHART FOR TOTAL MARKS

5. Click on the Legend area , right Click and Click at select Data

6. Click on Edit at Horizontal Axis Labels

7. Select range as A2:A11 ( Click and drag) and OK

8. Names of students will be displayed in the legend area


2D Line Chart for Subject 1 and Subject 3

1. Select B1:B11 Keep pressing Cntrl Key & Select D1:D11


2. Insert Tab—Chart group – Line option— sub option 2D
3. 2D Line Chart appears
4. Click at Chart tools – layout– Chart Title – Above the chart
It displays a box above the chart.
Click inside the box and type the title as

LINE CHART FOR SUBJECT 1 AND 3

5. Under layout menu of Chart tools, select Axis Title - sub option Primary
horizontal axis – and position Below the Axis

Axis Title box appears below the horizontal axis


Click inside the box and type the title as Student Names

6. Under layout menu of Chart tools, select Axis Title - sub option Primary vertical
axis – and position Rotated

Axis Title box appears at the vertical axis in rotated position


Click inside the box and type the title as Marks
7. Click on labels at Horizontal Axis , Right Click and select Data Labels option
Click on Edit at Horizontal Axis Labels
It asks for the range for Horizontal Axis Labels
Select the range as A2:A11
Names of students will be displayed in the Horizontal Axis area
OK

2D Column Chart

1. Select A1 : D11
2. Insert Tab—Chart group – Column option— sub option 2D
3. 2D Column Chart appears
4. Under layout menu of Chart tools, select Chart Title , sub option Above the chart
5. It displays a box above the chart.
Click inside the box and type the title as

COLUMN CHART FOR SUBJECT 1 ,2 AND 3

6. Also specify the axis titles as explained above


7. Also specify the Horizontal axis labels as explained above

2D Stacked Column Chart

1. Select A1 : D11
2. Insert Tab—Chart group – Column option— sub option 2D – Stacked Column
3. 2D Stacked Column Chart appears
4. Under layout menu of Chart tools, select Chart Title , sub option Above the chart
Click inside the box and type the title as

STACKED COLUMN CHART FOR SUBJECT 1 ,2 AND 3

5. Also specify the axis titles as explained above


6. Also specify the Horizontal axis labels as explained above

You might also like