CE-131L AICT Lab 06
CE-131L AICT Lab 06
LAB 6
6.1. OBJECTIVE
Use Microsoft Excel for data analysis and visualization – I
6.2. THEORY
Microsoft Excel is a spreadsheet editor developed by Microsoft. It features calculation or
computation capabilities, graphing tools, pivot tables, and a macro programming language
called Visual Basic for Applications. It allows users to store, organize, and analyze information.
Excel forms part of the Microsoft 365 suite of software.
6.2.1. Ribbon
MS Excel follows the same appearance as MS Word by using a Ribbon. Some tabs and menu
items on the Ribbon are standard and same as MS Word, while others are specialized for MS
Excel use and functions.
Each tab in the ribbon contains several groups of related commands. Some groups also have a
small arrow in the bottom-right corner for even more options.
6.2.2. Worksheet
When Excel starts, a blank workbook is open by default. A workbook is just an Excel file.
Cell
Each rectangle in a worksheet is called a cell. It is the
intersection of a row and a column. Cells are the basic
building blocks of a worksheet. Every worksheet is made up
of thousands of cells.
Multiple cells can also be selected simultaneously. A group of cells is called a range. Ranges are
referred to using the first and last cell in the cell range. For example, 𝐶1: 𝐶5 is a range of five
consecutive cells in column 𝐶 i.e., 𝐶1, 𝐶2, 𝐶3, 𝐶4, and 𝐶5.
Ranges can also span multiple rows and columns, as shown. In this case, the cell range is 𝐴1: 𝐹8.
Moreover, cell ranges can be named to keep track of important cell ranges in the spreadsheet.
This can be done by selecting the cell range, then selecting 𝐷𝑒𝑓𝑖𝑛𝑒 𝑁𝑎𝑚𝑒 on the Formulas tab.
Formula Bar
The formula bar is a thin bar below the ribbon and next to the name box that displays the selected
cell's content. It can also be used to enter data into the cell.
Formula bar is particularly useful for editing the data in a cell. Moreover, selecting the 𝑓𝑥 button
opens a dialogue box containing a list of functions for easy insertion.
Cell References
A cell reference or cell address is a combination of a column letter and a row number that
identifies a cell on a worksheet. When used in a formula, cell references help Excel find the
values the formula should calculate. Using cell references ensures that that formulas are always
accurate because the value of the referenced cell can be changed without having to rewrite the
formula.
There are two types of cell references: relative and absolute. Relative references change when
a formula is copied to another cell. By default, all cell references are relative references. When
copied across multiple cells, they change based on the relative position of rows and columns.
Relative references are especially convenient whenever a user needs to repeat the same
calculation across multiple rows or columns. For example, if the formula = 𝐴1 + 𝐵1 is copied
from row 1 to row 2, the result will be = 𝐴2 + 𝐵2.
Absolute references, on the other hand, do not change when copied or filled. It is used to keep
a row and/or column constant. An absolute reference is designated in a formula by the addition
of a dollar sign ($). It can precede the column reference, the row reference, or both.
$𝑨$𝟐 Neither the column nor the row changes when copied.
𝑨$𝟐 Only the column changes when copied.
$𝑨𝟐 Only the row changes when copied.
Moreover, Excel allows users to refer to any cell on any worksheet, which can be especially
helpful when referencing a specific value from one worksheet to another. To do this, begin the
cell reference with the worksheet name followed by an exclamation point (!). For example, if cell
A1 on Sheet1 is to be referenced, its cell reference would be 𝑆ℎ𝑒𝑒𝑡1! 𝐴1.
Inserting Content
To insert content in a cell, simply select a cell and insert data from the keyboard or paste
previously copied data. The content will appear in the cell and the formula bar.
Deleting Content
Select the cell or range to clear. Then select 𝐶𝑙𝑒𝑎𝑟 𝐶𝑜𝑛𝑡𝑒𝑛𝑡𝑠 under the 𝐶𝑙𝑒𝑎𝑟 command on the
Home tab. Alternatively, press 𝐷𝑒𝑙/𝐷𝑒𝑙𝑒𝑡𝑒 key on the keyboard.
Copying/Pasting Content
Select the cell/range that will be copied. Right-click on the selection and select 𝐶𝑜𝑝𝑦 or press
𝐶𝑡𝑟𝑙 + 𝐶 on the keyboard. The copied cell(s) will have a dashed box around them.
Select the cell/range to paste the content. Right-click on the selection and select 𝑃𝑎𝑠𝑡𝑒 or press
𝐶𝑡𝑟𝑙 + 𝑉 on the keyboard.
Fill Handle
Fill handle is particularly useful when copying content into adjacent cells. Select the cell(s) that
will be copied, then hover the mouse over the lower-right corner of the cell so the fill handle
appears. Click and drag the fill handle until all of the cells to be
filled are selected. Release the mouse to fill the selected cells.
Adding Cells
This will insert an entire row/column in the worksheet. Right-click on the row/column where the
new cells will be inserted, then select 𝐼𝑛𝑠𝑒𝑟𝑡.
Deleting Cells
This will delete an entire row/column in the worksheet. Right-click on the row/column that will
be deleted, then select 𝐷𝑒𝑙𝑒𝑡𝑒.
+ Addition
− Subtraction
∗ Multiplication
/ Division
^ Exponents
All formulas in Excel must begin with an equals sign (=). This is because the cell contains, or is
equal to, the formula and the value it calculates. Formulas can be created using numbers or cell
addresses; the latter is more common. In the example shown, cell 𝐴3 will contain the sum of
cell 𝐴1 and 𝐴2. If the content of either 𝐴1 and/or 𝐴2 is changed, the change will be reflected in
cell 𝐴3.
Formulas can also include a combination of cell references and numbers, e.g., 𝑁10 ∗ 1.05 .
Formulas can also be copied to adjacent cells with the fill handle. Formulas can also be edited
either in the cell or in the formula bar.
Finally, more complex formulas follow the mathematical rules of operator precedence.
#### Reason: The column isn't wide enough to display the value.
Solution: Click on the right border of the column header and increase the column
width or double-click the right border of the column header to automatically fit the
widest entry in that column.
#𝑵𝑨𝑴𝑬? Reason: Excel does not recognize text in a formula.
Solution: Correct the spelling mistake.
#𝑽𝑨𝑳𝑼𝑬! Reason: A formula has the wrong type of argument.
Solution: Either change the value of cell to a number or use a function to ignore
cells that contain text.
#𝑫𝑰𝑽/𝟎! Reason: A formula tries to divide a number by 0 or an empty cell.
Solution: Either change the value of the cell (in denominator) to a value that is not
equal to 0 or prevent the error from being displayed by using the logical function
𝐼𝐹.
#𝑹𝑬𝑭! Reason: A formula refers to a cell that is not valid (or deleted afterwards).
Solution: Either delete +#𝑅𝐸𝐹! in the formula of the cell or undo the original
deletion.
Functions
A function is a predefined formula that performs calculations using specific values in a
particular order. Excel includes many common functions that can be used to quickly find
specific results or perform certain calculations.
Functions can also be accessed from the 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝐿𝑖𝑏𝑟𝑎𝑟𝑦 on the Formulas tab.
Freezing rows/columns is useful when certain headers (rows/columns) must always be visible
as the content is scrolled through.
To unfreeze, click the 𝐹𝑟𝑒𝑒𝑧𝑒 𝑃𝑎𝑛𝑒𝑠 command, then select 𝑈𝑛𝑓𝑟𝑒𝑒𝑧𝑒 𝑃𝑎𝑛𝑒𝑠 from the drop-
down menu.
Sorting Data
A worksheet can be sorted alphabetically, numerically, and in several other ways. When sorting
data, it is important to first decide if sorting should be applied to the entire worksheet or just a
cell range.
Sort sheet organizes all the data in the worksheet by one column.
Related information across each row is kept together when the sort is
applied. Select a cell in the column to sort. Select the Data tab on the
Ribbon, then click the 𝐴 − 𝑍 command to sort A to Z (ascending
order), or the 𝑍 − 𝐴 command to sort Z to A (descending order). The
worksheet will be sorted by the selected column.
Sort range sorts the data in a range of cells, which can be helpful when working with a sheet that
contains several tables. Sorting a range will not affect other content in the worksheet. Select the
cell range to sort. Select the Data tab on the Ribbon, then click the 𝑆𝑜𝑟𝑡 command. The Sort
dialog box will appear. Choose the column to sort. Decide the sorting order (either ascending or
descending). Click 𝑂𝐾. The cell range will be sorted by the selected column.
Filtering Data
Filters can be used to narrow down the data in the worksheet, allowing users to view only the
information needed. In order for filtering to work correctly, the
worksheet should include a header row, which is used to identify
the name of each column.
To filter the data, select the Data tab, then click the 𝐹𝑖𝑙𝑡𝑒𝑟
command. A drop-down arrow will appear in the header cell for
each column. Click the drop-down arrow for the column to filter.
In the Filter menu, check the boxes next to the data to filter, then
click 𝑂𝐾. The data will be filtered, temporarily hiding any content
that doesn't match the criteria.
To clear a filter, click the drop-down arrow for the filter to clear. In the Filter menu, choose
𝐶𝑙𝑒𝑎𝑟 𝐹𝑖𝑙𝑡𝑒𝑟 𝐹𝑟𝑜𝑚 [𝐶𝑂𝐿𝑈𝑀𝑁 𝑁𝐴𝑀𝐸]. The filter will be cleared from the column. The previously
hidden data will be displayed.
Summarizing Data
The 𝑆𝑢𝑏𝑡𝑜𝑡𝑎𝑙 command allows users to quickly summarize data. It automatically creates groups
and enables users to use common functions like 𝑆𝑈𝑀, 𝐶𝑂𝑈𝑁𝑇, and 𝐴𝑉𝐸𝑅𝐴𝐺𝐸. Note that the
data must be correctly sorted before using the 𝑆𝑢𝑏𝑡𝑜𝑡𝑎𝑙 command.
To use the 𝑆𝑢𝑏𝑡𝑜𝑡𝑎𝑙 command on a sorted worksheet, select the Data tab, then click the
𝑆𝑢𝑏𝑡𝑜𝑡𝑎𝑙 command. In the Subtotal dialog box, click the drop-down arrow for the
𝐴𝑡 𝑒𝑎𝑐ℎ 𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛: field to select the column to subtotal. From the drop-down list in the
𝑈𝑠𝑒 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 field, select the function to use. In the 𝐴𝑑𝑑 𝑠𝑢𝑏𝑡𝑜𝑡𝑎𝑙 𝑡𝑜: field, select the column
where the calculated subtotal will appear. The worksheet will be outlined into groups, and the
subtotal will be listed below each group.
Conditional Formatting
Conditional formatting allows users to automatically
apply cell formatting such as colors, icons, and data bars,
to one or more cells based on the cell value. It provides a
way to visualize data and make worksheets easier to
understand.
Multiple conditional formatting rules can be applied to a cell range or worksheet. Moreover,
several predefined styles (or presets) can be used to quickly apply conditional formatting to the
data. These fall under three categories.
𝑫𝒂𝒕𝒂 𝑩𝒂𝒓𝒔 Horizontal bars are added to each cell, much like a bar graph.
𝑪𝒐𝒍𝒐𝒓 𝑺𝒄𝒂𝒍𝒆𝒔 The color of each cell is changed based on its value. Each color scale uses a
two- or three-color gradient.
𝑰𝒄𝒐𝒏 𝑺𝒆𝒕𝒔 Adds a specific icon to each cell based on its value.
Data Validation
Data validation allows the author to control exactly what a user can enter into a cell. To make
things easier, drop-down list of the possible options can be inserted into the cell. This allows the
author to build a powerful, fool-proof spreadsheet. Since users will not have to type in data
manually, the spreadsheet will be faster to use, and there's a much lower chance that someone
can introduce an error.
To apply data validation on a cell, select the cell then click 𝐷𝑎𝑡𝑎 𝑉𝑎𝑙𝑖𝑑𝑎𝑡𝑖𝑜𝑛 on the Data tab. In
the dialog box, set the validation criteria, an input message (to show a tooltip when the cell is
selected), and an error message to show if invalid data is entered by the user. Select 𝑂𝐾.
6.3. EXERCISES
This lab should be performed on an Excel worksheet. Print out the worksheet and attach it as the
lab report. Screenshots are allowed only where specified.
6.3.1. Task 01
Perform the following operations.
1. Make the following columns in your worksheet: 𝑅𝑜𝑙𝑙 𝑁𝑜 , 𝑁𝑎𝑚𝑒 , 𝐸𝑛𝑔𝑙𝑖𝑠ℎ , 𝑀𝑎𝑡ℎ , 𝑃ℎ𝑦𝑠𝑖𝑐𝑠 ,
𝐶ℎ𝑒𝑚𝑖𝑠𝑡𝑟𝑦, 𝐶𝑜𝑚𝑝𝑢𝑡𝑖𝑛𝑔, 𝑇𝑜𝑡𝑎𝑙, 𝑃𝑒𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒. Resize the columns if required.
2. Enter random roll numbers (20𝑋𝑋𝑋 − 𝐵𝐶𝐸 − 𝑋𝑋𝑋) and student names (at least 10).
3. Sort the students based on their roll numbers.
4. Use the 𝑅𝐴𝑁𝐷𝐵𝐸𝑇𝑊𝐸𝐸𝑁 function to enter the marks of each subject (0-100). Attach
screenshot of the formula.
5. Calculate the total marks of a student using the 𝑆𝑈𝑀 function. Attach screenshot of the
formula.
6. Calculate the percentage of each student by entering the appropriate formula. Round it to 1
decimal place. Attach screenshot of the formula.
7. Find the maximum and minimum marks of English. Then use the fill handle to find the
maximum and minimum marks of all the subjects.
8. Use a formula to automatically assign grades based on the criteria given below. Also apply
conditional formatting as indicated below. Attach screenshot of the formula.
𝑨 90 – 100 % Green
𝑩 80 – 90 % Blue
𝑪 70 – 80 % Yellow
𝑭 < 70 % Red
6.3.2. Task 02
In this task, attach screenshots of all validations.
1. In a new worksheet, create the following columns: 𝐼𝑡𝑒𝑚 𝐼𝐷 , 𝐼𝑡𝑒𝑚 𝑁𝑎𝑚𝑒 , 𝑄𝑢𝑎𝑛𝑡𝑖𝑡𝑦 ,
𝑃𝑟𝑖𝑐𝑒 𝑝𝑒𝑟 𝐼𝑡𝑒𝑚, and 𝐸𝑥𝑝𝑖𝑟𝑎𝑡𝑖𝑜𝑛 𝐷𝑎𝑡𝑒.
2. Restrict 𝐼𝑡𝑒𝑚 𝐼𝐷 values to whole numbers of exactly 6 digits.
3. Ensure that 𝐼𝑡𝑒𝑚 𝑁𝑎𝑚𝑒 is text only, with a maximum of 20 characters.
4. Restrict the 𝑄𝑢𝑎𝑛𝑡𝑖𝑡𝑦 to whole numbers between 1 and 1000.
5. Ensure that values accepted for 𝑃𝑟𝑖𝑐𝑒 𝑝𝑒𝑟 𝐼𝑡𝑒𝑚 are always greater than 0 and up to two
decimal places.
6. Ensure that the 𝐸𝑥𝑝𝑖𝑟𝑎𝑡𝑖𝑜𝑛 𝐷𝑎𝑡𝑒 is after the present day’s date.
7. Set custom error messages for each validation rule to guide users on acceptable input.
8. Enter at least three items.