GE-161L ICT Lab-07
GE-161L ICT Lab-07
Laboratory 07
Version: 1.0.0
Contents:
Learning Objectives
Required Resources
General Instructions
Background and Overview
o Microsoft ® Excel
Activities
o Pre-Lab Activity
Renaming worksheet
Reposition worksheet
Change color of worksheet tab
Hide/Unhide worksheets
Task 01: Creating a Workbook
o In-Lab Activity
Importing data
Allow specific value
Record a Macro
Running a Macro
Advanced Formulas
– SUMIF
– COUNTIF
– IF
– AND
– OR
– PROPER
– CONCATENATE
Creating Charts
Format Chart
Add / Delete Chart elements
Add Sparklines
Creating PivotTable
Filter PivotTable
Securing Workbook
Task 01: Checking Exam Status
Task 02: Creating Chart
o Post-Lab Activity
Task 01: GPA Calculation
Submissions
Evaluations Metric
References and Additional Material
Lab Time and Activity Simulation Log
Learning Objectives:
Import data in Microsoft ® Excel
Advanced Formulas in Microsoft ® Excel
Macros
Charts in Microsoft ® Excel
PivotTable in Microsoft ® Excel
Securing Workbook
Resources Required:
Computer / Laptop
Microsoft ® Excel
General Instructions:
This is an individual lab, you are NOT allowed to discuss your solution with your colleagues,
not even allowed to ask how is he/she doing, this may result into negative marking. You can
ONLY discuss with your TAs or with course instructor.
Your TAs will be available in the lab for your help. Alternatively, you can send your queries
via email.
Teachers:
Course Instructor Prof. Dr. Syed Waqar ul Qounain [email protected]
Activities:
Pre-Lab Activities:
Renaming worksheet:
Double click the “Sheet 2” worksheet tab to select its name
Type “Monday” and press “Enter”. New name will appear on the tab.
Repeat the steps for “Sheet 3” and name it “Tuesday”
Reposition worksheets :
Click the “Wednesday” worksheet tab. On the Home tab, in the Cells group, click “Format”
Click “Move or Copy Sheet”
Hide/Unhide worksheets:
In-Lab Activities:
Importing data:
Click the “Data” tab
In the “Get External Data” group, click “From Text”
In the “Text Import Wizard” dialog, choose the option that best describes your data
Click “Next”
Data Validation dialog will appear. Select “text length” in allow tab
Enter minimum value as “5”
Enter minimum value as “10”
Click “OK”
Fig. 17 (Macros)
Create a table
Click the “View tab” on the Ribbon
Click “Macros” in the “Macros group”
Select “Stop Recording” from the drop-down list
Fig. 19 (Macros)
Running a Macro:
Fig. 20 (Macros)
Fig. 21 (Macro)
Advanced Formulas:
Function Syntax
SUMIF SUMIF (Range, Criteria, Sum_range)
SUMIFS SUMIFS (Sum_range, Criteria_range1, Criteria1, Criteria_range2,
Criteria2, ...)
COUNTIF COUNTIF (Range, Criteria)
COUNTIFS COUNTIFS (Criteria_range1, Criteria1, Criteria_range2, Criteria2, ...)
AVERAGEIF AVERAGEIF (Range, Criteria, Average_range)
AVERAGEIFS AVERAGEIFS (Average_range, Criteria_range1, Criteria1,
Criteria_range2, Criteria2, ...)
VLOOKUP VLOOKUP (Lookup_value, Table_array, Col_index_num,
Range_lookup)
HLOOKUP HLOOKUP (Lookup_value, Table_array, Row_index_
num, Range_lookup)
IF IF (Logical_test, Value_if_true, Value_if_false)
AND AND (Logical1, Logical2, ...)
OR OR (Logical1, Logical2, ...)
LEFT LEFT (Text, Num_chars)
RIGHT RIGHT (Text, Num_chars)
MID MID (Text, Start_num, Num_chars)
TRIM TRIM (Text)
PROPER PROPER (Text)
UPPER UPPER (Text)
LOWER LOWER (Text)
CONCATENATE CONCATENATE (Text1, Text2, ...)
SUMIF Function:
The SUMIF function is used to sum the values in a range that meet a specific criteria. For example,
suppose that in a column that contains numbers, you want to sum only the values that are less than
300000. You can use the following formula: =SUMIF(C3:C6,"<300000"). It will result the sum of all
those values which are less than 300000 in cells C3, C4, C5 and C6.
Click the “Formulas Tab” and then in the “Function Library” group, click “Math & Trig”.
Scroll to and click “SUMIF”
The Function Arguments dialog box opens with text boxes for the arguments, a description of the
formula, and a description of each argument
In “Range” box, select the cell range C3:C6. Press “Enter”. By doing this, you apply the cell
range that the formula will use in the calculation
In the “Criteria” box, type “< 300000” and then press “Tab”. “Sum_range” is not bold, that
means this is optional
Click “OK”
COUNTIF Function:
COUNTIF function is used to count the number of cells that meet a criterion; for example, to count the
number of times the Revenue was more than 400000.
Click the “Formulas Tab” and then in the “Function Library” group, click “More
Functions”. In “Statistical” group, scroll to and click “COUNTIF”
The Function Arguments dialog box opens with text boxes for the arguments
In “Range” box, select the cell range D3:D6. Press “Enter”. By doing this, you apply the cell
range that the formula will use in the calculation
In the “Criteria” box, type “> 400000”
Click “OK”
IF Function:
The IF function is one of the most popular functions in Excel, and it allows you to make logical
comparisons between a value and what you expect. So an IF statement can have two results. The first
result is if your comparison is True, the second if your comparison is False.
Click the “Formulas Tab” and then in the “Function Library” group, click “Logical”. Click
“IF”
The Function Arguments dialog box opens with text boxes for the arguments.
We can also use IF function with text data. For example if you type, =IF(C2=”Yes”, 1, 2) in a cell it
means, IF the value in the cell C2 is equal to Yes, then return a 1, otherwise return a 2.
AND Function:
The AND function is used to determine if all conditions in a test are TRUE. The AND function returns
TRUE if all its arguments evaluate to TRUE, and returns FALSE if one or more arguments evaluate to
FALSE.
Click the “Formulas Tab” and then in the “Function Library” group, click “Logical”. Click
“AND”. The Function Arguments dialog box opens with text boxes for the arguments.
We can also use AND function in an IF function. For example if you type, =IF( AND(A2=10, B2=20),
1, 0) in a cell it means, IF the value in the cell A2 is equal to 10, AND the value in the cell B2 is equal
to 20 then return 1, otherwise return 2.
Click the “Formulas Tab” and then in the “Function Library” group, click “Logical”. Click
“OR”
We can also use OR function in an IF function. For example if you type, =IF( OR (A2=10, B2=20), 1,
0) in a cell it means, IF the value in the cell A2 is equal to 10, OR the value in the cell B2 is equal to
20 then return 1, otherwise return 2.
The function =PROPER (“pakistan zindabad”) written in any cell of the worksheet will return the
text Pakistan Zindabad in the same cell.
The function =PROPER (C2) written in any cell of the worksheet will return the text of the cell C2 in
the current cell in proper form as described above.
Click the “Formulas Tab” and then in the “Function Library” group, click “Text”. Scroll to
and click “PROPER”
In “Text” box, enter any text. Press “Tab” and Click “OK”
In cell B4 type pakistan zindabad. In any cell for example cell D4 type =PROPER (B4) and
press Enter. This will convert text of cell B4 into PROPER case in cell D4.
Similarly the functions of UPPER convert a text string into upper case. For example the function
=UPPER (“pakistan zindabad”) written in any cell of the worksheet will return the text PAKITAN
ZINDABAD in the same cell.
The functions of LOWER convert a text string into lower case. For example the function =LOWER
(“PAKITAN ZINDABAD”) written in any cell of the worksheet will return the text pakistan
zindabad in the same cell.
CONCATENATE Function:
The CONCATENATE functions is used to join two or more text strings into one string. For example if
one types =CONCATENATE("Mr Ahmad obtained ", A2, " marks in exams."). Assume that the
cell A2 contains the value 998 than this will return the string Mr. Ahmad has obtained 998 marks in
exams. The value 998 would be taken from the cell A2.
Click the “Formulas Tab” and then in the “Function Library” group, click “Text”. Scroll to
and click “CONCATENATE”
In cell B4 type Pakistan, and cell D4 type Zindabad. In any cell for example cell B6 type
=CONCATENATE (B4, D4) and press Enter. This will join text from both cells and display
it in the cell B6.
Creating Charts:
The 2-D column, 3-D Column chart options are displayed. Further, More Column Charts… option is
also displayed. Move through the charts to see the preview.
Format Chart:
Select the chart
Click on “Chart Design Tab”
Click on “Quick Layout”. As you move to each of the options, the chart changes to preview
what it will look like if you select the option
Select any option you want
Fig. 62 (Sparklines)
Fig. 64 (Sparklines)
Creating PivotTable:
Fig. 65 (PivotTable)
Fig. 66 (PivotTable)
The PivotTable is created by moving fields from the Fields to the layout area. What you drag where
depends on what question you are trying to answer. This can be done in four ways:
Select the check box next to the field name. Excel will automatically put the field in place.
o Non-numeric fields are automatically placed in Row Labels on the left side of the report.
As you add more non-numeric fields, Excel places them on the inside of fields already on
the PivotTable report, building a hierarchy.
o Numeric fields will be placed in Column Labels.
Right click the field name and select desired locations of the field
Drag the field name to the locations listed below the field list
Drag the field name directly to the layout are
Fig. 67 (PivotTable)
Filter PivotTable:
Filtering specific student marks.
From the drop-down menu against Student in the layout area, select “Ali”
Click “OK”
Securing Workbook:
On “Review tab” in “Protect” group, click “Protect Workbook”
Enter password in the “Protect Structure & Windows” dialog and click OK
In “General Options”, enter Password to open and Password to modify and Click “OK”
Post-Lab activities:
Task 01: GPA Calculation [Estimated time 60 minutes / 50 marks ]
Marks & Total Marks column should have a data validation of whole numbers with a range
between 0 to 100
Percentage should be calculated by the formula
Use Multiple IF Functions to fill Grade and Grade Points columns
Submissions:
For Pre-Lab Activity:
o Perform Pre-Lab as mentioned above.
o Save the respective document in folder “RollNo_Pre-Lab-07”.
o Then zip the whole folder (RollNo_Pre-Lab-07.zip), and email it to your respective
TA.
For In-Lab:
o Perform mentioned tasks of In-Lab activity.
o Make a folder on Desktop by the name “RollNo_In-Lab-07”.
o Then save each document in folder “RollNo_In-Lab-07”.
For Post-Lab Activity:
o Perform Post-Lab as mentioned above.
o Save the respective document in folder “RollNo_Post-Lab-07”.
o Then zip the whole folder (RollNo_Post-Lab-07.zip), and email it to your respective
TA.
Evaluations Metric:
All the Lab tasks will be evaluated offline by TA’s.
Division of In-Lab tasks: [50 marks]
o Task 01 (Checking Exam Status) [30 marks]
o Task 02 (Creating Chart) [20 marks]
Division of Pre-Lab tasks: [20 marks]
o Task 01 (Creating Workbook) [20 marks]
Division of Post-Lab tasks: [50 marks]
o Task 01 (GPA Calculation) [50 marks]