Está en la página 1de 26

Manual

Manual

1
Advanced Excel
Advanced Excel

Workshop
Workshop

Instructor: David Newbold

Information Commons
Biomedical Library

07/23/10
2
In this example, we will test the value in cell A1 and put a statement if true or false in cell B1. If the value in cell A2
is greater than or equal to 5, we want cell B1 to say Greater than 5. If it is less than 5, we want the statement in
cell B2 to say Less than 5.

The IF function takes three arguments: logical test, value if true, value if false.

The correct format to use for the IF function is this:
IF(logical_test, value_if_true, value_if_false )

Logical Test:
This is what you want to test for. In our example, we wanted to test whether cell A2 is greater than or less than 5. Excel
uses this symbol > for greater than and this symbol < for less than. So for the first argument, we would put A2 > 5
Value If True:
This is the THEN part of the IF statement. Excel needs to know what you want to happen IF your condition is met. You
can put in text surrounded by quotes, or another formula.
Value If False:
You also need to say what should happen IF your condition is not met.

Exercise:
Click inside cell A2 and enter the number 6
Press the right arrow key on your keyboard
Widen the B column of your spreadsheet.
Click inside cell B2
Click inside the formula bar and enter the following formula:
=IF(A2>=5, "Greater than 5", "Less than 5")
Press the return key on your keyboard
Your spreadsheet should look like this.







Conditional Logic: Using If Statements
You have a spreadsheet of student exam marks. Suppose you want to add the grades as well.
If the student scored above 89 it's an A; if the student scored between 80 and 89, it's a B; if the student scored between 70 and 79,
it's a C; if the student scored between 60 and 69, it's a D; and if the student scored less than 60, it's an F.
Here is the formula to enter in cell B14:

What the IF statement is doing is nesting another IF statement on the False condition. So it says, "If B2 is greater than or equal to
90 THEN put an A in cell B14; if it's not, execute another IF statement."
Calculate cell B14 first, then copy the formula to the rest of cells.


=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C",IF(B2>=60,"D",IF(B2>=0,"F",0))))) =IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C",IF(B2>=60,"D",IF(B2>=0,"F",0)))))
Extended If Statements
3
Conditional Logic/Formatting
Conditional formatting can help track trends and make values more interesting and meaningful. It involves using different colors to
highlight different ranges of values.
As an exercise, use conditional formatting to color the overall averages of the student test scores:
Green will represent a high grade red will mean the lowest grade, with various colors in between.
Highlight the cells with overall averages in them (From B11 to I11)
With the cells highlighted, click on Conditional Formatting on the Home tab
Select Color Scales
Select the first color scale
Each cell in Row 11 assumes a color. Depending on its value, ranging from green to red
4
Exercise
Format the Student Grades so that your spreadsheet looks like the one below .
With the cell B14 highlighted, click on Conditional Formatting on the Home tab
Select Manage Rules at the bottom of the drop down menu
Click on New Rule
A dialogue box appears (see illustration below):
Click on Format Only Cells that Contain
In the middle box, click the down arrow and select Equal to and enter A
Click on the Format button below
Select green from the Fill tab and white from the Font tab
Press OK,
Press OK again,


Repeat for each of the grades using the chart on the right as a guide, then click the final OK that closes the dialog box.
When finished, copy the format to all the other grade cells by using AutoFill (passing your pointer over the bottom right cor-
ner of the selected B14 cell until you get a cross, then dragging the cell selector down to i21). You should see the appropriate
backgrounds and font formatting spread to all the cells in your selection, as per below.
Conditional Formatting
5

The CountIf Function
Here's the scenario. The government have decided to take a closer look at school averages. If 4 or more stu-
dents in a subject get a score of 70 or above, then the school gets a cash bonus of $5000. There are 8 subjects,
so 8 cash bonuses are up for grabs.

The COUNTIF function looks at a range of cells and tells you how many of them meet the criteria that you set
Use the CountIf function to see how many of the students were above a score of 70 in each subject.
The CountIf function only calculates things when a certain condition is met. For example, only count the students whose
grades are above 70.

The CountIF function uses this syntax: COUNTIF(range, criteria)

In other words, it takes two arguments: The first argument is range, and this means the range of cells you want to count.
The criteria is what you want Excel to look for when it is counting. Let's see it in action.

Click inside cell B24
Click inside the formula bar
Enter the following formula: =COUNTIF(B2:I2, ">= 70")
Press the return key on your keyboard
The answer you should get is 4

The formula says, look in cells B2 to I2. Then check for a score of greater than or equal
to 70. If you find this score, keep a Count and place the number in cell B24.

So 4 students achieved a mark of 70 or above for Maths. To do the rest of the scores, you
can use AutoFill. When you have finished, it should look like this one:
6

The AND Function

The AND( ) function checks a list of arguments and determines whether they are true or false. If all the arguments are
true then the function gives you an answer of TRUE. If one or more of the arguments are false, then the function
gives you an answer of FALSE.

Example: =AND(2 + 2 = 4) TRUE

Excel will give you the answer TRUE. If you substitute 2 + 3 = 4, you will get the result of FALSE.

We want to check the B column (B24-B31), those classes with 4 or more students scoring 70 or above.

So click inside C24
Click inside the formula bar
Enter the following formula: =AND(B24>= 4)
Press the return key on your keyboard
Excel will enter True in cell B24
Use Auto Fill to calculate the rest of the AND functions

Your spreadsheet should look something like this one:
7

The SUMIF Function
8
We now need to find out how much the school will receive in grants, which will be the sum of the numbers for which
there are True answers.

For this purpose we will use the SUMIF function which adds up things depending on the criteria you give it.

The function expects certain arguments; these are: SUMIF(range, criteria, sum_range)

The first argument, range, is the cell or cells you want to check. For us, this would be the TRUE and FALSE values in
the C column. The second argument, criteria, is what you want to check for. In our case this is the value TRUE. The
third argument, sum_range, are the cells to add up. The figures we want to add up are all in the D column.

Click in cell D32
Click inside the formula bar
Enter the following SUMIF function: =SUMIF(C24:C31,TRUE,D24:D31)
Press the return key on your keyboard
Excel adds up only the values associated with TRUE

If everything went well, then you should have a figure of 25,000 for your SUMIF function. Your spreadsheet might
look like the one below:



Answering Financial Questions
9
10
If you want to know how much a loan will cost you, then Excels financial functions are ideal. How much will I have to pay
back if I borrow $270,000 over 30 years? Over 20 years? Over 10 years? You can calculate this and much more using a series of
formulas.
In the example in your spreadsheet, we have created two boxes for calculating various aspects of the loan:
The top box contains the loan criteria: Purchase price, down payment %, number of loan months, and interest rate.
The bottom box contains the results of the formulas we create using the top-box criteria.
Loan Amount
The first thing we need to know is the loan amount; this is the purchase price less the percentage of the down payment.
So, we click in the Loan Amount field and use the following formula:
=300,000*(1-20%)
We enter this using cell references, so that we can vary the purchase price and the de-
posit amount and see what effect that would have on other aspects of the loan.
=B5*(1-B6)

Monthly Payments
To find out the monthly payments for this loan with the criteria set out in the example,
we click in the monthly payment field and use the following formula:
Monthly Payments=PMT(rate/12, nper, pv)
PMT(annual interest rate/12, number of payments, loan amount)
In the example, we use the following criteria:

Payment=6.5%/12, 360,-240,000
6.5%/12 gives us the monthly interest rate
360 is the number of months in the loan period
240,000 is the amount of the loan which we calculated above

So that we can easily change the criteria, we use cell references wherever possible.
Enter the following into the formula bar: =PMT(B8/12,B7,-B11)
Resulting in the amount of $1693.97
Answering Financial Questions
11
Total Payments
To solve for Total Payments, which is the next category in the Results Box, use the
following formula:
Total Payment = monthly payments * total months
Enter the following into the Total Payments field:
=B12*B7


Total Interest
To solve for Total Interest, which is the final category in the Results box, subtract
the Loan Amount (B11) from the Total Payments (B13): use the following
Total Interest: = Total PaymentsLoan Amount
Enter the following formula in cell B14
=B13-B11


Questions
You are now in a position to answer the following questions by changing the values in the Input Cells:
What if the lender requires a 25-percent down payment?
What if I can negotiate a lower purchase price on the property?
What if I can get a 40-year mortgage?
What if the interest rate increases to 7.0 percent?


Data Tables enable you to create a table that displays the results of selected formula cells as you systematically change one
or two input cells.

You can compare the results of various scenarios by using Excels Data >What-If-Analysis >Data Table command to create a
summary table automatically.

The goal of this example is to create a table that shows the values of the four formula cells (loan amount, monthly pay-
ment, total payments, and total interest) for various interest rates ranging from 6 to 8 percent, in 0.25 percent incre-
ments.

To create the Data Table:
Create a table with 5 columns and 10 rows
In the first column create a list of interest rates starting with 6.00% and increasing by.25% until you get to 8.00%
Label the columns across the top as per the example below
For the numbers under the labels, use cell references from the Result Cells instead of typing them in (e.g. =B27)
Select the data table range (in this case, E22:I30)
Then choose Data > What-If-Analysis > Data Table. Excel displays the Data Table dialog box
Click in the Column Input Cell, then click on cell B24 (the worksheet cell that contains the Interest value)
Leave the Row Input Field blank. Click OK, and Excel fills in the table with the appropriate results (see below)

One-Input Array Data Table


Data Tables
12
13
Excels Scenario Manager feature makes it easy to automate your what-if models.
You can store different sets of input values (called changing cells in the terminology of Scenario Manager) for any
number of variables and give a name to each set.
We will continue with the Mortgage Loan worksheet and for the purposes of this exercise, we will seek to deter-
mine how changing the interest rate and loan term will effect the conditions of the loan.

Steps:
1. Select cells B39 (the Loan Term) and B40 (the interest rate),
2. Select the Data tab
3. Select What-If-Analysis in the Data Analysis section
4. Select Scenario Manager
5. Select Add and enter 480 & 5% in the Name field
6. In Changing Cells you should see already entered B39:B40
7. Press Okay
8. The Scenario Values box will appear
9. Enter the value for cell B39 as 480 and for B40 as 0.05 (5%)
10. Press OK and the Scenario Manager dialog box should reappear
With your new scenario selected, click on the Show button at the bottom of the dialog box, and the values in boxes 39-46 should
change.
Repeat the above steps for each scenario.


Scenario Manager
Generating a Scenario Report
You are now ready to take the Scenario Manager through its next phasegenerating a summary report.
When you click the Summary button in the Scenario Manager dialog box, Excel displays the Scenario Summary dialog box.
You have a choice of report types:
Scenario Summary: The summary report appears in the form of an outline.
Scenario PivotTable: The summary report appears in the form of a pivot table (See Page 16 for description)
For simple cases of scenario management, a standard Scenario Summary report is usually sufficient.
However, If you have many scenarios defined with multiple result cells, you may find that a Scenario Pivot Table provides
more flexibility.
The Scenario Summary dialog box also asks you to specify the result cells (the cells that contain the formulas in which
youre interested). You can enter those cell references by clicking in each cell, the contents of which you wish to display
Excel creates a new worksheet to store the summary table. The Scenario Summary form of the report appears below.
If you gave names to the changing cells and result cells, the table uses these names.
Otherwise, it lists the cell references.


Scenario Manager
14

Goal seeking: Determines the value that you need to enter in a single input cell to produce a result that you want in a de-
pendent (formula) cell.

Continuing with our mortgage loan example, assume that you know that you can afford $1,800 per month in mortgage
payments.
You also know that a lender can issue a fixed-rate mortgage loan for 6.50 percent, based on an 80 percent loan-to-value
(that is, a 20 percent down payment).
The question is What is the maximum purchase price I can handle? In other words, what value in cell B37 causes the
formula in cell B44 to result in $1,800?
You could plug values into cell B37 until B44 displays $1,800; however, Excel can determine the answer much more effi-
ciently.
To answer the question posed in the preceding paragraph, select Data>What-If-Analysis>Goal Seek.
Excel displays the Goal Seek dialog box shown below.
Completing this dialog box is similar to forming a sentence. You want to set cell B44 to 1800 by changing cell B37.
Enter this information in the dialog box either by typing the cell references or by pointing with the mouse. Click OK to
begin the goal-seeking process.
Goal Seeking
15
Pivot Tables will help us answer the following questions about this exercise:

What is the total deposit amount for each branch, broken down by account type?
How many accounts were opened at each branch, broken down by account type?
Whats the dollar distribution of the different account types?
What types of accounts do tellers open most often?
How does the Central branch compare to the other two branches?
Which branch opens the most accounts for new customers?
Pivot Tables
16
We will explore how Pivot Tables function by using the example of a bank,
wherein we are seeking to make sense of a substantial amount of data relating
to the opening of new accounts.
Steps in Creating a Pivot Table

1. Specify the data range by selecting it
2. From the Insert Tab, click on Pivot Table
3. Select the worksheet on which you want to place it
4. Click OK




Using a dialog box to lay out a pivot table
When you click the OK button of the dialog box, you get the configu-
ration shown below. The fields in the database appear as check boxes
along the left side of the dialog box. Simply check the box and drag
the field names to the row, column or value areas of the dialog box,
as appropriate.

Pivot Tables
17
What is the total deposit amount for each
branch, broken down by account type?
18
How many accounts were opened at each
branch, broken down by account type?

Select Amount, Acct Type, and Branch by
clicking in the check boxes
Drag Acct Type to Column Labels, Branch to
Row Labels, and Sum of Amount to Values
To change the Amount of accounts to Number
of accounts, right click in the value area of the
table, select Value Field Settings and change
Sum to Count
Your table should appear as the one to the
right
Pivot Tables Exercises
Select Amount, Acct Type, and Branch by
clicking in the check boxes
Drag Acct Type to Column Labels, Branch to
Row Labels, and Sum of Amount to Values
Your table should appear as the one to the right
What types of accounts do tellers open most often?
Click on Amount, Acct Type and Opened By
Move AcctType to Column Labels, and Opened By
to Row Labels
In Value Field Settings, click on the down arrow on
Sum of Amount and select Count
If the values are shown with dollar signs select a
cell in the value field and right click, select Num-
ber Format and change the setting to Number with
no zeros.
Whats the dollar distribution of the different account types?
Pivot Tables Exercises
Uncheck Branch
19
Which branch opens the most accounts for new customers?
Check Amount, Opened By, and Branch
Move Opened By to Column Labels
Move Amount to Values and change to Count using Value
Field Settings
20
How does the Central branch compare to the other two
branches?
Click on Amount and Branch
Drag Branch to Row Labels, Values to Column Labels, and
Amount to Values.
Drag Amount to Values a second time
Click on the down arrow of the second Amount and select
Value Field Settings
Change setting to Count if Sum is selected and Sum if Count is
selected
Pivot Tables Exercises
Charts
Picture Charts
Inserting graphics elements in your data series

Create a bar chart
Select one of the data series (a set of bars)
Right click and select Format Data Series
Select Fill
Select Picture or Texture Fill
Select Insert from Clip Art
Select a simple clip art image such as the car in the example
Select Stack from the list below
Check the chart to see if the result is what you want (before closing the dialog box)
If you dont like the result, keep trying alternatives.
21
Charts
Picture Charts
Inserting graphics elements as backgrounds in your plot area

Create a chart
Select the plot area (the background area of your chart
Click on Format Plot Area
Select Fill
Select a file or clip art image or texture
Your selection covers the plot area
Use the transparency slider to fade or enhance the image
22
Creating a chart that acts like a thermometer.
Start with a table that lists Days from Day 1 Day 15 (see example below)
At the bottom enter labels: Goal, Current and % (see example below)
Insert numbers from 90 to 150 in the first 7 days
In the Goal cell enter 1000
In the Current field enter the formula =SUM(U6:U20)
In the % field =U23/U22 and format the field as a percentage
With the percentage field selected, insert a cylindrical bar chart next to your table
Select the Design tab under the Chart Tools menu and click the design circled below
Right click the blue cylinder and select Format Data Series
Select Series Options and move the sliders for the width and depth gaps as necessary
Under Chart Tools, click on Layout and select Data Labels>Show
When the data label appears in the plot area, move it to the center of the cylinder and enlarge as appropriate
Right click the Vertical Data Axis and select Format Axis
Select Axis Options and change Maximum from Auto to Fixed and replace 0.9 with 1.0
Make changes to chart wall and floor in the Layout > Background section
23
0.0%
10.0%
20.0%
30.0%
40.0%
50.0%
60.0%
70.0%
80.0%
90.0%
100.0%
76.6%
Day 1 90
Day2 82
Day 3 132
Day 4 87
Day 5 102
Day 6 123
Day 7 150
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15

Goal 1000
Current 766
% 76.6%
Charts
Thermometer Charts
Combination Chart
24
Change one of the axis in a bar chart to a line chart
Select the series (bars) that you want to change
Right click and select Change Series Chart Type
Select Line and choose a line chart type
Press OK, and the line appears over the top of the other series bar
3D Effect Charts
Create 3D effects using a bar chart
Create a bar chart
Select the chart
In the menu bar, under Chart Tools select Layout
In the Background section, select 3D Rotation
Manipulate the x and Y axis until you achieve your desired perspective and depth
You can also manipulate the Chart Scale settings at the bottom of the dialog box.
25
Formatting to Impress
Format a spreadsheet using a variety of background, font and line colors

Select one or more cells.
Select a fill color from the Font section on the Home ribbon
Select a font color
Select a line color from the borders drop-down box > More lines dialog box
Do this until one section has been formatted as per below.

26

También podría gustarte