assignment 2
assignment 2
Lab Title: Introduction To Analysis Tools Teacher Name: Engr. Afeef Obaid
Lab Evaluation:
CLO 1 Use state of art tools to develop professional documents, spread sheets, web layouts and
presentations in various assignments
Acceptable
Not
Acceptable 0 L6 Lab missed or implemented none of the task
LAB DETAILS:
Lab Goals
The interface
2
1 3
4
6
1. The File menu: This menu allows you to create, save, open and print spreadsheets.
2. Quick access toolbar: You can customize this toolbar to include all of the functions you use most,
such as save and undo.
3. The ribbon: The ribbon contains all the office menus and toolbars. The ribbon is divided into tabs,
each of which contains groups of controls.
4. Columns: Label 4 is one of the columns in the spreadsheet. Each column is labeled by the letter (or
a string of letters) at the top of it.
5. Rows: Label 5 is one of the rows in the spreadsheet. Each row is labeled by the number to its left.
6. Cells: A cell is the intersection between a row and column. A cell is where most of the excel data is
entered. A cell’s address is the row and column it is in, for instance, the boxed cell (label 6) is in
column E and row 13; hence, its address is E13.
7. The worksheet toolbar: An Excel file is called a workbook. It consists of a number of spreadsheets
(worksheets). This toolbar allows you to move between the different sheets in a workbook. It also
allows you to create new worksheets, delete existing sheets, and rename sheets.
Exercise 1
1. Enter the data “Sunday” into cell A1 and “Monday” into cell B1.
2. Type in “17/08” into cell E8.
3. Type in “2” into cell I8 and “4” into cell I9.
Auto‐complete
Your worksheet should now look like this:
Notice how Excel automatically detected that 17/08 was a date and converted it to 17‐Aug. We will
discuss formatting data later on in this lab.
Now, we want to select both cells A1 and B1 together. To do this, click A1 and without releasing the
mouse button, move the mouse over cell B1. Now there should be a rectangle around both cells as
shown below.
To get excel to auto‐complete this row, we now position the mouse cursor at the bottom‐left corner of
the rectangle. Make sure the cursor has changed into a + sign. Now hold down the cursor and drag it to
the left till I1.
This is what your spreadsheet should look like when you release the mouse button:
Exercise 2
1. Auto‐complete cells I8 and I9 all the way to I14.
2. Auto‐complete cell E8 all the way to E12.
Formatting
Excel allows you to format your data so that it shows up in the way you need it to. Let us start with
number formatting. Select cells I8 and I9. If you take a look at the Number group in the Home tab on
the ribbon, you will notice that the current number format is “General”:
Selecting that drop down box shows you some of the available number formats, as shown below.
Select currency from the drop down menu. Now, you will notice that the two numbers have a $ sign
preceding them, and have two decimal places. Let us change the currency symbol to a Euro. Select the
Euro symbol from the currency format menu.
Exercise 3
Modify cells I8 and I9 by removing the 2 decimal places.
Exercise 4
Format cell E8 so that it looks like August 17, 2010.
Basic calculations
When working on a spreadsheet, you will almost definitely need to perform some calculations on the data
you have. The first thing you need to remember about Excel calculations is that formulas always start
with an = sign. Let us begin with a very simple calculation. Type “=3+5” into cell A5 as shown
below.
Press Enter. Excel automatically replaces the formula with the result of the equation.
Now let us calculate the sum of the numbers in I8 and I9. In cell J10, type “=I8+I9”. One other option is
to type in “=”, then select cell I8. After that, type in “+” and then select I9.
Pressing Enter will give you the result of the calculation. Double‐clicking on the cell with the formula
allows you to edit the formula.
Excel has built‐in functions that make your life easier. One of them is the SUM function. In cell J11, type
“=sum(“. Now select both cells I8 and I9.
Pressing Enter gives you the same result as the plus operation we did in cell J10. Try changing the value
in cell I8 and notice how the change is reflected in both formulas.
Exercise 5
1. Open Sheet 2 in your workbook.
2. In cells A1 and A2, type 1000 and 1500 respectively.
3. Use auto‐complete to fill in cells A3 to A8.
4. Format the numbers so that they show the 1000 separator (1,000) and have one decimal place.
5. Calculate the following values for cells A1 to A8 using built‐in Excel functions:
a) Sum
b) Maximum
c) Minimum
d) Average
e) Median
f) Standard deviation
6. Enter the number 5000 into cell A9 and modify all the above formulas to include it.
7. Calculate the sum of the Maximum and Minimum, and then divide this number by the standard
deviation.
Task 2: Charts
Charts
Turning data into charts can help visualize the information at hand. To convey the appropriate message
from your data, you need to select an appropriate type of chart for your data.
Let us start out with creating a simple chart using the chart wizard. Open the file excellab2.xslx. In the
total expenses sheet, you will see a table showing the total expenses accumulated by a company in the
12 months of a particular year. Select the entire table.
On the ribbon, click the Insert tab. There you will notice the Charts group, showing all the different types
of charts that can be created out of the data. Select the 1st option in 2D bars (the clustered bar chart).
This is the chart Excel creates:
You may need to drag the corner of the chart to make it larger so that all the months are clearly visible
on the y‐axis. The chart needs some tweaking. First, we need to decide what extra information we want
the chart to show. We want this chart to have a meaningful title and show a title for the x‐axis. We do
not need a legend, a title for the y‐axis nor data labels. Now that I know what we want, the chart
becomes very easy to customize using Excel’s chart layouts.
Looking at Excel’s built‐in layouts, you will notice that none of them quite satisfy our chart
requirements. Here we have two options. One option is to select one of the layouts and modify it to fit
our needs. For instance, we could pick Layout 6 and simply delete the data labels. The other option
would be to go to the Layout tab in the Chart Tools menu. This tab lets you fine tune the layout of the
chart.
Take a look at the Labels group in the Layout tab. Since we already have a chart title, we do not need to
worry about it. Let us add the x‐axis title. Select Axis Titles, then hover over Primary Horizontal Axis Title,
and select Title Below Axis.
The chart now shows an x‐axis title:
Exercise 1
Remove the legend through the Labels group in the Layout tab. If needed, adjust the chart size so that
all the data are clearly visible.
Now that the layout of the chart is what we want, let us enter the correct titles. Click the chart title and
replace it with “Total expenses for 2009”. Do the same for the axis title and replace it with “Expenses
($)”.
Now we can play around with the chart colors. Again, Excel allows you to either select one of its predefined
themes or to change the background and colors, one at a time. Select Style 25 from the
Chart Styles group in the Design tab.
Your chart now looks like this:
Let’s do a little more formatting. Select the chart area (the box that encompasses the chart title and plot
area). Go to the Format tab and under Shape styles, select Subtle Effect ‐ Purple, Accent 4.
Now, select the plot area (the area that includes the chart ONLY) and select Colored Outline ‐ Dark 1.
It is quite easy to change the chart type in Excel. To do this, select the chart area and go to the Insert
tab. Select the Clustered Column from the Column charts menu.
Exercise 2
Using the same table (Total Expense sheet), create a 2D pie chart. Instead of showing absolute values, we
would like the chart to show the percentages that each segment makes up as a data label. The month
name should also be part of the label and the legend is not needed. The labels should be at the inside end
of the data points. Make sure the chart has a meaningful title. Adjust the chart size so that all the data
is clearly visible. Give the chart area a black border.
17
5
Task 3: Conditionals and IF Functions
Conditional functions
One very useful set of built‐in functions in Excel is conditional functions. As the name implies, these
perform certain operations based when a specified condition is satisfied. This is best illustrated through
an example. Open excellab3.xslx and go to the sheet named conditions. Now, let us use Excel to give us
a count of the number of employees in each department.
For this, we use the function COUNTIF. The form of this function is COUNTIF(Range, Criteria). The range
is the data values you would like the count to be performed on, and the criteria are the conditions that
need to be satisfied for a cell to be included in the count.
Let us count the number of employees in the IT department. Type =countif( and then select the range of
cells we would like to count.
Now let us try using a cell address as a criterion. We would like to find the number of employees who have
a salary greater than Reagan’s salary. The only difference here is that to include a cell address in the
criterion; there is a special syntax as shown below.
In other words, the operation symbol remains between quotations and then the cell address is
appended to it using an ampersand (&).
Exercise 2
a) Calculate the number of employees who are NOT in the IT department. (hint: the not equal sign is
<>)
b) Calculate the number of employees with a salary greater than or equal to Alexis’, and less than
Trey’s. Remember to use cell addresses. (Hint: use two countif operations.)
SUMIF works in almost the same way as COUNTIF, except it returns the sum instead of the count. For
instance, let us calculate the sum of all salaries greater than 15000.
SUMIF also lets you define separate ranges for the criterion and the summation. For example, we might
want to calculate the sum of all salaries of the IT department.
As you can see above, we first provide the formula with the range of values on which the criteria will be
applied. We then enter the criteria, followed by the range which is to be summed up if the criteria apply
to the 1st range.
Exercise 3
a) Calculate the sum of all salaries that are below the average of salaries.
b) Calculate the sum of salaries of the HR and Accounting departments.
c) Using AVERAGEIF, calculate the average of all salaries that are less than or equal to Stacey’s.
IF functions
IF functions or statements allow you to ask the question “is this true or false?” It then allows you to
implement different actions based on the outcome. That is, it allows you to compute two different
outcomes based on whether a certain criterion (logical test) is true or false. The format of an IF
statement is as follows:
In excellab3.xslx, open the if statements sheet. The grades shown are for a pass/fail course, with the
passing grade starting at 60. Let us use IF statements to display which students have passed, and which
have failed.
First, start with the logical condition that needs to be evaluated. In this case, a student passes the course
if her/his grade is greater than or equal to 60, say. The symbol >= means greater or equal.
After we formulate the logical test (the student’s grade is >= 60), enter what we want Excel to display if
this condition was true. In this case, we want Excel to display “Passed”.
Finally, enter the value if the condition is false. The IF function shown below reads: if B2 is greater or
equal to 60, then display Passed; otherwise, display Failed.
Now, drag the cell with the formula into the rest of the column.
Exercise 4
The instructor for this course would like to reward the students who got a grade strictly above 85. Use if
statements to display “Reward” or “No Reward” beside each student.
Now what happens if this course was not a pass/fail course, rather one with a letter grading scheme?
This requires the use of nested IF statements. Nested if statements allow you to embed IF statements in
other IF statements, capturing more complex scenarios. Assume that following is our grading scheme:
>90 A
>75 B
>60 C
otherwise F
Nested IF statements are done by replacing the value if false or the value if true in the function with a
new IF statement.
Notice that the logical condition of the IF function is similar to what we had done before: we require the
grade cell to be greater than a certain value. Specifically, if B2>90, the Excel displays the letter mark A. If
this condition is false, or B2 is less than or equal to 90, we need another IF condition in order to determine
the letter grade since values that are less than or equal to 90 can result in different letter marks. For
example, 77 is a B, 65 is a C, and 20 is F. All these values are less than or equal to 90.
True Is grade
> 90?
True Is grade
> 75?
If B2>90, the A is displayed. If this logical condition is false (B2 is less than or equal to 90), a new if function
takes effect: IF (B2>75,”B”,IF(B2>60,”C”,”F”)). In this function, the logical test is B2>75, the value if
true is B, and the value if false is another if function: IF (B2>60,”C”,”F”). Hence, if B2>75 is true, B is
displayed. If not, we need to check the mark if it is a C or an F. If B2>75 is false the last if function takes
effect: IF (B2>60,”C”,”F”). If B2>60, display 60; otherwise, display F.
Conditional formatting
Conditional formatting allows you to make data trends stand out visually.
Open the file excellab4.xslx and navigate to the condForm sheet. Let us say we would like to quickly
view who has OT (Over Time hours) more than 10 hours.
In the Home tab, click on Conditional Formatting in the Styles group. Move the mouse pointer over
Highlight Cells Rules, and then click Greater Than.
In the dialog box that pops up, Enter 10. Notice that you can modify the way that the cells are formatted
by choosing the fill and text colors from the drop down list labeled with. For this exercise, leave the
formatting as light red for the fill and dark red for the text. Click the OK button when you are done.
Other conditional formatting features allow you to get a quick overview of the values of all cells in a
range. One of them is data bars. Data bars assign the longest bar to the largest value in a list and the
shortest bar to the smallest value. The values in between are then given bars according to their respective
values. Let us apply this to the Total column.
Select the range of cells under the Total heading. Click on the Conditional Formatting button and navigate
to the Data Bars menu. Select the Purple Data Bar button.
The data bars now provide you with a quick relative view of the total amounts employees earn.
Using color scales also gives you a similar result as data bars. Both features allow you to get a quick view
of how your data values compare to one another. The 2‐color scales assign one color to the maximum
value and another to the minimum. The values in between get assigned “in‐between” colors. In
addition, the 3‐color scales assign a color to a selected midpoint. The colors and values assigned to them
can be modified by selecting Manage Rules under the Conditional Formatting header.
You can also delete rules by selecting the cells where you would like to clear the rules, then navigating
to the Clear Rules menu under Conditional Formatting. Click on Clear Rules from Selected Cells.
46
Sorting lists
Sorting a list or sorting an entire table are both functions that will most likely come up whenever you are
doing data analysis. You can easily sort data in alphabetic, numeric, or even chronological order.
Let us try sorting our table by the ascending alphabetic order of the names of the employees. Select the
range of names in the table. Then in the Home tab, under the Editing group, select Sort A to Z.
What this message is telling us is that with the current selection, only the names column will be sorted.
The data in the rest of the table will not be sorted. This is why we need to select the “Expand the selection”
radio button. This will allow the entire table to be sorted according the alphabetic order of
the names. Press the Sort button. The entire table has now been sorted.
47
Exercise 2
Sort the table through the Hours column, from largest to smallest.
Excel also lets us perform more complicated sorting. Let us try to sort the table by the cell icons of the
Rate column.
Select the entire table. Under Sort and Filter, select Custom Sort.
The custom sort dialog box pops up.
This dialog box shows the column headers in our table, how we want to sort them, and what order we
want them in.
56