Sunteți pe pagina 1din 219

Advanced Training Course on

MS Excel 2013

This training handout material prepared for:

______________________________________________________________

Page 1 of 219
Table of Contents
Day 2 ........................................................................................................................................................... 5
4.10 Creating Fully Navigatable Workbooks Using Hyperlinks ........................................................ 5
4.10.01 Creating a Main or Dashboard Worksheet ................................................................ 15
4.10.02 Getting Good Graphics From the Web ..................................................................... 15
4.10.03 Copying and Pasting Icons Into Worksheet ............................................................... 17
4.10.04 Creating Hyperlinks ................................................................................................... 17
4.10.05 Copy Hyperlinks Into the Other Worksheets ............................................................. 18
4.10.06 Testing The Hyperlinks .............................................................................................. 18
5.00 VALIDATING DATA..................................................................................................................... 18
5.01 Data Validation...................................................................................................................... 18
5.02 Validation Combined with Dynamic Names .......................................................................... 24
5.03 Creating Cascading Dropdowns............................................................................................. 25
Exercises ................................................................................................................................................... 28
Day 2 – Exercise 01 – Data Capture ...................................................................................................... 28
Day 2 – Exercise 02 – Data Validation ................................................................................................... 34
Day 2 – Exercise 03 – Pivot Tables From Formatted Tables .................................................................. 34
Day 2 – Exercise 04 – Data And Time Slicers Visualization .................................................................... 35
Day 2 – Exercise 05 – Dashboard and Workbook Navigation ................................................................ 35
6.00 Analyzing Data Using Linear Equations and Optimizations ....................................................... 35
6.01 Scenario Manager ................................................................................................................. 35
6.02 Goal Seek .............................................................................................................................. 39
6.03 Solver .................................................................................................................................... 41
Exercises ................................................................................................................................................... 51
Day 2 – Exercise 01 – Scenario Manager ............................................................................................... 51
Day 2 – Exercise 01 – Goal Seek ............................................................................................................ 55
Day 2 – Exercise 02 – Data Table........................................................................................................... 59
Day 2 – Exercise 03 – Solver .................................................................................................................. 64
6.04 Data Table ............................................................................................................................. 90
7.00 Advanced Functions .................................................................................................................. 95
7.01 Using Excel 2013 Functions ................................................................................................... 95

Page 2 of 219
7.02 Getting help about using a particular function...................................................................... 97
7.03 Using date and time functions: TODAY ................................................................................. 98
7.04 Using date and time functions: DAY ...................................................................................... 99
7.05 Using date and time functions: MONTH................................................................................ 99
7.06 Using date and time functions: YEAR .................................................................................. 100
7.07 Using mathematical functions: SUMIF ................................................................................ 100
7.08 Using statistical functions: COUNTA .................................................................................... 102
7.09 Using statistical functions: COUNTIF ................................................................................... 103
7.10 Using text functions: CONCATENATE .................................................................................. 103
7.11 Using financial functions: FV ............................................................................................... 105
7.12 Using financial functions: NPV ............................................................................................ 107
7.13 Using financial functions: PMT ............................................................................................ 109
7.14 Using financial functions: PV ............................................................................................... 111
7.15 Using financial functions: RATE ........................................................................................... 112
7.16 Using logical functions: IF .................................................................................................... 113
7.17 Using logical functions: AND ............................................................................................... 115
7.18 Using logical functions: OR .................................................................................................. 116
7.19 Using logical functions: ISERROR ......................................................................................... 116
7.20 Using database functions: DSUM ........................................................................................ 117
7.21 Using CORRELATION function ............................................................................................. 119
7.22 Using nested functions ........................................................................................................ 122
7.23 Using the INDIRECT function ............................................................................................... 123
7.24 Using the OFFSET Function.................................................................................................. 124
7.25 Using the HLOOKUP ............................................................................................................ 127
7.26 Using the CHOOSE Function ................................................................................................ 128
7.27 Using the LOOKUP Function ................................................................................................ 128
7.28 Using SUB-TOTAL ................................................................................................................ 134
7.29 Summary of Using Various Look-Ups in MS Excel ............................................................... 137
7.30 Using the SUMIFS Function ................................................................................................. 144
7.31 Using the SUMPRODUCT Function ...................................................................................... 155
7.32 Using the GETPIVOTDATA Function .................................................................................... 156
7.33 Using the DAVERAGE Function ............................................................................................ 158

Page 3 of 219
7.34 Using the DCOUNT function ................................................................................................ 161
7.35 Using the DCOUNTA Function ............................................................................................. 164
7.36 Using the DGET Function ..................................................................................................... 167
7.37 Using the DSUM Function ................................................................................................... 170
7.38 Using the NPER Function ..................................................................................................... 173
7.39 Using the FVSCHEDULE Function......................................................................................... 175
7.40 Using the INTRATE Function ................................................................................................ 177
7.41 Using the IRR Function ........................................................................................................ 178
7.42 Using the PARETO CHART .................................................................................................... 181
7.43 Using the ISPMT Function ................................................................................................... 190
8.00 What-if tables.......................................................................................................................... 191
8.01 Using a one input Data Table command ............................................................................. 191
8.02 Using a two input data table command .............................................................................. 193
9.00 Audit ....................................................................................................................................... 195
9.01 Tracing precedent cells ....................................................................................................... 195
9.02 Tracing the dependents of a cell ........................................................................................ 197
9.03 Displaying all formulas within a worksheet ........................................................................ 198
10.00 Adding Picture To A Cell ...................................................................................................... 199
11.00 Introduction – Connecting Excel to Large Database ............................................................ 205
12.00 Introduction – Connecting Excel To Other Excel Workbooks .............................................. 210
Exercise ................................................................................................................................................... 217
One-Input and Two-Input Data Tables ................................................................................................ 217
Shared Workbook Using Google Docs ................................................................................................. 218
Exercise 03 – Power Pivot Introduction (Excel 2013) .......................................................................... 218
Exercise 04 – Excel Connectivity ......................................................................................................... 218

Page 4 of 219
Day 2

4.10 Creating Fully Navigatable Workbooks Using Hyperlinks


(Reference TCO ID – A.4.7)

MS Excel also contains powerful features which can transform plain textual/numeric data into more
professional looking workbooks.
Excel was not designed with only this in view.
You can incorporate good graphics into Excel, to make the presentation look professional.
An example is as follows:

1
3

Here, the navigation buttons are expressed using the icons on the left, while the 3D charts are presented in
the right portion of the screen.
There are other numerous means and ways by which you can enhance the presentation of the workbook.

What are Hyperlinks?


A Hyperlink is a reference to a document, a location or an action that the reader can directly follow by
selecting the link.
Hyperlinks are used extensively on the Internet and are generally Words highlighted in Underlined Blue <–
Like that.
The use of Hyperlinks in Excel has been extended to a number of areas and this includes:

Page 5 of 219
 Opening Files (of any type)
 Opening Web Pages (Internet or Intranet)
 Jumping/Navigating to locations within an existing document
 Creating New Documents (Excel files only)
 Sending Emails
Microsoft has added the ability to place Hyperlinks,
 Directly on an Excel worksheet ,
 Connected to a number of worksheet objects, including shapes, charts and wordart
 Included as a worksheet formulas.
 Programmatically using VBA
These 4 methods above will be discussed here.

Inserting Hyperlinks
As described above there are 4 methods for inserting hyperlinks in an Excel Workbook.

Directly on an Excel worksheet


There are 3 ways to insert a Hyperlink directly into a cell, either:
Right click on the cell and select Hyperlink; or

Use the Insert, Hyperlinks Tab; or

Page 6 of 219
Use a Keyboard Shortcut - Ctrl K
Connected to a number of worksheet objects, including shapes, charts and
wordart
You can also add a Hyperlink to many objects within Excel including
Pictures, Shapes, Text Boxes, Word Art and Charts.
Right clicking a lot of these objects brings up the Objects
Shortcuts Menu, select Hyperlink…,

or
Select the object, Use the Insert, Hyperlinks
Tab; or

Page 7 of 219
Select the Object and Use the Keyboard Shortcut
– Ctrl K
Hint: Right Clicking on Charts Doesn’t Show the Add Hyperlink
option, so Select the Chart and Ctrl K

Adding Hyperlinks using Worksheet Formulas.


Hyperlinks can be added using worksheet formulas.
=HYPERLINK( Link Location, Name)
Link Location: This is the path and file name to the document to be
opened.
The Link Location can refer to a place in a document – such as a specific cell or named range in an Excel
worksheet or workbook, or to a bookmark in a Microsoft Word document. The path can be to a file that is
stored on a hard disk drive. The path can also be the path on a server or a URL, HTTP or FTP and a location of
an object, document, World Wide Web page, or other destination on the Internet or an intranet. The Link
Location can be a text string enclosed in quotation marks or a reference to a cell that contains the link as a
text string.
Name: This is the text or value that is displayed in the cell. The Name is displayed in blue and is underlined.
E.g.:

Jump to a cell on another sheet


=HYPERLINK(Sheet3!B3,”Monthly Budget”)
The above will add a Hyperlink, titled “Monthly Budget” and link to Sheet3!B3 of the current workbook

Jump to a Named Range on Another sheet


=HYPERLINK(Budget,”Yearly Budget”)
The above will add a Hyperlink, titled “Yearly Budget” and link to the Named Range “Budget” of the current
workbook

Open a File on a network Drive


=HYPERLINK(“//Server01\01 Administration\Administration.docx”,”Open Admin File”)
The above will add a Hyperlink, titled “Open Admin File” and link to the file at: //Server01\01
Administration\Administration.docx

Open a File on a network Drive at a specific bookmark


=HYPERLINK(“[//Server01\01 Administration\Administration.docx]Contents”,”Open Admin File @ TOC”)
The above will add a Hyperlink, titled “Open Admin File @ TOC” and link to the Named Section “Contents” of
the file at: //Server01\01 Administration\Administration.docx

Adding Hyperlinks Programmatically using VBA


Hyperlinks can be added to a worksheet or a worksheet object programmatically using some simple code
Sheets(SheetName).Hyperlinks.Add Anchor:=Sheets(SheetName).Range(Range),
Address:=””, SubAddress:=”Address!Range“, TextToDisplay:=Name

Page 8 of 219
Where:
SheetName: The Name of the Sheet where the Hyperlink is to go
Range: The Range where the Hyperlink is to go
Address!Range: The address and Range linked to in the Hyperlink
Name: The Display Name of the Hyperlink

Types of Hyperlinks
There are 5 Types of Hyperlinks which Excel offers, each is described below:
 Existing File
 Existing Web Page
 Place in This Document
 Create a New Document
 Send an Email Link

Existing File

Select the existing File or Web Page icon in the


Link to: area
Navigate to the existing file using the Look in:
area of the dialog
Add your Display Text in the Text to display:
area

Page 9 of 219
Add a ScreenTip…, a Tip which is displayed when
you hover the mouse over a Hyperlink
Use the Bookmark… button to jump to predefined
Named Ranges and common Cell References dialog

Existing Web Page

Page 10 of 219
Select the Existing File or Web Page icon in the
Link to: area
Navigate to the existing file using the Look
in: area of the dialog
Add your Display Text in the Text to
display: area
Add a ScreenTip…, a Tip which is displayed when
you hover the mouse over a Hyperlink
Place in This Document

Page 11 of 219
Select the Place in this Document icon in the Link to: area
Type in Cell Reference using the Type in Cell Reference: area of the dialog or select a Defined Names in
the Defined Names area
Add your Display Text in the Text to display: area
Add a ScreenTip…, a Tip which is displayed when you hover the mouse over a Hyperlink

Create a New Document

Select the Create New Document icon in the Link to: area
Type in the Name of the New Document in the Name of the New Document: area of the dialog.
Add your Display Text in the Text to display: area
Add a ScreenTip…, a Tip which is displayed when you hover the mouse over a Hyperlink
You can choose whether to Edit the File Now or Later in the When to Edit area

Send an Email Link

Page 12 of 219
Select the Email Address icon in the Link to:
area
Type in the Email Address in the Email Address:
area of the dialog.
Add your Display Text in the Text to display:
area
Add your Email Subject in the Subject: area
Add a ScreenTip…, a Tip which is displayed when
you hover the mouse over a Hyperlink.
Editing Hyperlinks
Once you have a hyperlink established you can edit the hyperlink by right click on the hyperlink and select
Edit Hyperlink

Page 13 of 219
The Edit Hyperlink dialog will vary depending on the type of Hyperlink as described above.

Deleting Hyperlinks
Once you have a hyperlink established you can delete the hyperlink by right click on the hyperlink and select
Remove Hyperlink

Page 14 of 219
Hyperlink Uses
Hyperlink can be used for a number of uses as described above.

Tables of Contents
One common use of hyperlinks is the creation of Tables of Contents.
The construction of a Table of Contents page was discussed here Table of Contents
The construction of Tables of Contents can also be automated using some simple VBA.
So instead of reinventing the wheel I will direct you to The Microsoft Office Blog where Tables of Contents
were recently discussed.

4.10.01 Creating a Main or Dashboard Worksheet


An electronic Dashboard, or dashboard, shows SUMMARIES OF YOUR WORK, in a snapshot presentation.
The purpose of the dashboard is to present KEY METRICS of what you are monitoring in your workbook.
As an example, you may want to monitor the Current Ratio of your balance sheet (if this is that important to
you), and show its over-all value and status as a Conditionally Formatted Cell.
You may also present the over-all sales performance of your company, measured against your sales targets,
and show this as a 3D Chart.
The number of means to show this information is almost limitless, with only your creativity as the limiting
factor.
Many companies use various electronic dashboards as a means to “have an operational snapshot” of what is
happening in the company.

4.10.02 Getting Good Graphics From the Web


Getting good graphics to create electronic dashboards and/or hyperlinks adds that much needed look to your
worksheet.
There are plenty of ways by which you can get good graphics from the web. Go to www.google.com, and
Google the following:

Company logo

Page 15 of 219
Be sure to click the Images hyperlink, so only images would be displayed.

Page 16 of 219
Once you have selected the picture you prefer, then simply Right Click the mouse, and select the “Save image
as…” option and save this image to your desired directory.

4.10.03 Copying and Pasting Icons Into Worksheet


You may then copy the images/icons/pictures to the worksheet. Simply select them from your directory, right
click the mouse and copy, then move over to Excel, and position the cursor to where you want the image
copied, then right click the mouse and then Paste.

4.10.04 Creating Hyperlinks


Now that you have pasted the icons/pictures into your worksheet, you may then use this as “place markers”
or iconic pictures to depict some other function. The following icons depict some of these functions:

Hyperlinking these icons/pictures provides a nice and professional means of enabling users to “jump” or
“navigate” the workbook, without referring to the worksheet tab setting at the bottom of the workbook.
It is much more professional.
Hyperlinking would enable you to “link” either a worksheet or a named cell range to an object or text.
To hyperlink, do the following:
Right click on the image/icon you would like to hyperlink to a worksheet or named range. Choose Hyperlink.

Page 17 of 219
Once you have done you, the following dialogue screen would be displayed,

Choose the “Place in this document” option, as shown above.


The select the worksheet name or named range which you would like to “jump” to once you have
“hyperlinked” the object with it. Click OK to complete the process.
Do this procedure for all your icons/images which you would like to hyperlink to a Named range or to a
worksheet.

4.10.05 Copy Hyperlinks Into the Other Worksheets


Once you have completed the hyperlinking of all your icons to their worksheets, then copy the groups of
icons to each individual worksheet, so that you can now have the capability to navigate your workbook, using
graphical images.
You simply highlight the cells containing the icons which have been hyperlinked, then copy and then paste
into each worksheet (preferably in the same position).
4.10.06 Testing The Hyperlinks
Be sure to test the hyperlinks, by clicking on the hyperlinked icon/image.

5.00 VALIDATING DATA


(Reference TCO ID – A.4.6)

5.01 Data Validation


If you have to type the same data into cells all the time, then adding a drop down list to your spreadsheet
could be the answer. In Excel, this comes under the heading of Data Validation.

Page 18 of 219
In the example below, we have a class of students on a drop down
list. We only have to click a cell in the A column to see this same
list of students. You'll see how to do that now. Here's a picture
of your finished spreadsheet:

In the image above, we can simply select a student from the drop down list - no more typing! We can also do
the same for the Subject and Grade.

So, create the following headings in a new


spreadsheet:

Cell A1 Student
Cell B1 Subject
Cell C1 Grade
Cell E1 Comments
We now need some data to go in our lists. So, type the same data as
in the image below. It doesn't need to go in the same columns as
ours. But don't type in Columns A, B, C or E:

Page 19 of 219
The data in Columns F, G and H above will be
going in to our list.
Now click on Column A to highlight that entire
column:

With Column A highlighted, click on Data from the


Excel Ribbon at the top. From the Data tab,
locate the Data Tools panel. On the Data Tools
panel, click on the Data Validation item.
Select Data Validation from the menu:

When you click Data Validation, you'll see the


following dialogue box appear:

Page 20 of 219
To create a drop down list, click the down arrow
just to the right of "Allow: Any Value" on
the Settings tab:

Select List from the drop down menu, and you'll


see a new area appear:

Source means which data you want to go in your list. You can either
just type in your cell references here, or let Excel do it for you.

Page 21 of 219
To let Excel handle the job, click the icon to
the right of the Source textbox:

When you click this icon, the Data Validation


dialogue box will shrink:

Now select the cells on your spreadsheet that you want in your
list. For us, this is the Students:

Once you have selected your data, click the same icon on the Data Validation dialogue box. You'll then be
returned to the full size one, with your cell references filled in for you:

Click OK, and you'll see the A column with a drop down list in cell A1:

Page 22 of 219
However, you don't want a drop down list for your A1 column heading. To get rid of it, click inside of cell A1.
Click the Data Validation item on the Data Tools panel again to bring up the dialogue box. From the Allow
list, select Any Value:

Click OK on the Data Validation dialogue box, and your drop down list in cell A1 will be gone.
The rest of the column will still have drop down lists, though. Try it out. Click inside cell A2, and you'll see a
down-pointing arrow:

Click the arrow to see your list:

Page 23 of 219
Select an item on your list to enter that name in the cell. Click any other cell in the A column and you'll see
the same list.
Adding a drop down list to your cell can save you a lot of time. And it means that typing errors won't creep in
to your work.
Add drop down list to the B and C columns. The B column should
contain lists of Subjects, and the C column a list of Grades. Make
sure that the cells B1 and C1 don't contain drop down lists. When
you're finished, the Subject column should look like this:

And the Grade column should look like this:

5.02 Validation Combined with Dynamic Names


The same data validation techniques discussed in the previous section 5.01 can be much more effectively
used when employed with Dynamic Names (see Section 2.02A for more details).
The technique is as follows:

1. Name the list of cells which will be used


in the data validation (e.g., list of valid

Page 24 of 219
customers can be referred to us Customers
listing, etc.).
2. Name this using the Formulas | Define Name
method (if this list is a member of a Formatted
as Table listing), or simply use the Name Box to
give the same list a name. Either way, it will
work.
Then proceed as per Section 5.01, with the only
difference, being the Source of the list would
be typed in as follows:
=Customers listing
(instead of a $r$c:$r$c type of referencing)

5.03 Creating Cascading Dropdowns


The following topics depicts how to create cascading dropdown validations in MS Excel.
This example describes how to create dependent drop-down lists in Excel. Here's what we are trying to
achieve:
The user selects Pizza from a drop-down list.

As a result, a second drop-down list contains the Pizza items.

To create these dependent drop-down lists, execute the following steps.

1. On the second sheet, create the following named


ranges.

Page 25 of 219
Name Range Address

Food A1:A3

Pizza B1:B4

Pancakes C1:C2

Chinese D1:D3

2. On the first sheet, select cell B1.


3. On the Data tab, click Data Validation.

The 'Data Validation' dialog box appears.

4. In the Allow box, click List.


5. Click in the Source box and type =Food.

Page 26 of 219
6. Click OK.
Result:

7. Next, select cell E1.


8. In the Allow box, click List.
9. Click in the Source box and type
=INDIRECT($B$1).

Page 27 of 219
10. Click OK.
Result:

Explanation: the INDIRECT function returns the reference specified by a text string. For example, the user
selects Chinese from the first drop-down list. =INDIRECT($B$1) returns the Chinese reference. As a result, the
second drop-down lists contains the Chinese items.

Exercises

Day 2 – Exercise 01 – Data Capture


Note: Please type the data as shown below in your worksheet.
Once you have completed this Exercise, save (and email to the
facilitators email address) the File as:

Page 28 of 219
Your Complete Name – Day 02 - Exercise 01 – Set 01 – V0N
Based on the screenshot shown below, show the
data form corresponding to this image.

Be sure to type the data shown above.


You should add two more records, using the data
form.
You must also Print Screen the image of using
the Data Form, and past the same image to the
right side of this worksheet.
Day 2 – Exercise 02 – Data Validation

Note: Please type the data as shown below in your worksheet.


Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 02 - Exercise 02 – Set 01 – V0N


Use data validation in Excel to make sure that users enter certain values into a cell.

Data Validation Example


In this example, we restrict users to enter a whole number between 0 and 10.

Page 29 of 219
Create Data Validation Rule
To create the data validation rule, execute the following steps.
1. Select cell C2.
2. On the Data tab, click Data Validation.

On the Settings tab:


3. In the Allow list, click Whole number.
4. In the Data list, click between.
5. Enter the Minimum and Maximum values.

Page 30 of 219
Input Message
Input messages appear when the user selects the
cell and tell the user what to enter.
On the Input Message tab:
1. Check 'Show input message when cell is
selected'.
2. Enter a title.
3. Enter an input message.

Page 31 of 219
Error Alert
If users ignore the input message and enter a number that is not
valid, you can show them an error alert.

On the Error Alert tab:


1. Check 'Show error alert after invalid data is
entered'.
2. Enter a title.
3. Enter an error message.

Page 32 of 219
4. Click OK.
Data Validation Result
1. Select cell C2.

2. Try to enter a number higher than 10.


Result:

Page 33 of 219
Note: to remove data validation from a cell, select the cell, on
the Data tab, click Data Validation, and then click Clear All. You
can use Excel's Go To Special feature to quickly select all cells
with data validation.

Day 2 – Exercise 02 – Data Validation


Note: Please download the file to be used for this exercise. Ask
the facilitator to email you the file (or provide it via USB memory
stick). The file name is:

Day 2 - Exercise 02.xlsx


Once you have completed this Exercise, save (and email to the
facilitators email address) the File as:

Your Complete Name – Day 2 - Exercise 03 – V0N


There are instructions in the workbook that will be given to you so
kindly read the instructions carefully, and submit the
requirements, within 45 minutes from start of this exercise.

Day 2 – Exercise 03 – Pivot Tables From Formatted Tables


Note: Please download the file to be used for this exercise. Ask
the facilitator to email you the file (or provide it via USB memory
stick). The file name is:

Day 2 - Exercise 03.xlsx


Once you have completed this Exercise, save (and email to the
facilitators email address) the File as:

Your Complete Name – Day 2 - Exercise 03 – V0N


There are instructions in the workbook that will be given to you so
kindly read the instructions carefully, and submit the
requirements, within 45 minutes from start of this exercise.

Page 34 of 219
Day 2 – Exercise 04 – Data And Time Slicers Visualization
Note: Please use the workbook which you have completed in
Exercise 3 for Day 2 – as a continuance to this exercise. The data
present in that workbook, will now be the subject of the
requirements for this exercise.
Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 2 - Exercise 04 – V0N


There are instructions in the workbook that will be given to you so
kindly read the instructions carefully, and submit the
requirements, within 45 minutes from start of this exercise.

Day 2 – Exercise 05 – Dashboard and Workbook Navigation


Note: Please use the workbook which you have completed in
Exercise 3 for Day 2 – as a continuance to this exercise. The data
present in that workbook, will now be the subject of the
requirements for this exercise.
Once you have completed this Exercise, save (and email to the
facilitators email address) the File as:

Your Complete Name – Day 2 - Exercise 05 – V0N


There are instructions in the workbook that will be given to you so
kindly read the instructions carefully, and submit the
requirements, within 45 minutes from start of this exercise.

6.00 Analyzing Data Using Linear Equations and Optimizations


(Reference TCO ID – A.4.8)

6.01 Scenario Manager

What-If Analysis
What-If Analysis in Excel allows you to try out different values (scenarios) for formulas. The following example
helps you master what-if analysis quickly and easily.
Assume you own a book store and have 100 books in storage. You sell a certain % for the highest price of $50
and a certain % for the lower price of $20.

Page 35 of 219
If you sell 60% for the highest price, cell D10 calculates a total profit of 60 * $50 + 40 * $20 = $3800.

Create Different Scenarios


But what if you sell 70% for the highest price? And what if you sell 80% for the highest price? Or 90%, or even
100%? Each different percentage is a different scenario. You can use the Scenario Manager to create these
scenarios.
Note: You can simply type in a different percentage into cell C4 to
see the corresponding result of a scenario in cell D10. However,
what-if analysis enables you to easily compare the results of
different scenarios. Read on.
1. On the Data tab, click What-If Analysis and
select Scenario Manager from the list.

The Scenario Manager dialog box appears.


2. Add a scenario by clicking on Add.

Page 36 of 219
3. Type a name (60% highest), select cell C4 (%
sold for the highest price) for the Changing
cells and click on OK.

4. Enter the corresponding value 0.6 and click


on OK again.

Page 37 of 219
5. Next, add 4 other scenarios (70%, 80%, 90%
and 100%).
Finally, your Scenario Manager should be consistent with the
picture below:

Note: to see the result of a scenario, select the scenario and click on the Show button. Excel will change the
value of cell C4 accordingly for you to see the corresponding result on the sheet.

Scenario Summary
To easily compare the results of these scenarios, execute the
following steps.
1. Click the Summary button in the Scenario
Manager.

Page 38 of 219
2. Next, select cell D10 (total profit) for the
result cell and click on OK.

Result:

Conclusion: if you sell 70% for the highest price, you obtain a total profit of $4100, if you sell 80% for the
highest price, you obtain a total profit of $4400, etc. That's how easy what-if analysis in Excel can be.

6.02 Goal Seek


What if you want to know how many books you need to sell for the
highest price, to obtain a total profit of exactly $4700? You can
use Excel's Goal Seek feature to find the answer.
1. On the Data tab, click What-If Analysis, Goal
Seek.

Page 39 of 219
The Goal Seek dialog box appears.
2. Select cell D10.
3. Click in the 'To value' box and type 4700.
4. Click in the 'By changing cell' box and
select cell C4.
5. Click OK.

Result. You need to sell 90% of the books for the highest price to
obtain a total profit of exactly $4700.

Page 40 of 219
6.03 Solver

What is optimization?
To understand Optimization, you must first define the parameters of the optimization. There are many real
situations where the normal process of computing would not suffice to arrive at a certain optimum value.
For example, in a feed formulation problem, where the “feed” would consist of various ingredients, with each
ingredient contributing to the nutrient content by a % of, and the same costing X amount per required
ingredient.
The problem would be how to find the optimum nutrient content, at the optimum cost!
Below are some examples of how this optimization could also be applied:
 How can a large drug company determine the monthly product mix at their Indianapolis plant that
maximizes corporate profitability?
 If Microsoft produces Xbox consoles at three locations, how can they minimize the cost of meeting
demand for Xbox consoles?
 What price for Xbox consoles and games will maximize profit from Xbox sales?
 Microsoft would like to undertake 20 strategic initiatives that will tie up money and skilled
programmers for the next five years. They do not have enough resources to undertake all 20
projects. Which projects should they undertake?
 How do bookmakers find the best set of "ratings" for NFL teams to set accurate point spreads?
 How should I allocate my retirement portfolio among high-tech stocks, value stocks, bonds, cash,
and gold?

Page 41 of 219
In all these situations, we want to find the best way to do something. More formally, we want to find the
values of certain cells in a spreadsheet that optimize (maximize or minimize) a certain objective. The Excel
Solver tool helps you answer optimization problems.

Defining an optimization model


An optimization model has three parts: the target cell, the changing cells, and the constraints.

TARGET CELL
The target cell represents the objective or goal. We want to either minimize or maximize the target cell. In
the example of a drug company's product mix, the plant manager would presumably want to maximize the
profitability of the plant during each month. The cell that measures profitability would be the target cell. The
target cells for each situation described at the beginning of the article are listed in the following table.

MODEL MAXIMIZE OR TARGET CELL


MINIMIZE
Drug company Maximize Monthly profit
product mix
Xbox shipping Minimize Distribution costs
Xbox pricing Maximize Profit from Xbox consoles and games
Microsoft project Maximize Net present value (NPV) contributed by
initiatives selected projects
NFL ratings Minimize Difference between scores predicted by
ratings and actual game scores
Retirement portfolio Minimize Riskiness of portfolio

Keep in mind that in some situations, you might have multiple target cells. For example, Microsoft might have
a secondary goal to maximize Xbox market share.

CHANGING CELLS
Changing cells are the spreadsheet cells that we can change or adjust to optimize the target cell. In the drug
company example, the plant manager can adjust the amount produced for each product during a month. The
cells in which these amounts are recorded are the changing cells in this model. CONSTRAINTS
Constraints are restrictions you place on the changing cells. In our product mix example, the product mix
can't use more of any available resource (for example, raw material and labor) than the amount of the
available resource. Also, we should not produce more of a product than people are willing to buy. In most
Solver models, there is an implicit constraint that all changing cells must be nonnegative. Remember that a
Solver model does not need not have any constraints. The following table lists the constraints for the
problems presented at the start of the chapter.

MODEL CONSTRAINTS
Drug company product Product mix uses no more resources than are available
mix Do not produce more of a product than can be sold
Xbox shipping Do not ship more units each month from a plant than plant capacity
Make sure that each customer receives the number of Xboxes they
need
Xbox pricing Prices can't be too far out of line with competitors’ prices
Microsoft project Projects selected can't use more money or skilled programmers
initiatives than are available

Page 42 of 219
NFL ratings None
Retirement portfolio Invest all our money somewhere (cash is a possibility)
Obtain an expected return of at least 10 percent on our investments

Installing and running Solver


To install Solver, click Add-Ins on the Tools menu, and then select the Solver Add-in check box. Click OK, and
Excel will install the Solver. Once the add-in is installed, you can run Solver by clicking Solver on
the Tools menu.
The following figure shows the Solver Parameters dialog box, in which you input the target cell, changing
cells, and constraints that apply to your optimization model.
NOTE You'll see how to do this in more detail in each of the Solver model articles listed in the See
also section of this article.

After you have input the target cell, changing cells, and constraints, what does Solver do? To answer this
question, you need some background in Solver terminology. Any specification of the changing cells that
satisfies the model's constraints is known as a feasible solution. For instance, in our product mix example, any
product mix that satisfies the following three conditions would be a feasible solution:
 Mix does not use more raw material and labor than is available.
 Mix produces no more of each product than is demanded.
 Amount produced of each product is nonnegative.
Essentially, Solver searches over all feasible solutions and finds the feasible solution that has the "best" target
cell value (the largest value for maximum optimization, the smallest for minimum optimization). Such a
solution is called an optimal solution. Some Solver models have no optimal solution and some have a unique
solution. Other Solver models have multiple (actually an infinite number of) optimal solutions.
The best way to understand how to use Solver is by looking at detailed examples. In the See also section of
this article, you can find links to additional articles that describe how to use the Solver to address several
important business (and nonbusiness) problems.

Solver
Excel includes a tool called solver that uses techniques from the operations research to find optimal solutions
for all kind of decision problems.

Load the Solver Add-in


To load the solver add-in, execute the following steps.
1. On the green File tab, click Options.

Page 43 of 219
2. Under Add-ins, select Solver Add-in and click
on the Go button.

3. Check Solver Add-in and click OK.

Page 44 of 219
4. You can find the Solver on the Data tab.

Formulate the Model


The model we are going to solve looks as follows in Excel.

Page 45 of 219
1. To formulate this linear programming model, answer the following
three questions.
a. What are the decisions to be made? For this problem, we need
Excel to find out how much to order of each product (bicycles,
mopeds and child seats).
b. What are the constraints on these decisions? The constrains here
are that the amount of capital and storage used by the products
cannot exceed the limited amount of capital and storage (resources)
available. For example, each bicycle uses 300 units of capital and
0.5 unit of storage.
c. What is the overall measure of performance for these decisions?
The overall measure of performance is the total profit of the three
products, so the objective is to maximize this quantity.
2. To make the model easier to
understand, name the following ranges.

Range Name Cells

UnitProfit C4:E4

OrderSize C12:E12

ResourcesUsed G7:G8

ResourcesAvailable I7:I8

TotalProfit I12

Page 46 of 219
3. Insert the following three SUMPRODUCT
functions.

Explanation: The amount of capital used equals the sumproduct of


the range C7:E7 and OrderSize. The amount of storage used equals
the sumproduct of the range C8:E8 and OrderSize. Total Profit
equals the sumproduct of UnitProfit and OrderSize.

Trial and Error


With this formulation, it becomes easy to analyze any trial
solution.
For example, if we order 20 bicycles, 40 mopeds and 100 child
seats, the total amount of resources used does not exceed the
amount of resources available. This solution has a total profit of
19000.

Page 47 of 219
It is not necessary to use trial and error. We shall describe next
how the Excel Solver can be used to quickly find the optimal
solution.

Solve the Model


To find the optimal solution, execute the following steps.
1. On the Data tab, click Solver.

Enter the solver parameters (read on). The


result should be consistent with the picture
below.

Page 48 of 219
You have the choice of typing the range names or clicking on the
cells in the spreadsheet.
2. Enter TotalProfit for the Objective.
3. Click Max.
4. Enter OrderSize for the Changing Variable
Cells.
5. Click Add to enter the following constraint.

Page 49 of 219
6. Check 'Make Unconstrained Variables Non-
Negative' and select 'Simplex LP'.
7. Finally, click Solve.
Result:

The optimal solution:

Page 50 of 219
Conclusion: it is optimal to order 94 bicycles and 54 mopeds. This
solution gives the maximum profit of 25600. This solution uses all
the resources available.

Exercises

Day 2 – Exercise 01 – Scenario Manager


Note: Please type the data as shown below in this document.
Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 2 - Exercise 01 – Scenario Manager –


V0N
Use Excel Scenarios to store several versions of the data in a worksheet. For example, when preparing an
annual budget, the Marketing and Finance departments may have different forecasts for sales.
You can store each department's forecast as a Scenario, print the scenarios separately, or compare them
side-by-side, with Summary Reports.
Important Note: The Scenario Summary and Scenario PivotTable Report are not linked to the Scenario data,
and they do not update if the Scenario data changes. Use these reports to compare the data, or print the
current status, and then delete the sheets, to prevent confusion.
There are instructions for creating Excel Scenarios here:

Excel Scenarios -- Create and Show

Page 51 of 219
Create a Scenario Summary
Although Excel scenarios can be complex, a simple example is used here. The annual budget forecasts from
both the Finance and Marketing departments have been entered, and stored as scenarios.
Warning: This is a static report that does not change if the Scenario data changes. Delete this report after
printing it, and create a new Summary when necessary.

To create a Scenario Summary:


On the Ribbon's Data tab, click What-If Analysis
Click the drop down arrow, and click Scenario
Manager

Click the Summary button


In the Scenario Summary dialog box, for Report
type, select Scenario Summary
Press the Tab key, to move to the Result cells
box
On the worksheet, click on cell B6. This is the
Profit cell, and it changes, based on the sales
and expense amounts.

Page 52 of 219
Click the OK button.
A Scenario Summary sheet is added to the
workbook
View the Scenario Summary
To compare the scenarios side by side, you can view the Scenario
Summary sheet that was created.
Select the Scenario Summary worksheet
To show or hide the details, click the + / -
buttons at the left side and top of the
worksheet
In this example, the scenario cells on the Budget sheet have been named, and those names appear on the
Scenario Summary sheet, making it easier to understand. For example, cell B1 is named Dept, and you can
see that name in cell C6 on the Scenario Summary sheet.
There is no option for formatting the Scenario Summary when you create it. You can change the formatting in
the completed report.

Page 53 of 219
Create a Scenario PivotTable Report
For a different view of the Scenario data, you can create a pivot
table report:
Warning: This is a static report that does not change if the
Scenario data changes. Delete this report after printing it, and
create a new Summary when necessary.
On the Ribbon's Data tab, click What-If Analysis
Click the drop down arrow, and click Scenario
Manager

Click the Summary button

Page 54 of 219
In the Scenario Summary dialog box, for Report
type, select Scenario PivotTable report
Press the Tab key, to move to the Result cells
box
On the worksheet, click on cell B6.This is the
Profit cell, and it changes, based on the sales
and expense amounts.

Click the OK button.


A Scenario PivotTable sheet is added to the workbook

Day 2 – Exercise 01 – Goal Seek


Note: Please type the data as shown below in this document.
Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 2 - Exercise 01 – Goal Seek – V0N


Goal Seek in Excel
Goal Seek is used to get a particular result when you're not too sure of the starting value. For example, if the
answer is 56, and the first number is 8, what is the second number? Is it 8 multiplied by 7, or 8 multiplied by
6? You can use Goal Seek to find out. We'll try that example to get you started, and then have a go at a more
practical example.

Create the following Excel spreadsheet

Page 55 of 219
In the spreadsheet above, we know that we want to multiply the
number in B1 by the number in B2. The number in cell B2 is the one
we're not too sure of. The answer is going in cell B3. Our answer
is wrong at the moment, because we has a Goal of 56. To use Goal
Seek to get the answer, try the following:
From the Excel menu bar, click on Data
Locate the Data Tools panel and the What if
Analysis item. From the What if Analysis menu,
select Goal Seek
The following dialogue box appears:

The first thing Excel is looking for is "Set cell". This is not
very well named. It means "Which cell contains the Formula that you
want Excel to use". For us, this is cell B3. We have the following
formula in B3:
= B1 * B2
So enter B3 into the "Set cell" box, if it's not
already in there.
The "To value" box means "What answer are you looking for"? For us,
this is 56. So just type 56 into the "To value" box
The "By Changing Cell" is the part you're not sure of. Excel will
be changing this part. For us, it was cell B2. We're weren't sure
which number, when multiplied by 8, gave the answer 56. So type B2
into the box.

Page 56 of 219
You Goal Seek dialogue box should look like ours below:

Click OK and Excel will tell you if it has found


a solution:

Click OK again, because Excel has found the


answer. Your new spreadsheet will look like this
one:

As you can see, Excel has changed cell B2 and replace the 6 with a
7 - the correct answer.
We'll now try a more practical example.

Goal Seek Number Two


Consider this problem:
Your business has a modest profit of 25,000. You've set yourself a
new profit Goal of 35,000. At the moment, you're selling 1000 items

Page 57 of 219
at 25 each. Assume that you'll still sell 1000 items. The question
is, to hit your new profit of 35,000, by how much do you have to
raise your prices?
Create the spreadsheet below, and we'll find a
solution with Goal Seek.

The spreadsheet is split into two: Current Sales, and Future Sales.
We'll be changing the Future Sales with Goal Seek. But for now,
enter the same values for both sections. The formula to enter for
B4 is this:
= B2 * B3
And the formula to enter for E4 is this:
= E2 * E3
The current Price Per Item is 25.00. We want to change this with
Goal Seek, because our prices will be going up to hit our new
profits of 35,000. So try this:
From the Excel menu bar, click on Data
Locate the Data Tools panel and the What if
Analysis item. From the What if Analysis menu,
select Goal Seek
The following dialogue box appears:

Page 58 of 219
For "Set cell", enter E4. This is where the formula is. The "To
Value" is what we want our new profits to be. So enter 35000. The
"By changing cell" is the part we're not sure of. For us, this was
the price each item needs to be increased by. This was coming from
cell E3 on our spreadsheet. So enter E3 in the "By changing cell"
box. Your Goal Seek dialogue box should now look like this:

Click OK to see if Excel can find an answer:

Excel is now telling that it has indeed found a solution. Click OK


to see the new version of the spreadsheet:

Our new Price Per Item is 35. Excel has also changed the Profits
cell to 35 000.

Day 2 – Exercise 02 – Data Table


Note: Please type the data as shown below in this document.

Page 59 of 219
Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 2 - Exercise 02 – Data Table – V0N


Data Table with 1 variable and Data Table with two variables
Introduction
The Data Table enables you to quickly create a table that compares the results, if you were to change the
values of one or two variables. You could do the same by doing it manually and create your own table. But
this technique is much faster.

Before we start
To follow this exercise, you can use the file excel2013-2013-exercises.xlsx on the demonstrations files web
page.

Select the Data table worksheet.

The =PMT () function used in the B8 cell


will inform you of the amount you would need to pay every two weeks (
or 26 payments per year) if you took a mortgage of 200 000 $ at a rate
of 5.5% for 25 years.

This model uses the PMT (Rate per period; number of payments; present value) function to determine the
amount of each payment. In this analysis, the payments are due every two weeks or 26 times per year. The
B9 cell will show the yearly. The B10 cell will show the grand total of all the payments. As the present values
indicates, a 200 000 $ mortgage under these conditions will have to pay 368 241, 29 $ to repay the loan.
Data Table with one variable
The first example will consist in determining the amount of each payment and the yearly total if you were to
change the interest rate. You could create this table by hand. But this is much faster. Also, the changes that
you make to this table will immediately be recalculated.

Page 60 of 219
The rates that will be calculated by the table are on the first row. The first column has the cell addresses of
the results you want to see. In this case, the B8 and B9 cell addresses represent the value of each payment
and the yearly total. The table with the values to compare and the cell addresses that you want to see the
results in must be prepared before you can use the Data Table command.
The data from the picture above will be used to create the table.
It will, fill in the blanks by using the values of the first row
and place them one at the time in the B4 cell. That cell represents
the rate used to determine the payments. It will then find what the
values for the B8 and B9 cells are and place them in the table.
Here are the instructions to createthe table.

Select the range of cells from A13 to G15.


Select the Data tab.
Press the What-If Analysis button and select
Data Table option.
In the Row input cell box, select the B4 cell.
Press the OK button.
This means that the Data Table will use the values from the range's
first row and place them, in the B4 cell. It will places the values
from 5% to 7,5% and see what happens to the cells you want to see
how they changed. In this case, those are the cells B8 and B9 as
included in the first column of the range of cells.

Page 61 of 219
You can see the results generated by the Data Table. For this example, if the B4 cell is equal to 5%, the B8 cell
will have a value of 539,32 $. The same rule will apply for every other cell in the table. You can now see, how
easily and quickly a Data Table can be generated to help you compare many possibilities. This example only
created a table when one value is changed. The next example of the Data Table will demonstrate how to
create a table when you need to modify two variables.
Data Table with 2 variables
You read how to create a Data Table with one variable and tried it out. You can use the same technique to
create another Data table that can change two variables. But the preparations to create this table are a little
different from the previous example.
The next exercise consists to find what will be the grand total of all payments depending on the interest
rate and the number of years that you take to pay your mortgage (B10). For this case, you need to create a
Data Table with two variables. You must place the values you want to check in the first row and the first
column of the Data Table. The first row will contain the interest rate. The first column will contain the
number of years you want to pay your mortgage.

At the intersection of the first row and the


first column of the table, enter the cell
address you want to view the result in. For this
example, enter the formula =B10.
Because of the structure of a data table with two variables, you
can only see the result of a single cell. You need to create other

Page 62 of 219
Data tables with the same values for the first row and the first
column. There is another option available but it will be explained
later.
Select the range of cells from A19 to G23.
Select the Data tab.
Press the What-If Analysis button and select
the Data Table option.

In the Row input cell box, select the B4 cell.


In the Column input cell box, select
the B5 cell.
Press the OK button.

The result of the table above shows you, that the faster you pay
down your mortgage, the less interest you have to pay. Your grand
total will be less.
As mentioned before, this type of Data Table can only show the
result of one cell at the time. But you can change the cell address
to view other results.
Change the content of the A19 cell
from =B10 to =B8.

Page 63 of 219
The Data Table will recalculate itself in an instant. You can now see your payments in the time frame you
chose with the best rate you can have. Paying faster also means bigger payments... Day 2 – Exercise
03 – Solver
Note: Please type the data as shown below in this document.
Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 2 - Exercise 03 – Set 01 – V0N


Solver an Example
Excel 2013: The Solver is an add-in. If the Solver button does not appear on the Data tab toolbar, click the
Microsoft Office Button, Excel Options, Add-Ins category. Be sure the Manage: box is set to Excel Add-ins and
then click the Go button. Then select the Solver Add-In check box, and click OK to install it. Click Yes to
confirm that you want to install the Solver add-in.
If you have problems installing Solver, use the campus lab computers.
As an example of the kind of problem that the Solver can tackle,
imagine you are planning an advertising campaign for a new product.
Your total budget for print advertising is $12,000,000; you want to
expose your ads at least 800 million times to potential readers;
and you’ve decided to place ads in six publications—we’ll call them
Publication A through Publication F. Each publication reaches a
different number of readers and charges a different rate per page.
Your job is to reach the readership target at the lowest possible
cost with the following additional constraints:
At least six advertisements should run in each publication.
No more than a third of your advertising dollars should be spent on
any one publication.
Your total cost for placing advertisements in Pub3 and Pub4 must
not exceed $7,500,000.
Set up a spreadsheet like this – type in the labels, values for
columns B, C, D and the constraints at the bottom:

Page 64 of 219
Formulas for Columns E-G
Use formulas in cells E2:E7 to find the total
cost (Cost per Ad times Number of ads placed).
Use formulas in cells F2:F7 to find the Percent
of Total for each publication. The formula for
F2 should be =E2/$E$8 . The cell reference E2
is a relative cell reference, while the $E$8 is
an absolute cell reference. Watch the TIP on
these types of cell references and understand
the difference.
Use formulas in cells G2:G7 to find the Total
Audience (Audience per Ad times Number of ads
placed).
Use formulas for cells E8, E9, and G8.
Solver

Page 65 of 219
You might be able to work
out this problem yourself
by substituting many
alternatives for the values
currently in D2:D7, keeping
your eye on the
constraints, and noting the
impact of your changes on
the total expenditure
figure in E8. In fact,
that’s what the Solver does
for you—but it does it more
rapidly, and it uses some analytic techniques to home in on the
optimal solution without having to try every conceivable
alternative.
Click the Solver button on the Data tab to
display the dialog box shown here. To complete
this dialog box, you must give the Solver three
sets of information: your objective, or target
(minimizing total expenditure); your variables,
or changing
cells (the
number of
advertisements
you will place
in each
publication);
and your
constraints
(the
conditions
summarized at the bottom of the worksheet.
Stating the objective
In the Set Target Cell box, you indicate the goal, or target, that
you want Solver to achieve. In this example, you want to minimize
your total cost—the value in cell E8—so you specify your objective
by typing E8 in the Set Target Cell box (or by clicking the cell).
In this example, because you want the Solver to set your target
cell to its lowest possible value, you select Min as the Equal To
option.

Page 66 of 219
Specifying variable cells
The next step is to tell the
Solver which cells to change.
In our example, the cells whose
values can be adjusted are
those that specify the number
of advertisements to be placed
in each publication, or cells
D2:D7. Alternatively, you can
click Guess, and the Solver
proposes the appropriate
changing cells based on the
target cell you specified.

Specifying constraints
The last step is to
specify constraints. To
specify a constraint,
click Add in the Solver
Parameters dialog box,
and complete the Add
Constraint dialog box.
Figure 3 shows how you
express the constraint
that total advertising expenditures (the value in cell E8 in the
model) must be less than or equal to the total budget (the value in
cell G11).
Add the rest of the constraints – when you are done – your Solver
dialog box should look like this:
Be sure you understand each
constraint:
$D$2:$D$7>=$G$15
All the values in
cells D2:D7 must
be greater than
or equal to the
value in G15 (6)

$E$8<=$G$11 Total
cost (E8) has to
be less than or equal to the total budget (G11)

Page 67 of 219
$E$9<=$G$12 Total cost of publications C & D
(E9) has to be less than or equal to $7,500,000
(G12)

$F$2:$F$7<=$G$14 All the values in F2:F7 must


be less than or equal to the value in G14
(33.3%)

$G$8 >=$G$13 Total Audience (G8) must be greater


than or equal to the minimum total audience of
800 million (G13)
After completing the Solver dialog box, click Solve. In the
advertisement campaign example, the Solver succeeds in finding an
optimal value for the objective cell while meeting all the
constraints and displays a Solver Results dialog box. The values
displayed on your worksheet at that time result in the optimal
solution. You can leave these values in the worksheet by selecting
the Keep Solver Solution option and clicking OK, or you can restore
the original values by selecting the Restore Original Values option
and clicking OK (or by clicking Cancel). You also have the option
of assigning the solution values to a named scenario.

Specifying integer constraints


Notice that in our results,
the Solver arrived at 53.3
for the number of ads placed
in Publication D.
Unfortunately, because it’s
not possible to run three-
tenths of an advertisement,
the solution isn’t
practical.

Page 68 of 219
To stipulate that your ad-placement variables be restricted to
whole numbers, start the Solver, and click the Add button in the
Solver Parameters dialog box. In the Add Constraint dialog box, you
select the cell reference that holds your ad placement numbers—
D2:D7. Click the list in the middle of the dialog box, and select
int. The Solver inserts the word
integer in the Constraint box, as
shown in below. Click OK to return
to the Solver Parameters dialog box.
Your finished solver box should look

like this
Your results should look like
this

NOTE: that when converting


numbers to integers, Excel
effectively rounds down;
the decimal portion of the
number is truncated. The
integer solution shows that
by placing 53 ads in
Publication D, you can buy
an additional ad in
Publication E. For a very
small increase in budget,
you can reach an additional
1.8 million readers.
(**Another constraint that is often needed / useful in Solver
solutions is to limit results to positive values only – forcing
them be greater than or equal to zero**)

Page 69 of 219
When your solver is complete &
correct – name the scenario.
Use your last name as the
Scenario Name.
Click SAVE SCENARIO & then
enter your last name as the
Scenario name. You can view
scenarios by clicking on Data &
then ‘what-if analysis’

For more complex trial-and-error


analysis the Excel Solver should be used. Unlike Goal Seek, the
Solver can alter a formula not just to produce a set value, but to
maximize or minimize the result. More than one changing cell can be
specified in order to increase the number of possibilities, and
constraints can be built in to restrict the analysis to operate
only under specific conditions.
The basis for using the Solver is usually to alter many figures to
produce the optimum result for a single formula. This could mean,
for example, altering price figures to maximize profits. It could
mean adjusting expenditure to minimize costs etc. Whatever the
case, the variable figures to be adjusted must have an influence,
either directly or indirectly, on the overall result, that is to
say, the changing cells must affect the formula to be optimized. Up
to 200 changing cells can be included in the solving process, and
up to 100 constraints can be built in to limit the Solver's
results.

Day 2 – Exercise 03 – Solver – Sensitivity Analysis

Set 1 - Distinguish business rule violations


Note: Please type the data as shown below in this document.
Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 2 - Exercise 03 – Set 02 – V0N


Sensitivity analysis gives you insight in how the optimal solution changes when you change the
coefficients of the model. After the solver found a solution, you can create a sensitivity report.

Page 70 of 219
1. Before you click OK, select Sensitivity from
the Reports section.

Below you can find the optimal solution and the sensitivity report.

Page 71 of 219
It is optimal to order 94 bicycles and 54 mopeds. This solution
gives the maximum profit of 25600. This solution uses all the
resources available (93000 units of capital and 101 units of
storage). You can find these numbers in the Final Value column.

Reduced Cost
The reduced costs tell us how much the objective coefficients (unit
profits) can be increased or decreased before the optimal solution
changes. If we increase the unit profit of Child Seats with 20 or
more units, the optimal solution changes.
1. At a unit profit of 69, it's still optimal to
order 94 bicycles and 54 mopeds. Below you can
find the optimal solution.

Page 72 of 219
2. At a unit profit of 71, the optimal solution
changes.

Conclusion: it is only profitable to order child seats if you can


sell them for at least 70 units.

Shadow Price
The shadow prices tell us how much the optimal solution can be
increased or decreased if we change the right hand side values
(resources available) with one unit.

Page 73 of 219
1. With 101 units of storage available, the
total profit is 25600. Below you can find the
optimal solution.

2. With 102 units of storage available, the


total profit is 25700 (+100).

Note: with a shadow price of 100 for this resource, this is


according to our expectations. This shadow price is only valid
between 101 - 23,5 and 101 + 54 (see sensitivity report).

Page 74 of 219
Day 2 – Exercise 03 – Solver – Capital Investment

Set 1 - Distinguish business rule violations


Note: Please type the data as shown below in this document.
Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 2 - Exercise 03 – Set 03 – V0N


Capital Investment
Use the solver in Excel to find the combination of capital investments that maximizes the total profit.

Formulate the Model


The model we are going to solve looks as follows in Excel.

1. To formulate this binary integer programming


(BIP) model, answer the following three
questions.
a. What are the decisions to be made? For this problem, we need
Excel to find out which capital investments to make (Yes=1, No=0).
b. What are the constraints on these decisions? First, the amount
of capital used by the investments cannot exceed the limited amount
of capital available (50). For example, investment One uses 12
units of capital. Second, only investment One or investment Two can
be made. Third, only investment Three or investment Four can be

Page 75 of 219
made. Fourth, investment Six and investment Seven can only be made
if investment Five is made.
c. What is the overall measure of performance for these decisions?
The overall measure of performance is the total profit of the
capital investments made, so the objective is to maximize this
quantity.
2. To make the model easier to
understand, name the following ranges.
Range Name Cells

Profit C5:I5

YesNo C13:I13

TotalProfit M13

3. Insert the following five SUMPRODUCT


functions.

Explanation: cell K7 (the amount of capital used) equals


the sumproduct of the range C7:I7 and YesNo, cell K8 equals the
sumproduct of the range C8:I8 and YesNo, etc. Total Profit equals
the sumproduct of Profit and YesNo.

Trial and Error

Page 76 of 219
With this formulation, it becomes easy to analyze any trial
solution.
1. For example, if we make investment One and
Two, the second constraint is violated.

2. For example, if we make investment Six and


Seven, without making investment Five, the
fourth constraint is violated.

Page 77 of 219
3. However, it's OK to make investment One, Five
and Six. All constraints are satisfied.

It is not necessary to use trial and error. We shall describe next


how the Excel Solver can be used to quickly find the optimal
solution.

Solve the Model

Page 78 of 219
To find the optimal solution, execute the following steps.
1. On the Data tab, click Solver.

Note: can't find the Solver button? Click here to load the Solver
add-in.
Enter the solver parameters (read on). The
result should be consistent with the picture
below.

Page 79 of 219
2. Enter TotalProfit for the Objective.
3. Click Max.
4. Enter YesNo for the Changing Variable Cells.
5. Click Add to enter the following constraint.

Page 80 of 219
6. Click Add to enter the following constraint.

Note: binary variables are either 0 or 1.


7. Check 'Make Unconstrained Variables Non-
Negative' and select 'Simplex LP'.
8. Finally, click Solve.
Result:

Page 81 of 219
The optimal solution:

Conclusion: it is optimal to make investments Two, Four, Five and


Seven. This solution gives the maximum profit of 146. All
constraints are satisfied.

Page 82 of 219
Day 2 – Exercise 03 – Solver – Assignment Problem

Note: Please type the data as shown below in this document.


Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 2 - Exercise 03 – Set 04 – V0N


Use the solver in Excel to find the assignment of persons to tasks
that minimizes the total cost.

Formulate the Model


The model we are going to solve looks as follows in Excel.

1. To formulate this assignment problem, answer


the following three questions.
a. What are the decisions to be made? For this problem, we need
Excel to find out which person to assign to which task (Yes=1,
No=0). For example, if we assign Person 1 to Task 1, cell C10
equals 1. If not, cell C10 equals 0.
b. What are the constraints on these decisions? Each person can
only do one task (Supply=1). Each task only needs one person
(Demand=1).

Page 83 of 219
c. What is the overall measure of performance for these decisions?
The overall measure of performance is the total cost of the
assignment, so the objective is to minimize this quantity.
2. To make the model easier to
understand, name the following ranges.
Range Name Cells

Cost C4:E6

Assignment C10:E12

PersonsAssigned C14:E14

Demand C16:E16

TasksAssigned G10:G12

Supply I10:I12

TotalCost I16

3. Insert the following functions.

Page 84 of 219
Explanation: The SUM functions calculate the number of tasks
assigned to a person and the number of persons assigned to a task.
Total Cost equals the sumproduct of Cost and Assignment.

Trial and Error


With this formulation, it becomes easy to analyze any trial
solution.
For example, if we assign Person 1 to Task 1, Person 2 to task 2
and Person 3 to Task 3, Tasks Assigned equals Supply and Persons
Assigned equals Demand. This solution has a total cost of 147.

It is not necessary to use trial and error. We shall describe next


how the Excel Solver can be used to quickly find the optimal
solution.

Solve the Model


To find the optimal solution, execute the following steps.
1. On the Data tab, click Solver.

Page 85 of 219
Note: can't find the Solver button? Click here to load the Solver
add-in.
Enter the solver parameters (read on). The
result should be consistent with the picture
below.

Page 86 of 219
You have the choice of typing the range names or clicking on the
cells in the spreadsheet.
2. Enter TotalCost for the Objective.
3. Click Min.
4. Enter Assignment for the Changing Variable
Cells.
5. Click Add to enter the following constraint.

Page 87 of 219
Note: binary variables are either 0 or 1.
6. Click Add to enter the following constraint.

7. Click Add to enter the following constraint.

8. Check 'Make Unconstrained Variables Non-


Negative' and select 'Simplex LP'.
9. Finally, click Solve.
Result:

Page 88 of 219
The optimal solution:

Page 89 of 219
Conclusion: it is optimal to assign Person 1 to task 2, Person 2 to
Task 3 and Person 3 to Task 1. This solution gives the minimum cost
of 129. All constraints are satisfied.

6.04 Data Table


Instead of creating different scenarios you can create a data table to quickly try out different values for
formulas. You can create a one variable data table or a two variable data table.
Assume you own a book store and have 100 books in storage. You sell
a certain % for the highest price of $50 and a certain % for the
lower price of $20. If you sell 60% for the highest price, cell D10
below calculates a total profit of 60 * $50 + 40 * $20 = $3800.

One Variable Data Table


To create a one variable data table, execute the following steps.
1. Select cell B12 and type =D10 (refer to the
total profit cell).
2. Type the different percentages in column A.
3. Select the range A12:B17.
We are going to calculate the total profit if you sell 60% for the
highest price, 70% for the highest price, etc.

4. On the Data tab, click What-If Analysis and


select Data Table from the list.

Page 90 of 219
5. Click in the 'Column input cell' box (the
percentages are in a column) and select cell C4.
We select cell C4 because the percentages refer to cell C4 (% sold
for the highest price). Together with the formula in cell B12,
Excel now knows that it should replace cell C4 with 60% to
calculate the total profit, replace cell C4 with 70% to calculate
the total profit, etc.

Note: this is a one variable data table so we leave the Row input
cell blank.
6. Click OK.
Result.

Page 91 of 219
Conclusion: if you sell 60% for the highest price, you obtain a
total profit of $3800, if you sell 70% for the highest price, you
obtain a total profit of $4100, etc.
Note: the formula bar indicates that the cells contain an array
formula. Therefore, you cannot delete a single result. To delete
the results, select the range B13:B17 and press Delete.

Two Variable Data Table


To create a two variable data table, execute the following steps.
1. Select cell A12 and type =D10 (refer to the
total profit cell).
2. Type the different unit profits (highest
price) in row 12.
3. Type the different percentages in column A.
4. Select the range A12:D17.
We are going to calculate the total profit for the different
combinations of 'unit profit (highest price)' and '% sold for the
highest price'.

Page 92 of 219
5. On the Data tab, click What-If Analysis and
select Data Table from the list.

6. Click in the 'Row input cell' box (the unit


profits are in a row) and select cell D7.

Page 93 of 219
7. Click in the 'Column input cell' box (the
percentages are in a column) and select cell C4.
We select cell D7 because the unit profits refer to cell D7. We
select cell C4 because the percentages refer to cell C4. Together
with the formula in cell A12, Excel now knows that it should
replace cell D7 with $50 and cell C4 with 60% to calculate the
total profit, replace cell D7 with $50 and cell C4 with 70% to
calculate the total profit, etc.

8. Click OK.
Result.

Page 94 of 219
Conclusion: if you sell 60% for the highest price, at a unit profit
of $50, you obtain a total profit of $3800, if you sell 80% for the
highest price, at a unit profit of $60, you obtain a total profit
of $5200, etc.
Note: the formula bar indicates that the cells contain an array
formula. Therefore, you cannot delete a single result. To delete
the results, select the range B13:D17 and press Delete.

7.00 Advanced Functions


(Reference TCO ID – A.4.12)

Here are some popular and advanced functions of MS Excel:

7.01 Using Excel 2013 Functions

Open a new blank workbook.


Click on the Formulas tab and you will see a
group called the Function Library. As you can
see this is divided into different function
categories.

Clicking on the AutoSum icon will display


commonly used functions, such as Sum and
Average.

Page 95 of 219
Clicking on the Insert Function icon will
display the Insert Function dialog box, which
allows you to easily locate a particular
function.

To see a list of all available functions, click on the down arrow


next to the Select a category section of the Insert Function dialog
box, and select All.

Page 96 of 219
You can then scroll down the entire list of functions.

7.02 Getting help about using a particular function


As an example we will get help about using the IF function. Click
on the Formula tab and from within the Function Library click on
the Logical button. From the drop down menu displayed select the
IF command.

This will display the Functions Arguments dialog box for the IF
function.

Page 97 of 219
Click on help on this function (bottom-left within the dialog box).
This will display help relevant to that function.

Take a quick look at the help available and the close the dialog
box.

7.03 Using date and time functions: TODAY

Open a workbook called Date and time functions.


Click on cell B3. To have Excel automatically
insert the current date into a cell, select the
cell and enter the following into the cell:
=TODAY()
Press the Enter key and the current date will be
displayed within the cell.

Page 98 of 219
7.04 Using date and time functions: DAY
Click on cell B4 and enter the following
function:
=DAY(B3)
Press the Enter key. You will notice that the
current day of the month is displayed:

7.05 Using date and time functions: MONTH


Click on cell B5 and enter the following
function:
=MONTH(B3)
Press the Enter key. You will notice that the
current month is displayed:

Page 99 of 219
7.06 Using date and time functions: YEAR
Click on cell B6 and enter the following
function:
=YEAR(B3)
Press the Enter key. You will see that the
current year will be displayed:

Save your changes and close the workbook.

7.07 Using mathematical functions: SUMIF


Open a workbook called Function SUMIF.
The SUMIF sums the values within a range that meet specified
criteria. In this case, we want to see the total value of all
sales, where the salesperson earned over 6000 a month.
First, we would need to click on the cell in
which we wish the result of our function to be
displayed, in this case cell C14.
Click on the Formulas tab and from within the
Function Library group click on the Math & Trig
button. From the drop down list displayed,
click on the SUMIF function, as illustrated.

Page 100 of 219


The Function Arguments dialog box is displayed.

To select the range you would use the mouse to


select the cells D4:D10.
In the Criteria section of the dialog box, we
would enter >6000. The screen should now
resemble the illustration:

Page 101 of 219


Clicking on the OK button would display the
result within the active cell. You can see the
actual function displayed in the Function Bar:

Save your changes and close the workbook.

7.08 Using statistical functions: COUNTA


Open a workbook called Function COUNTA. This
sheet contains examination results and grades.
Click on cell C9 and enter the following
function to count each of the three letter-grade
types:
=COUNTA(C5:C8)
The result will appear in cell C9. Use the
normal drag and drop techniques to copy this
function to cells D9 and E9. The results should
be as illustrated:

You can drag this function across the range


D9:E9 and the table will look like this

Page 102 of 219


Save your changes and close the workbook

7.09 Using statistical functions: COUNTIF


Open a workbook called Function COUNTIF. This
sheet contains examination results and grades.
Click on cell C9 and enter the following
function to count the number of "A's" each
student earned:
=COUNTIF(C5:C8,"A")
Use the normal drag and drop techniques to copy
this function to cells D9 and E9. The results
should be as illustrated:

Save your changes and close the workbook.

7.10 Using text functions: CONCATENATE


Open a workbook called Function CONCATENATE.

Page 103 of 219


Click on cell B5.
Click on the Formulas tab and from within the
Function Library group click on the Text button.
From the drop down list displayed, click on the
CONCATENATE function, as illustrated.

The Function Arguments dialog box is displayed.

Click within the Text1 section of the dialog box


and then click on cell A1.
You will see the following.

Page 104 of 219


Click within the Text2 section of the dialog box
and then click on cell A2.
Click within the Text3 section of the dialog box
and then click on cell A3.
Click within the Text4 section of the dialog box
and then click on cell A4.
Your dialog box should now look like this.

Click on the OK button, and you will the see


result as illustrated:

Save your changes and close the workbook.

7.11 Using financial functions: FV


Open a workbook called Function FV. This
contains data relating to the following
scenario. Let's say we have a lump sum of 2500
and we want to invest this in a bank that is

Page 105 of 219


paying out 6% interest. We will invest a
further 150 monthly. We want to know how much
the account will be worth after three years. We
can enter the following information into a
worksheet.
Click on cell C10.
Click on the Formulas tab and from within the
Function Library group click on the Financial
button. From the drop down list displayed,
click on the FV function, as illustrated.

The Function Arguments dialog box will be displayed.

Click within the Rate section of the dialog box


and then click on cell C3.
Click within the Nper section of the dialog box
and then click on cell C4.
Click within the Pmt section of the dialog box
and then click on cell C5. Then prefix the
value with a minus sign (-).

Page 106 of 219


Click within the Pv section of the dialog box
and then click on cell C6. Then prefix the
value with a minus sign (-).
Click within the Type section of the dialog box
and then click on cell C7.

When you click on the OK button your will see the result as
illustrated:

Save your changes and close the workbook.

7.12 Using financial functions: NPV


Open a workbook called Function NPV. This
contains data relating to the following
scenario. We are going to make an investment

Page 107 of 219


that will pay 4000 up front and in the following
two years will provide an annual income of 3000
and 2000. We will assume an annual discount
rate of 5% percent.
Click on cell B11.
Click on the Formulas tab and from within the
Function Library group click on the Financial
button. From the drop down list displayed,
click on the NPV function, as illustrated

The Function Arguments dialog box will be


displayed

Click on the Rate section of the dialog box, and then click on cell C4.
Click on the Value 1 section of the dialog box, and then click on cell C5, as this is an upfront, initial payout,
prefix this amount with a minus (-) sign.
Click on the Value 2 section of the dialog box,
and then click on cell C6.
Click on the Value 3 section of the dialog box,
and then click on cell C7:

Page 108 of 219


When you click on the OK the result should be as illustrated:

NOTE: If you do not get a result as below, it may be because you forgot the minus symbol in front of C5.

Save your changes and close the workbook.

7.13 Using financial functions: PMT


Open a workbook called Function PMT. This sheet contains data for the following scenario. We wish to
calculate the monthly repayments for a loan of 6,000, spread over 10 months, assuming an annual rate of 5%.
Click on cell C7.
Click on the Formulas tab and from within the Function Library group click on the Financial button. From the
drop down list displayed, click on the PMT function, as illustrated.

Page 109 of 219


The Function Arguments dialog box will be displayed.

Click within the Rate section of the dialog box and enter C4/12.
Click within the Nper section of the dialog box and then click on cell C5.
Click within the Pv section of the dialog box and then click on cell C6:

When you click on the OK button the result will be as illustrated:

Page 110 of 219


Save your changes and close the workbook.

7.14 Using financial functions: PV


Open a workbook called Function PV. In this example, we are considering purchasing an insurance annuity
that will payout 500 at the end of every month for the next 25 years. We will assume a rate of 5% (i.e. x
0.05).
Click on cell C7.
Click on the Formulas tab and from within the Function Library group click on the Financial button. From the
drop down list displayed, click on the PV function, as illustrated.

The Function Arguments dialog box will be displayed:

Click in the Rate section of the dialog box and enter C4/12 (to calculate the rate on a monthly basis).
Click in the Nper section of the dialog box and enter C5*12 (to account for the length of the term in months).
Click in the Pmt section of the dialog box and then click on cell C6:

Page 111 of 219


When you click on the OK button, you will see the following:

Save your changes and close the workbook.

7.15 Using financial functions: RATE


Open a workbook called Function RATE. In this example, we will calculate the rate for a loan of 7,000, spread
over 4 years (48 months), with a monthly payment of 150.
Click on cell A7.
Click on the Formulas tab and from within the Function Library group click on the Financial button. From the
drop down list displayed, click on the RATE function, as illustrated.

T
he Function Arguments dialog box will be displayed

Page 112 of 219


Click in the Nper section of the dialog box and then click on cell A3.
Click in the Pmt section of the dialog box and then click on cell A4. Then prefix the value with a minus sign (-
).
Click in the Pv section of the dialog box and then click on cell A5.

Click on the OK button, you will see the following:

Save your changes and close the workbook.

7.16 Using logical functions: IF


Open a workbook called Function IF. This example calculates a discount based on order quantity. The
company offers its customers a 5% discount if the value of an order is above 500. There is no discount if the
value is below 500. A way of simplifying the above statement is as follows: If the sale value is greater than
500 give 5% discount otherwise give no discount.
Click on cell C3.

Page 113 of 219


Click on the Formulas tab and from within the Function Library group click on the Logical button. From the
drop down list displayed, click on the IF function, as illustrated.

The Function Arguments dialog box will be displayed:

Click on the Logical_test section of the dialog box and enter B3>500.
Click on the Value_if_true section of the dialog box and enter B3*5%.
Click on the Value_if_false section of the dialog box and enter 0.

When you press the OK button, you will see the following. As the value in cell B3 is less than 500, the
discount value is zero:

Page 114 of 219


Copy the formula in cell C3 to cells C4:C6 using the typical fill handle technique.
You will see the following. As you can see where the sales value is above 500, a discount value is displayed:

Save your changes and close the workbook.

7.17 Using logical functions: AND


Open a workbook called Function AND. In this example, we have the results of a two-part examination;
candidates must achieve over 50 in EACH part of the examination.
Click on cell D3 and enter the following:
=IF(AND(B3>50,C3>50),$F$2,$F$3)
When you press Enter you should see the following, as the candidate scored less than 50 in the first part of
the examinations:

Copy the formula in cell D3 to the cell range D4:D6 and you will see the following:

Page 115 of 219


The only person to get more than 50 in both parts of the examination is Anora, who is the only person to pass
the entire examination.
Save your changes and close the workbook.

7.18 Using logical functions: OR


Open a workbook called Function OR. In this example, we have the results of a two-part examination and
candidates can pass the entire examination by achieving a score of > 75 in either part of the examination.
Click on cell D3 and enter the following:
=IF(OR(B3>75,C3>75),$F$2,$F$3)
When you press Enter you should see the following, as the candidate scored less than 75 in both parts of the
examination:

Copy the formula in cell D3 to the cell range D4:D6 and you will see the following:

The only person to get less than 75 marks in either part of the examination is Elliot, who is the only person to
not pass the entire examination.
Save your changes and close the workbook.

7.19 Using logical functions: ISERROR

Page 116 of 219


In the example shown below, we have a formula in cell B2 as follows:
=D2/E2
However, cell E2 is empty and this generates an error:

We have used the ISERROR function in cell B6 to pick up the fact that this cell contains an error, using the
syntax:
=ISERROR(B2)

7.20 Using database functions: DSUM


Open a workbook called Function DSUM. In this example, we will sum up the total value of all sales people
whose sales are above their sales targets.
Click on cell D14.
Click on the Formulas tab and from within the Function Library group click on the Insert Function button.

This will display the Insert Function dialog box. Use the Category control to display Database functions.

Select the DSUM function and click on the OK button.

Page 117 of 219


The Function Arguments dialog box will be displayed:

Click on the Database section of the dialog box and then select cells A7:C12.
Click on the Field section of the dialog box and enter “Sales”.
Click on the Criteria section of the dialog box and then select cells B4:B5.

Click on the OK button to see the results illustrated:

Page 118 of 219


Save your changes and close the workbook.

7.21 Using CORRELATION function


Correlation
The correlation coefficient (a value between -1 and +1) tells you how strongly two variables are related to
each other. We can use the CORREL function or the Analysis Toolpak add-in in Excel to find the correlation
coefficient between two variables.
A correlation coefficient of +1 indicates a perfect positive
correlation. As variable X increases, variable Y increases. As
variable X decreases, variable Y decreases.

A correlation coefficient of -1 indicates a perfect negative


correlation. As variable X increases, variable Z decreases. As
variable X decreases, variable Z increases.

Page 119 of 219


A correlation coefficient near 0 indicates no correlation.
To use the Analysis Toolpak add-in in Excel to quickly generate
correlation coefficients between multiple variables, execute the
following steps.
1. On the Data tab, click Data Analysis.

Note: can't find the Data Analysis button? Click here to load
the Analysis ToolPak add-in.
2. Select Correlation and click OK.

Page 120 of 219


3. For example, select the range A1:C6 as the
Input Range.

4. Check Labels in first row.


5. Select cell A9 as the Output Range.
6. Click OK.

Page 121 of 219


Result.

Conclusion: variables A and C are positively correlated (0.91).


Variables A and B are not correlated (0.19). Variables B and C are
also not correlated (0.11) . You can verify these conclusions by
looking at the graph.

7.22 Using nested functions


Open a workbook called Nested functions.
This workbook contains sales results for the North and South region, along with total and average sales
results for the two regions.

Page 122 of 219


The average sales target of a region is 25 (per sales person).
We want to be able to sum up only those sales of the region that is above the sales target.

Click on cell B13 and enter the following


formula:
=IF(AVERAGE(B3:B6)>25,SUM(B3:B6),0)
Once you have entered this formula, use drag and drop to copy this formula to cell C13. The result should be
as illustrated.
Sales for the North region exceeded their targets, (i.e. the average is over 25) so in cell B13 you see the sales
summed, while in cell C13, you see a 0 figure as sales for the South region were below an average of 25:

Save your changes and close the workbook.

7.23 Using the INDIRECT function


The INDIRECT function returns the reference specified by a text string.

1. For example, the INDIRECT function below


reduces to =INDIRECT("C2"), =C2, 5

Do we really need the INDIRECT function for this? Yes. Below you can find the result without using the
INDIRECT function.

Page 123 of 219


2. For example, the function below reduces to
=SUM(INDIRECT("E3:E6")), =SUM(E3:E6), 27

Note: the & operator is used to join strings. Border for illustration
only.
3. For example, the function below reduces to
=AVERAGE(Scores), 9

Note: the named range Scores refers to the range C2:C4.

7.24 Using the OFFSET Function


The Offset function in Excel returns a cell or range of cells that is a specified number of rows and columns
from a cell or range of cells.

1. The Offset function below returns the cell


that is 3 rows below and 2 columns to the right

Page 124 of 219


of cell A2. The Offset function returns a cell
because the height and width are both set to 1.

Result:

Page 125 of 219


2. The Offset function below returns the 1 x 2
range that is 5 rows below and 1 column to the
right of cell A2. The SUM function calculates
the sum of this range.

Result:

Page 126 of 219


Note: to return a range (without calculating the sum), select a
range of the same size before you insert the Offset function. If
you want to return a cell or range of cells that is a specified
number of rows above or columns to the left, enter a negative
number.

7.25 Using the HLOOKUP


In a similar way, you can use the HLOOKUP (Horizontal lookup) function.

Page 127 of 219


7.26 Using the CHOOSE Function

The CHOOSE function returns a value from a list of values, based on a position number.

Note: Boat found at position 3.

7.27 Using the LOOKUP Function


This Excel learning activities explains how to use the Excel LOOKUP function with syntax and examples.

DESCRIPTION
The Microsoft Excel LOOKUP function returns a value from a range (one row or one column) or from an array.
There are 2 different syntaxes for the LOOKUP function:

LOOKUP FUNCTION (SYNTAX #1)


In Syntax #1, the LOOKUP function searches for value in the lookup_range and returns the value in
the result_range that is in the same position.
The syntax for the Microsoft Excel LOOKUP function is:
LOOKUP( value, lookup_range, [result_range] )

Page 128 of 219


Parameters or Arguments
value is the value to search for in the lookup_range.
lookup_range is a single row or single column of data that is sorted in ascending order. The LOOKUP
function searches for value in this range.
result_range is optional. It is a single row or single column of data that is the same size as the lookup_range.
The LOOKUP functionsearches for the value in the lookup_range and returns the value from the same
position in the result_range. If this parameter is omitted, the LOOKUP function will return the first column of
data.
NOTE
 If the LOOKUP function can not find an exact match, it chooses the largest value in the lookup_range that
is less than or equal to the value.
 If the value is smaller than all of the values in the lookup_range, then the LOOKUP function will return
#N/A.
 If the values in the LOOKUP_range are not sorted in ascending order, the LOOKUP function will return the
incorrect value.
TYPE OF EXCEL FUNCTION
The LOOKUP function can be used in Microsoft Excel as the following type of function:
 Worksheet function (WS)

EXAMPLE (AS WORKSHEET FUNCTION)


Let's look at some Excel LOOKUP function examples and explore how to use the LOOKUP function as a
worksheet function in Microsoft Excel:

Page 129 of 219


Based on the spreadsheet above, the following Excel LOOKUP examples would return:

=LOOKUP(10251, A1:A6, B1:B6)


Result: "Pears"

=LOOKUP(10251, A1:A6)
Result: 10251

=LOOKUP(10246, A1:A6, B1:B6)


Result: #N/A

=LOOKUP(10248, A1:A6, B1:B6)


Result: "Apples"

LOOKUP FUNCTION (SYNTAX #2)


In Syntax #2, the LOOKUP function searches for the value in the first row or column of the array and returns
the corresponding value in the last row or column of the array.
The syntax for the Microsoft Excel LOOKUP function is:
LOOKUP( value, array )
Parameters or Arguments
value is the value to search for in the array. The values must be in ascending order.
array is an array of values that contains both the values to search for and return.
NOTE
 If the LOOKUP can not find an exact match, it chooses the largest value in the array that is less than or
equal to the value.
 If the value is smaller than all of the values in the array, then the LOOKUP function will return #N/A.
 If the values in the array are not sorted in ascending order, the LOOKUP function will return the incorrect
value.

TYPE OF EXCEL FUNCTION


The LOOKUP function can be used in Microsoft Excel as the following type of function:
 Worksheet function (WS)
EXAMPLE (AS WORKSHEET FUNCTION)
Let's look at some Excel LOOKUP function examples and explore how to use the LOOKUP function as a
worksheet function in Microsoft Excel:

=LOOKUP("T", {"s","t","u","v";10,11,12,13})
Result: 11

Page 130 of 219


=LOOKUP("Tech on the Net",
{"s","t","u","v";10,11,12,13})
Result: 11

=LOOKUP("t", {"s","t","u","v";"a","b","c","d"})
Result: "b"

=LOOKUP("r", {"s","t","u","v";"a","b","c","d"})
Result: #N/A

=LOOKUP(2, {1,2,3,4;511,512,513,514})
Result: 512

FREQUENTLY ASKED QUESTIONS


Question: In Microsoft Excel, I have a table of data in cells A2:D5. I've tried to create a simple LOOKUP to find
CB2 in the data, but it always returns 0. What am I doing wrong?
Answer: Using the LOOKUP function can sometimes be a bit tricky so let's look at an example. Below we have
a spreadsheet with the data that you described.

Page 131 of 219


In cell F1, we've placed the following formula:

=LOOKUP("CB2",A2:A5,D2:D5)
And yes, even though CB2 exists in the data, the LOOKUP function returns 0.
Now, let's explain what is happening. At first, it looks like the function isn't finding CB2 in the list, but in fact,
it is finding something else. Let's fill in the empty cells in D3:D5 to explain better.

If we place the values TEST1, TEST2, TEST3 in cells D3, D4, D5, respectively, we can see that the LOOKUP
function is in fact returning the value TEST2. So we ask ourselves, when we are looking up CB2 in the data and
CB2 exists in the data, why is it returning the value for CB19? Good question. The LOOKUP function assumes
that the data in column A is sorted in ascending order.
If you look closer at column A, it is not in fact sorted in ascending order. If we quickly sorted column A, it
would look like this:

Page 132 of 219


Now the LOOKUP function correctly returns 3A when it is looking up CB2 in the data.
To avoid these sorting problems with your data, we recommend using VLOOKUP function in this case. Let's
show you how we would do this. If we changed our formula below (but left our data in column A in the
original sort order):

Page 133 of 219


The following VLOOKUP formula would return the correct value of 3A.

=VLOOKUP("CB2",$A$2:$D$5,4,FALSE)
The VLOOKUP function does not require us to have the data sorted in ascending order since we used FALSE as
the last parameter - which means that it is looking for an exact match.

7.28 Using SUB-TOTAL


This Excel tutorial explains how to use the Excel SUBTOTAL function with syntax and examples.

DESCRIPTION
The Microsoft Excel SUBTOTAL function returns the subtotal of the numbers in a column in a list or database.

SYNTAX
The syntax for the Microsoft Excel SUBTOTAL function is:

SUBTOTAL( method, range1, [range2, ... range_n]


)
Parameters or Arguments

method is type of subtotal to create, but be


careful which method you select. method can be a
value ranging from 1 - 11 that includes hidden
values or a value ranging from 101 - 111 that
ignores hidden values in the calculation.
method can be a value ranging from 1 - 11 as
follows: (which includes hidden values in the
calculation)

Explanation
Value
(includes hidden values)

1 AVERAGE

2 COUNT

3 COUNTA

4 MAX

5 MIN

Page 134 of 219


6 PRODUCT

7 STDEV

8 STDEVP

9 SUM

10 VAR

11 VARP

method can be a value ranging from 101 - 111 as


follows: (which ignores hidden values in the
calculation)

Explanation
Value
(ignores hidden values)

101 AVERAGE

102 COUNT

103 COUNTA

104 MAX

105 MIN

106 PRODUCT

107 STDEV

108 STDEVP

109 SUM

110 VAR

Page 135 of 219


111 VARP

range1, range2, ... range_n are the ranges of


cells that you want to subtotal.
TYPE OF EXCEL FUNCTION
The SUBTOTAL function can be used in Microsoft Excel as the following type of function:
 Worksheet function (WS)

EXAMPLE (AS WORKSHEET FUNCTION)


Let's look at some Excel SUBTOTAL function examples and explore how to use the SUBTOTAL function as a
worksheet function in Microsoft Excel:

Based on the spreadsheet above, the following Excel SUBTOTAL examples would return:

=SUBTOTAL(1, D2:D5)
Result: 22.3925

=SUBTOTAL(2, D2:D5)
Result: 4

=SUBTOTAL(3, D2:D5)

Page 136 of 219


Result: 4

=SUBTOTAL(4, D2:D5)
Result: 35.88

=SUBTOTAL(5, D2:D5)
Result: 7

=SUBTOTAL(6, D2:D5)
Result: 136191.51

=SUBTOTAL(7, D2:D5)
Result: 11.91825316

=SUBTOTAL(8, D2:D5)
Result: 10.32151

=SUBTOTAL(9, D2:D5)
Result: 89.57

=SUBTOTAL(10, D2:D5)
Result: 142.0447583

=SUBTOTAL(11, D2:D5)
Result: 106.5335688

7.29 Summary of Using Various Look-Ups in MS Excel


One of the most common tasks in Excel is the process of looking up specific values within a data set. In a
simple database, this process would be completed by writing a “query” for a specified “table.” For Excel, you
complete this task by using a “formula,” with specific syntax rules, and reference a “data range.” If your
intent is to someday become an Excel power user, you will need a solid understanding of all the lookup
formulas available to you. Below is list of the most popular Excel lookup formulas with tutorials linked as
reference.

Page 137 of 219


VLOOKUP – Vlookup is the oldest and most often
used lookup formula in Excel. The first time
you write a Vlookup formula is a milestone in
your Excel learning. However, after using this
formula for a significant amount of time, you
will definitely begin to see its flaws.
HLOOKUP – The Horizontal Lookup is essentially a
Vlookup transposed; instead of trying to find
your lookup values vertically in columns, you
are now looking horizontally through rows. The
syntaxes of Vlookup and Hlookup are essentially
the same; the difference is that with Hlookup
you must reference horizontal ranges.
INDEX MATCH – Index Match is the best way to
perform a simple vertical lookup. (The second
half of this article will explain why) Because
the lookup method is actually a combination of
two different formulas, the syntax for writing
an Index Match can initially be difficult to
remember. However, after frequent use, it’s
really not a difficult formula to memorize; I
currently use Index Match almost exclusively for
all of my lookups.
VLOOKUP MATCH – By combining the Vlookup and
Match functions of Excel, the originally static
column reference within the Vlookup formula
becomes dynamic; now whenever you insert a
column into your data set, your column reference
will update so that you still have the same
return value.
VLOOKUP HLOOKUP – When you combine Excel’s basic
vertical and horizontal lookup formulas, you end
up with a matrix lookup. A matrix lookup
implies that you are looking up both a vertical
and horizontal value to pinpoint the return
value you want to pull.

Page 138 of 219


OFFSET MATCH MATCH – The offset function in
Excel is a very versatile formula that, when
combined with the Match formula, can replicate
the functionality of a lookup. The key
difference in using the offset function is that
you must start your formula with a single cell
reference, typically the top left hand corner of
your data range. The Match formula then allows
you to move vertically and horizontally from
that reference point to find your return value.
INDEX MATCH MATCH – Adding an additional Match
formula to the basic Index Match formula
enhances it so that you can perform a matrix
lookup. It is essentially the same formula as
Index Match, except your column reference is now
dynamic.
Based on these descriptions, it’s easy to tell that not all lookup formulas are created equal and some are only
suited for specific situations. Below is a table comparing the capabilities and benefits of each lookup method.

The first step in deciding which lookup formula to use is to determine what kind of lookup you need to
perform. There are essentially three lookup types:

Vertical Lookup

Page 139 of 219


A vertical lookup is the process of defining a lookup value, finding that lookup value vertically on the left
hand column of your data set, and then returning the value in the columnrelated to your lookup value.

Horizontal Lookup
A horizontal lookup is very similar to a vertical lookup, except that after you define the lookup value, you
must find your lookup value horizontally across the top row of your data set, and then return the value in
the row related to your lookup value.

Page 140 of 219


Two things to note about horizontal lookups:
1. As you can see in the table above, Index Match covers both vertical and horizontal lookups. You can
utilize Index Match as an Hlookup formula simply by referencing ranges that are horizontal rather than
vertical.
2. If you have any familiarity with building databases and understand database theory, you’ll know that
setting up data keys horizontally rather than vertically is not a good idea. However, you will likely run into
situations where you have to deal with horizontally arranged data, especially in situations involving date
keys. Unless you are unable to manipulate the data, one of the best practices in Excel is to copy
horizontally arranged data and transpose it. That way you can use a vertical lookup formula rather than a
horizontal one.

Matrix Lookup
As mentioned before, a matrix lookup implies that you are looking up both a vertical and horizontal value to
pinpoint the return value you want to pull. This is essentially the process of establishing coordinates on a grid
to locate a value, except in this case the coordinates are lookup values.

Page 141 of 219


Once you understand the type of lookup you need to perform, there are a number of factors you should to
consider to determine which formula works best in your situation.

Simplicity

Page 142 of 219


While definitely not the most important issue, the simplicity of your formula is something you should
consider when writing a lookup. While it may be easy for you to memorize and write a complex lookup
formula by yourself, the next person who inherits your work may have more difficulty. If you’re only
performing a simple lookup and you intend to hand off your work to someone who isn’t spreadsheet
proficient, it makes sense to just use the simple Vlookup and Hlookup formulas. For the uninitiated, these
formulas are much more intuitive and easier to learn.
Because these formulas are built into Excel, when you begin typing a Vlookup or Hlookup formula, the
program prompts you with the required syntax for each input you need to make. Every other formula on the
list is a combination of formulas; therefore you have to make custom adjustments to your inputs without
Excel to guide you along the way.

Insert Column Immunity


In any complex data analysis, you’re bound to have the need to make changes after you write a lookup
formula. Your work is rarely done the minute you finish writing your lookup. This becomes a complication
because not all Excel lookup formulas are immune to changes made in your data set.
The most common issue that occurs is when you insert a column (or in the case of Hlookup a row) into your
data set. Because the column reference in the basic Vlookup formula is fixed, inserting a column changes
your return value. The same issue occurs when you delete a column in your data set.
The basic way to solve this problem is with the Match formula. As you can see in the table above, most
formulas that are insertion immune have this component as part of the lookup. Within these lookup
formulas, the Match formula acts as a column reference. Because the Match formula returns a value based
on the relative position of your lookup, the Match formula makes your column reference
dynamic. Therefore, even if you insert a column into your data set, your column reference will automatically
update so your return the value stays the same.

Right to Left Lookup


The Vlookup formula requires that your lookup key be on the left hand side of your data set. If you are using
this formula, you can’t really make exceptions to this rule. Because the lookup key is on the far left hand
side, you can only look up values that are to the right of that lookup key. Therefore, a basic Vlookup is only
capable of a “left-to-right” lookup.
The key problem with this limitation occurs when you are trying to create lookup keys for your data set. For
example, let’s say you have two fields: first name and last name. You decide that you want to create a new
lookup key by concatenating these two fields. To utilize this new key with Vlookup, you must insert the
concatenated field to the left hand side of your data set. This process shifts your entire data set to the right
and can become problematic if you have other formulas that are referencing this data.
When you are appending lookup keys to a data set, it’s much easier to add them to the right of your data set
rather than the left. After appending your lookup keys to the right, the Index Match formulas allow you to
perform a “right-to-left” lookup.

Processing Need
Processing need is something people rarely consider when writing lookup formulas. Whenever you write
a Vlookup formula that references a large data set, it requires processing power from Excel to calculate the
formula. If you’re writing a single formula, you won’t notice a difference between referencing a large data
set and a small one. However, if you happen to be building a huge Excel file with thousands of lookup values,
processing need becomes a factor.
This is one area where the Index Match and Offset formulas have an advantage. Because these formulas
don’t reference the entire data set to perform the lookup calculation, they require less processing power

Page 143 of 219


from Excel. Additionally, if you’re using an Excel overlay tool such as Crystal Xcelsius, it makes sense to
prioritize lookup formulas that have low processing requirements.

7.30 Using the SUMIFS Function


To sum cells based on multiple criteria (for example, blue and green), use the following SUMIFS function (first
argument is the range to sum).

General note: in a similar way, you can use the AVERAGEIF and
AVERAGEIFS function to average cells based on one or multiple
criteria.
As everyone knows, Microsoft Excel provides an array of functions to perform various calculations with data.
A few articles ago, we explored COUNTIF and COUNTIFS, which are designed for counting cells based on a
single condition and several conditions, respectively. Last week we covered Excel SUMIF that adds values
meeting the specified criteria. Now it's time to go over the plural version of SUMIF - Excel SUMIFS that allows
summing values by multiple criteria.
Those who are familiar with the SUMIF function might think that converting it to SUMIFS takes just an extra
"S" and a few additional criteria. This would seem quite logical... but "logical" it's not always the case when
dealing with Microsoft : )
 SUMIF function - syntax & usage
 SUMIFS function - syntax & usage
 How to use SUMIFS in Excel (AND logic)
 Excel SUMIF with multiple criteria (OR logic)
 Excel SUMIFS with multiple OR conditions
 Using Excel SUM in array formulas
Excel SUMIF function - syntax & usage

SUMIF(range, criteria, [sum_range])


 range - the range of cells to be evaluated by your criteria, required.
 criteria - the condition that must be met, required.
 sum_range - the cells to sum if the condition is met, optional.

Page 144 of 219


As you see, the syntax of the Excel SUMIF function allows for one condition only. And still, we say that Excel
SUMIF can be used to sum values with multiple criteria. How can that be? By adding the results of several
SUMIF functions and by using SUMIF formulas with array criteria, as demonstrated in the examples that
follow.

Excel SUMIFS function - syntax & usage


You use SUMIFS in Excel to find a conditional sum of values based on multiple criteria. The SUMIFS function
was introduced in Excel 2007, so you can use it in all modern versions of Excel 2013, 2010 and 2007.
Compared to SUMIF, the SUMIFS syntax is a little bit more complex:

SUMIFS(sum_range, criteria_range1,
criteria1,[criteria_range2, criteria2],...)
The first 3 arguments are mandatory, additional ranges and their associated criteria are optional.

sum_range - one or more cells to sum, required.


This can be a single cell, a range of cells or a
named range. Only cells with numbers are summed;
blank and text values are ignored.
criteria_range1 - the first range to be
evaluated by the associated criteria, required.
criteria1 - the first condition that must be
met, required. You can supply the criteria in
the form of a number, logical expression, cell
reference, text or another Excel function. For
example you can use criteria such as 10, ">=10",
A1, "cherries" or TODAY().
criteria_range2, criteria2, ... - these are
additional ranges and criteria associated with
them, optional. You can use up to 127
range/criteria pairs in SUMIFS formulas.
Important! The SUMIFS function works with AND logic, meaning that
each cell in the sum_rangeargument is summed only if all of the
specified criteria are true for that cell.
And now, let's have a look at the Excel SUMIFS formula with two conditions. Suppose, you have a table listing
the consignments of fruit from different suppliers. You have the fruit names in column A, suppliers' names in
column B, and quantity in column C. What you want is to find out a sum of amounts relating to a given fruit

Page 145 of 219


and supplier, e.g. all apples supplied by Pete.

When you're learning something new, it's always a good idea to start with simple things. So, to begin with,
let's define all the arguments for our SUMIFS formula:

sum_range - C2:C9
criteria_range1 - A2:A9
criteria1 - "apples"
criteria_range2 - B2:B9
criteria2 - "Pete"
Now assemble the above parameters, and you will get the following SUMIFS formula:

=SUMIFS(C2:C9, A2:A9, "apples", B2:B9, "Pete")

To refine the formula further, you can replace the text criteria "apples" and "Pete" with cell references. In this
case, you won't have to change the formula to calculate the quantity of other fruit from a different supplier:

Page 146 of 219


=SUMIFS(C2:C9, A2:A9, F1, B2:B9, F2)
Using SUMIFS and SUMIF in Excel - things to remember
Since the aim of this tutorial is to cover all possible ways to sum values by several conditions, we will discuss
formula examples with both functions - Excel SUMIFS and SUMIF with multiple criteria. To use them correctly,
you need to clearly understand what these two functions have in common and in what way they are
different.
While the common part is clear - similar destination and parameters - the differences are not so obvious,
though very essential.

1. The order of arguments


In Excel SUMIF and SUMIFS functions, the order of arguments is different. In particular, sum_range is the 1st
parameter in SUMIFS, but it is 3rd in SUMIF.
At first sight, it may seem that Microsoft deliberately complicates the learning curve for its users. However,
upon a closer look, you will see the reasoning behind it. The point is that sum_range is optional in SUMIF. If
you omit it, no problem, your SUMIF formula will sum values in the range (first parameter).
In SUMIFS, the sum_range is very important and obligatory, and that is why it comes first. Probably Microsoft
guys thought that after adding the 10th or 100th range / criteria pair, someone might forget to specify the
range to sum : )
Wrapping up, if you are copying and editing these functions, make sure you put the parameters in the right
order.

2. The size of sum_range and criteria_range arguments


In the SUMIF function, the sum_range argument does not necessarily have to be of the same size as the
range argument, as long as you have the top left cell right. In Excel SUMIFS, each criteria_range must contain
the same number of rows and columns as the sum_range parameter.
For example, =SUMIF(A2:A9,F1,C2:C18) will return the correct result because Excel considers only theupper
leftmost cell in the sum_range argument (C2 in this example, which is correct), and then includes as many
columns and rows as contained in the range argument.
The SUMIFS formula =SUMIFS(C2:C9, A2:A9, "apples", B2:B10, "Pete") will return the #VALUE! error because
criteria_range2 (B2:B10) does not match in size criteria_range1 (A2:A9) and sum_range (C2:C9).
Alright, enough strategy (i.e. theory), let's get into the tactics (i.e. formula examples : )
How to use SUMIFS in Excel - formula examples
A moment ago, we discussed a simple SUMIFS formula with two text criteria. In the same manner, you can
use Excel SUMIFS with multiple criteria expressed by numbers, dates, logical expressions, and other Excel
functions.

Example 1. Excel SUMIFS with comparison operators


In our fruit suppliers table, suppose, you want to sum all deliveries by Mike with Qty. 200 or more. To do this,
you use the comparison operator "greater than or equal to" (>=) in criteria2 and get the following SUMIFS
formula:

Page 147 of 219


=SUMIFS(C2:C9,B2:B9,"Mike",C2:C9,">=200")

Note. Please pay attention that in Excel SUMIFS formulas, logical


expressions with comparison operators should always be enclosed in
double quotes ("").
We covered all possible comparison operators in detail when discussing Excel SUMIF function, the same
operators can be used in SUMIFS criteria. For example, the following formula with return the sum of all
values in cells C2:C9 that are greater than or equal to 200 and less than or equal to 300.

=SUMIFS(C2:C9, C2:C9,">=200", C2:C9,"<=300")


Example 2. Using Excel SUMIFS with dates
In case you want to sum values with multiple criteria based on the current date, use the TODAY() function in
your SUMIFS criteria, as demonstrated below. The following formula sums values in column D if a
corresponding date in column C falls within the last 7 days, including today:

=SUMIFS(D2:D10, C2:C10,">="&TODAY()-7,
C2:C10,"<="&TODAY())

Page 148 of 219


Note. When you use another Excel function together with a logical operator in the criteria, you have to use
the ampersand (&) to concatenate a string, for example "<="&TODAY().
In a similar fashion, you can use the Excel SUMIF function to sum values in a given date range. For example,
the following SUMIFS formula adds the values in cells C2:C9 if a date in column B falls between 1-Oct-2014
and 31-Oct-2014, inclusive.

=SUMIFS(C2:C9, B2:B9, ">=10/1/2014", B2:B9,


"<=10/31/2014")
The same result can be achieved by calculating the difference of two SUMIF functions, as demonstrated in
this example - How to use SUMIF to sum values in a given date range. However, Excel SUMIFS is much easier
and more understandable, isn't it?

Example 3. Excel SUMIFS with blank and non-blank cells


When analyzing reports and other data, you may often need to sum values corresponding either to empty or
non-empty cells.

Criteria Description Formula Example

Sum values
corresponding to blank =SUMIFS(C2:C10, A2:A10, "=", B2:B10,
cells that contain "=")Sum values in cells C2:C10 if the
"="
absolutely nothing - no corresponding cells in columns A and B are
formula, no zero length empty.
string.

Blank Sum values


cells corresponding to
"visually" blank cells =SUMIFS(C2:C10, A2:A10, "", B2:B10, "")
that may contain empty
"" strings returned by Sum values in cells C2:C10 with the same
some other Excel conditions as the above formula, but
function (for example, includes empty strings.
cells with a formula like
="").

=SUMIFS(C2:C10, A2:A10, "<>", B2:B10,


Sum values
"<>")Sum values in cells C2:C10 if the
corresponding to non-
"<>" corresponding cells in columns A and B are
empty cells, including
not empty, including cells with empty
zero length strings.
Non- strings.
blank
cells SUM- Sum values =SUM(C2:C10) - SUMIFS(C2:C10, A2:A10,
SUMIF corresponding to non- "", B2:B10, "")
or empty cells, not
SUM / including zero length =SUM((C2:C10) *
LEN strings. (LEN(A2:A10)>0)*(LEN(B2:B10)>0))

Page 149 of 219


Sum values in cells C2:C10 if the
corresponding cells in columns A and B are
not empty, cells with zero length strings are
not included.

And now, let's see how you can use a SUMIFS formula with "blank" and "non-blank" criteria on real data.
Suppose, you have an order date in column B, delivery date in column C and Qty. in column D. How do you
find the total of products that have not been delivered yet? That is, you want to know the sum of values
corresponding to non-empty cells in column B and empty cells in column C.
The solution is to use the SUMIFS formula with 2 criteria:

=SUMIFS(D2:D10, B2:B10,"<>", C2:C10,"=")

Using Excel SUMIF with multiple OR criteria


As noted in the beginning of this tutorial, the SUMIFS function is designed with AND logic. But what if you
need to sum values with multiple OR criteria, i.e. when at least one of the conditions is met?

Example 1. SUMIF + SUMIF


The simplest solution is to sum the results returned by several SUMIF functions. For example, the following
formula demonstrates how to find the total of products delivered by Mike and John:

Page 150 of 219


=SUMIF(C2:C9,"Mike",D2:D9) + SUMIF(C2:C9,"John",D2:D9)

As you see, the first SUMIF function adds the quantities corresponding to "Mike", the other SUMIF function
returns the amounts relating to "John" and then you add these 2 numbers.

Example 2. SUM & SUMIF with an array argument


The above solution is very simple and may get the job done quickly when there are only a couple of criteria.
But a SUMIF + SUMIF formula may grow up enormously if you want to sum values with multiple OR
conditions. In this case, a better approach is using an array criteria argument in the SUMIF function. Let's
examine this approach now.
You can start by listing all of your conditions separated by commas and then enclose the resulting comma-
separated list in {curly brackets}, which is technically called an array.
In the previous example, if you want to sum the products delivered by John, Mike and Pete, your array
criteria will look like {"John","Mike","Pete"}. And the complete SUMIF function is SUMIF(C2:C9,
{"John","Mike","Pete"} ,D2:D9).
The array argument consisting of 3 values forces your SUMIF formula to return three separate results, but
since we write the formula in a single cell, it would return the first result only - i.e. the total of products
delivered by John. To get this array-criteria approach to work, you have to use one more little trick - enclose
your SUMIF formula in a SUM function, like this:

Page 151 of 219


=SUM(SUMIF(C2:C9, {"John","Mike","Pete"} ,
D2:D9))

As you see, an array criteria makes the formula much more compact compared to SUMIF + SUMIF, and lets
you add as many values as you like in the array.
This approach works with numbers as well as with text values. For instance, if instead of the suppliers' names
in column C, you had supplier IDs like 1, 2, 3 etc., then your SUMIF formula would look similar to this:

=SUM(SUMIF(C2:C9, {1,2,3} , D2:D9))


Unlike text values, numbers needn't be enclosed in double quotes in array arguments.
Example 3. SUMPRODUCT & SUMIF
In case, your preferred way is to list the criteria in some cells rather that specify them directly in the formula,
you can use SUMIF in conjunction with the SUMPRODUCT function that multiplies components in the given
arrays, and returns the sum of those products.

=SUMPRODUCT(SUMIF(C2:C9, G2:G4, D2:D9))


Where G2:G4 are the cells containing your criteria, the suppliers' names in our case, as illustrated in the
screenshot below.
But of course, nothing prevents you from listing the values in an array criteria of your SUMIF function if you
want to:

=SUMPRODUCT(SUMIF(C2:C9, {"Mike","John","Pete"},
D2:D9))

Page 152 of 219


The result returned by both formulas will be identical to what you see in the screenshot:

Excel SUMIFS with multiple OR criteria


If you want to conditionally sum values in Excel not simply with multiple OR conditions, but with several sets
of conditions, you will have to use SUMIFS instead of SUMIF. The formulas will be very similar to what we've
just discussed.
As usual, an example might help to illustrate the point better. In our table of fruit suppliers, let's add the
Delivery Date (column E) and find the total quantity delivered by Mike, John and Pete in October.

Example 1. SUMIFS + SUMIFS


The formula produced by this approach includes a lot of repetition and looks cumbersome, but it is easy to
understand and, most importantly, it works : )

=SUMIFS(D2:D9,C2:C9, "Mike",
E2:E9,">=10/1/2014", E2:E9, "<=10/31/2014") +
SUMIFS(D2:D9, C2:C9, "John", E2:E9,
">=10/1/2014", E2:E9, "<=10/31/2014") +
SUMIFS(D2:D9, C2:C9, "Pete", E2:E9,
">=10/1/2014" ,E2:E9, "<=10/31/2014")
As you see, you write a separate SUMIFS function for each of the suppliers and include two conditions - equal
to or greater than Oct-1 (">=10/1/2014",) and less than or equal to Oct 31 ("<=10/31/2014"), and then you

Page 153 of 219


sum the results.

Example 2. SUM & SUMIFS with an array argument


I've tried to explain the essence of this approach in the SUMIF example, so now we can simply copy that
formula, change the order of arguments (as you remember it is different in SUMIF and SUMIFS) and add
additional criteria. The resulting formula is more compact than SUMIFS + SUMIFS:

=SUM(SUMIFS(D2:D9,C2:C9, {"Mike", "John",


"Pete"}, E2:E9,">=10/1/2014", E2:E9,
"<=10/31/2014"))
The result returned by this formula is exactly the same as you see in the screenshot above.

Example 3. SUMPRODUCT & SUMIFS


As you remember, the SUMPRODUCT approach differs from the previous two in the way that you enter each
of your criteria in a separate cell rather that specify them directly in the formula. In case of several criteria
sets, the SUMPRODUCT function won't suffice and you will have to employ ISNUMBER and MATCH as well.
So, assuming that the Supplies Names are in cells H1:H3, Start Date is in cell H4 and End Date in cell H5, our
SUMPRODUCT formula takes the following shape:

Page 154 of 219


=SUMPRODUCT(--(E2:E9>=H4), --(E2:E9<=H5), --
(ISNUMBER(MATCH(C2:C9, H1:H3,0))), D2:D9)

Many people wonder why use double dash (--) in SUMPRODUCT formulas. The point is that Excel
SUMPRODUCT ignores all but numeric values, while the comparison operators in our formula return Boolean
values (TRUE / FALSE), which are non-numeric. To convert these Boolean values to 1's and 0's, you use the
double minus sign, which is technically called the double unary operator. The first unary coerces TRUE/FALSE
to -1/0, respectively. The second unary negates the values, i.e. reverses the sign, turning them into +1 and 0,
which the SUMPRODUCT function can understand.

7.31 Using the SUMPRODUCT Function


To calculate the sum of the products of corresponding numbers in one or more ranges, use Excel's powerful
SUMPRODUCT function.

1. For example, the SUMPRODUCT function below


calculates the total amount spent.

Note: the SUMPRODUCT function performs this calculation: (2 * 1000) + (4 * 250) + (4 * 100) + (2 * 50) =
3500.

Page 155 of 219


2. The ranges must have the same dimensions or
Excel will display the #VALUE! error.

3. The SUMPRODUCT function treats any entries


that are not numeric as if they were zeros.

7.32 Using the GETPIVOTDATA Function


Basic Description
The Excel GETPIVOTDATA function extracts data from an Excel Pivot Table
The format of the function is :
GETPIVOTDATA( data_field, pivot_table, [field1], [item1], [field2], [item2], ...)

where the arguments are as follows:

data_field - The pivot table data field (ie. the value(s) in the center of the table)
that you want to retrieve

Page 156 of 219


pivot_table - A reference to a range of cells within a Pivot Table (used to specify the
pivot table to be searched)

[field1], [item1], - Up to 126 optional pairs of fields and item names, (ie. The rows and
[field2], [item2], columns headers and individual categories) for which you want the
etc returned value.
Note: The item values should be entered as follows:
- Numbers can be entered directly
- Dates should be entered as date serial numbers or by using the date
function
- Times should be entered as decimals or by using the time function
- Text values should be entered in quotations

Note that, if the requested fields are not visible in the specified
Pivot Table, the Getpivotdata function returns the #REF! error.
The easiest way to input the Getpivotdata function is simply to type "=" into a cell and then click on the Pivot
Table value that you want to return. Excel automatically inserts the Getpivotdata function into the active cell.

Getpivotdata Function Examples


The examples below all refer to the following Pivot Table, which is located in columns A - G of the current
Excel Worksheet.

Page 157 of 219


=GETPIVOTDATA( "Invoice Amount", $A$2, "Date",
"Jan" )
- Returns the value $357,520, which is the value of the Invoice Amount Total for all of the Date field, "Jan".

=GETPIVOTDATA( "Invoice Amount", $A$2, "Date",


"Feb", "Item Details", "IPod" )
- Returns the value $23,940, which is the value of the Invoice Amount Total for the Date field, "Feb" and the
Item Details field, "IPod".

=GETPIVOTDATA( "Invoice Amount", $A$2, "Date",


"Feb", "Item Details", "IPod", "Salesperson",
"Kevin" )
- Returns the value $7,920, which is the value of the Invoice Amount Total for the Date field, "Feb", the Item
Details field, "IPod", and the Salesperson field "Kevin".

=GETPIVOTDATA( "Invoice Amount", $A$2, "Item


Details", "IPod", "Salesperson", "Kevin" )
- Returns the Excel #REF! error as the Pivot Table doesn't show the totals for the Salesperson "Kevin".

7.33 Using the DAVERAGE Function


This Excel tutorial explains how to use the Excel DAVERAGE function with syntax and examples.

DESCRIPTION
The Microsoft Excel DAVERAGE function averages all numbers in a column in a list or database, based on a
given criteria.

SYNTAX
The syntax for the Microsoft Excel DAVERAGE function is:
DAVERAGE( range, field, criteria )
Parameters or Arguments
range is the range of cells that you want to apply the criteria against.
field is the column to average the values. You can either specify the numerical position of the column in the
list or the column label in double quotation marks.
criteria is the range of cells that contains your criteria.

APPLIES TO
The DAVERAGE function can be used in the following versions of Microsoft Excel:
 Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

TYPE OF EXCEL FUNCTION


The DAVERAGE function can be used in Microsoft Excel as the following type of function:

Page 158 of 219


 Worksheet function (WS)

EXAMPLE (AS WORKSHEET FUNCTION)


Let's look at some Excel DAVERAGE function examples and explore how to use the DAVERAGE function as a
worksheet function in Microsoft Excel:

Based on the spreadsheet above, the following Excel DAVERAGE examples would return:

=DAVERAGE(A4:D8, "Unit Cost", A1:B2)


Result: 3.995

=DAVERAGE(A4:D8, 3, A1:B2)
Result: 3.995

=DAVERAGE(A4:D8, "Quantity", A1:A2)


Result: 6.666667

=DAVERAGE(A4:D8, 2, A1:A2)
Result: 6.666667

Using Named Ranges


You can also use a named range in the DAVERAGE function. For example, we've created a named range
called orders that refers to Sheet1!$A$4:$D$8.

Page 159 of 219


Then we've entered the following data in Excel:

Based on the spreadsheet above, the following Excel DAVERAGE examples would return:

=DAVERAGE(orders, "Total Cost", A1:B2)


Result: 30.44

=DAVERAGE(orders, 4, A1:B2)
Result: 30.44
To view named ranges: Under the Insert menu, select Name > Define.

Page 160 of 219


7.34 Using the DCOUNT function
This Excel tutorial explains how to use the Excel DCOUNT function with syntax and examples.

DESCRIPTION
The Microsoft Excel DCOUNT function returns the number of cells in a column or database that contains
numerc values and meets a given criteria.

SYNTAX
The syntax for the Microsoft Excel DCOUNT function is:
DCOUNT( range, [field], criteria )
Parameters or Arguments
range is the range of cells that you want to apply the criteria against.
field is optional. It is the column to count the numeric values that meet the criteria. You can either specify the
numerical position of the column in the list or the column label in double quotation marks. If field is omitted,
the DCOUNT function will count all records that match the criteria.
criteria is the range of cells that contains your criteria.

APPLIES TO
The DCOUNT function can be used in the following versions of Microsoft Excel:
 Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
TYPE OF EXCEL FUNCTION
The DCOUNT function can be used in Microsoft Excel as the following type of function:

Page 161 of 219


 Worksheet function (WS)

EXAMPLE (AS WORKSHEET FUNCTION)


Let's look at some Excel DCOUNT function examples and explore how to use the DCOUNT function as a
worksheet function in Microsoft Excel:

Based on the Excel spreadsheet above, you could use the DCOUNT function as follows:

=DCOUNT(A4:D8, "Unit Cost", A1:B2)


The DCOUNT function example above would return 2 because in the range A4:D8, there are 2 occurrences
that meet the conditions in A1:B2. Those conditions are OrderID > 10567 and Quantity >= 4. By specifying
"Unit Cost" as the second parameter, the DCOUNT function will only count the numeric values in the "Unit
Cost" column that meet the criteria. If a value in the "Unit Cost" column is not numeric, it will not be included
in the DCOUNT function calculations.
We could modify the DCOUNT function example as follows to specify the 3rd position in the range A4:D8
instead of "Unit Cost":

=DCOUNT(A4:D8, 3, A1:B2)
This would return the same results as the first example, except instead of using "Unit Cost" as the second
parameter we use 3 to specify the third position in the range A4:D8.
We could also omit the field parameter if we want to count all of the records that match the conditions in
A1:B2 (and we don't really care about counting numeric values in a particular field) as follows:

=DCOUNT(A4:D8, , A1:B2)
We could limit our criteria to only A1:A2 with the following DCOUNT function example:

=DCOUNT(A4:D8, , A1:A2)

Page 162 of 219


This example would return 3 because in the range A4:D8, there are 3 occurrences that meet the condition in
A1:A2. That condition is OrderID > 10567. Note: we aren't checking a particular field for numeric values so the
second parameter is omitted.
Using Named Ranges
You can also use a named range in the DCOUNT function. For example, we've created a named range
called orders that refers to Sheet1!$A$4:$D$8.

Then we've entered the following data in Excel:

Based on the Excel spreadsheet above, we could replace the range A4:D8 with the named range called orders.
Our DCOUNT function could be modified as follows:

=DCOUNT(orders, , A1:A2)
To view named ranges: Under the Insert menu, select Name > Define.

Page 163 of 219


7.35 Using the DCOUNTA Function
This Excel tutorial explains how to use the Excel DCOUNTA function with syntax and examples.

DESCRIPTION
The Microsoft Excel DCOUNTA function returns the number of cells in a column or database that contains
nonblank values and meets a given criteria.

SYNTAX
The syntax for the Microsoft Excel DCOUNTA function is:
DCOUNTA( range, field, criteria )
Parameters or Arguments
range is the range of cells that you want to apply the criteria against.
field is the column to count the values. You can either specify the numerical position of the column in the list
or the column label in double quotation marks.
criteria is the range of cells that contains your criteria.

APPLIES TO
The DCOUNTA function can be used in the following versions of Microsoft Excel:
 Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

TYPE OF EXCEL FUNCTION


The DCOUNTA function can be used in Microsoft Excel as the following type of function:

Page 164 of 219


 Worksheet function (WS)

EXAMPLE (AS WORKSHEET FUNCTION)


Let's look at some Excel DCOUNTA function examples and explore how to use the DCOUNTA function as a
worksheet function in Microsoft Excel:

Based on the spreadsheet above, the following Excel DCOUNTA examples would return:

=DCOUNTA(A4:D8, "Unit Cost", A1:B2)


Result: 2

=DCOUNTA(A4:D8, 3, A1:B2)
Result: 2

=DCOUNTA(A4:D8, "Quantity", A1:A2)


Result: 3

=DCOUNTA(A4:D8, 2, A1:A2)
Result: 3

Using Named Ranges


You can also use a named range in the DCOUNTA function. For example, we've created a named range
called orders that refers to Sheet1!$A$4:$D$8.

Page 165 of 219


Then we've entered the following data in Excel:

Based on the spreadsheet above, the following Excel DCOUNTA examples would return:

=DCOUNTA(orders, "Total Cost", A1:B2)


Result: 2

=DCOUNTA(orders, 4, A1:B2)
Result: 2
To view named ranges: Under the Insert menu, select Name > Define.

Page 166 of 219


7.36 Using the DGET Function
This Excel tutorial explains how to use the Excel DGET function with syntax and examples.

DESCRIPTION
The Microsoft Excel DGET function retrieves from a database a single record that matches a given criteria. It
is ia worksheet function (WS).

SYNTAX
The syntax for the Microsoft Excel DGET function is:
DGET( database, field, criteria )
Parameters or Arguments
database is the range of cells that you want to apply the criteria against.
field is the column to retrieve. You can either specify the numerical position of the column in the list or the
column label in double quotation marks.
criteria is the range of cells that contains your criteria.
NOTE
 If no record matches the criteria, the DGET function returns #VALUE! error.
 If more than one record matches the criteria, the DGET function returns #NUM! error.

APPLIES TO
The DGET function can be used in the following versions of Microsoft Excel:
 Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Page 167 of 219


TYPE OF EXCEL FUNCTION
The DGET function can be used in Microsoft Excel as the following type of function:
 Worksheet function (WS)

EXAMPLE (AS WORKSHEET FUNCTION)


Let's look at some Excel DGET function examples and explore how to use the DGET function as a worksheet
function in Microsoft Excel:

Based on the spreadsheet above, the following Excel DGET examples would return:

=DGET(A4:D8, "Unit Cost", A1:A2)


Result: $3.50

=DGET(A4:D8, 3, A1:A2)
Result: $3.50

=DGET(A4:D8, 4, A1:A2)
Result: $7.00

=DGET(A4:D8, "Total Cost", C1:C2)


Result: #VALUE!

Using Named Ranges


You can also use a named range in the DGET function. For example, we've created a named range
called orders that refers to Sheet1!$A$4:$D$8.

Page 168 of 219


Then we've entered the following data in Excel:

Based on the spreadsheet above, the following Excel DGET examples would return:

=DGET(orders, "Total Cost", A1:A2)


Result: $7.00

=DGET(orders, 4, A1:A2)
Result: $7.00
To view named ranges: Under the Insert menu, select Name > Define.

Page 169 of 219


7.37 Using the DSUM Function
This Excel tutorial explains how to use the Excel DSUM function with syntax and examples.

DESCRIPTION
The Microsoft Excel DSUM function sums the numbers in a column or database that meets a given criteria.

SYNTAX
The syntax for the Microsoft Excel DSUM function is:
DSUM( range, field, criteria )
Parameters or Arguments
range is the range of cells that you want to apply the criteria against.
field is the column to sum the values. You can either specify the numerical position of the column in the list or
the column label in double quotation marks.
criteria is the range of cells that contains your criteria.

APPLIES TO
The DSUM function can be used in the following versions of Microsoft Excel:
 Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

TYPE OF EXCEL FUNCTION


The DSUM function can be used in Microsoft Excel as the following type of function:
 Worksheet function (WS)

Page 170 of 219


EXAMPLE (AS WORKSHEET FUNCTION)
Let's look at some Excel DSUM function examples and explore how to use the DSUM function as a worksheet
function in Microsoft Excel:

Based on the spreadsheet above, the following Excel DSUM examples would return:

=DSUM(A4:D8, "Unit Cost", A1:B2)


Result: 7.99
Let's quickly explain why the DSUM function returns 7.99 in this example. The criteria for the DSUM
calculation is found in cells A1:B2. This means that only those records where the order number is greater than
10567 and Quantity is greater than equal to 4 will be included in the sum calculations.
So in the example above, only rows 6 and 8 meet those conditions. As a result, the DSUM adds together the
Unit Cost values in only rows 6 and 8 to return 7.99 (5.00 + 2.99).
Here are some more examples of the DSUM function:

=DSUM(A4:D8, 3, A1:B2)
Result: 7.99

=DSUM(A4:D8, "Quantity", A1:A2)


Result: 20

=DSUM(A4:D8, 2, A1:A2)
Result: 20

Using Named Ranges


You can also use a named range in the DSUM function. For example, we've created a named range
called orders that refers to Sheet1!$A$4:$D$8.

Page 171 of 219


Then we've entered the following data in Excel:

Based on the spreadsheet above, the following Excel DSUM examples would return:

=DSUM(orders, "Total Cost", A1:B2)


Result: 60.88

=DSUM(orders, 4, A1:B2)
Result: 60.88
To view named ranges: Under the Insert menu, select Name > Define.

Page 172 of 219


7.38 Using the NPER Function
To illustrate Excel's most popular financial functions, we consider a loan with monthly payments, an annual
interest rate of 6%, a 20-year duration, a present value of $150,000 (amount borrowed) and a future value of
0 (that's what you hope to achieve when you pay off a loan).
We make monthly payments, so we use 6%/12 = 0.5% for Rate and 20*12 = 240 for Nper (total number of
periods). If we make annual payments on the same loan, we use 6% for Rate and 20 for Nper.

Pmt
Select cell A2 and insert the PMT function.

Note: The last two arguments are optional. For loans the Fv can be
omitted (the future value of a loan equals 0, however, it's
included here for clarification). If Type is omitted, it is assumed
that payments are due at the end of the period.
Result. The monthly payment equals $1,074.65.

Page 173 of 219


Tip: when working with financial functions in Excel, always ask
yourself the question, am I making a payment (negative) or am I
receiving money (positive)? We pay off a loan of $150,000
(positive, we received that amount) and we make monthly payments of
$1,074.65 (negative, we pay).

Rate
If Rate is the only unknown variable, we can use the RATE function to calculate the interest rate.

Nper
Or the NPER function. If we make monthly payments of $1,074.65 on a 20-year loan, with an annual interest
rate of 6%, it takes 240 months to pay off this loan.

We already knew this, but we can change the monthly payment now to see how this affects the total number
of periods.

Conclusion: if we make monthly payments of $2,074.65, it takes less than 90 months to pay off this loan.

Page 174 of 219


Pv
Or the PV (Present Value) function. If we make monthly payments of $1,074.65 on a 20-year loan, with an
annual interest rate of 6%, how much can we borrow? You already know the answer.

Fv
And we finish this chapter with the FV (Future Value) function. If we make monthly payments of $1,074.65 on
a 20-year loan, with an annual interest rate of 6%, do we pay off this loan? Yes.

But, if we make monthly payments of only $1,000.00, we still have debt after 20 years.

7.39 Using the FVSCHEDULE Function

Basic Description
The Excel FVSCHEDULE function calculates the Future Value of an investment with a variable interest rate.
The syntax of the function is :

FVSCHEDULE( principal, schedule )


Where the arguments are as follows:

Page 175 of 219


principal - The present value of the investment

schedule - An array of values, that provides the schedule of interest rates to be


applied to the principal
If provided as a range of cells, these may contain numeric values or be
empty (empty cells denote a zero interest rate)

Excel Fvschedule Function Example


Cell B1 of the spreadsheet below shows an example of the Excel Fvschedule function used to calculate the
future value of an investment of $10,000, over 5 years. The investment earns interest of 5% during the first
two years and 3.5% during the 3rd, 4th and 5th years.
The format of the function is shown in the spreadsheet on the left and the result is shown in the spreadsheet
on the right.

Formulas: Results:

A B A B

1 5.0% =FVSCHEDULE( 10000, A1:A5 ) 1 5.0% $12,223.61

2 5.0% 2 5.0%

3 3.5% 3 3.5%

4 3.5% 4 3.5%

5 3.5% 5 3.5%

Fvschedule Function Errors


If you get an error from the Excel Fvschedule Function, this is most likely to be one of the following:
Common Errors

#VALUE! - Occurs if any of the supplied arguments are non-numeric


(blank cells as a part of the schedule array are acceptable and are treated as the numeric value 0)

#NAME? - Occurs when Analysis ToolPak add-in is not enabled in your Excel.
You will need to enable the add-in if you want to use the Excel Fvschedule function.

Page 176 of 219


7.40 Using the INTRATE Function

Description
Returns the interest rate for a fully invested security.

Syntax
INTRATE(settlement, maturity, investment, redemption, [basis])
IMPORTANT Dates should be entered by using the DATE function, or as results of other formulas or
functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are
entered as text.
The INTRATE function syntax has the following arguments:
 Settlement Required. The security's settlement date. The security settlement date is the date after the
issue date when the security is traded to the buyer.
 Maturity Required. The security's maturity date. The maturity date is the date when the security
expires.
 Investment Required. The amount invested in the security.
 Redemption Required. The amount to be received at maturity.
 Basis Optional. The type of day count basis to use.

Basis Day count basis

0 or omitted US (NASD) 30/360

1 Actual/actual

2 Actual/360

3 Actual/365

4 European 30/360

Remarks
 Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default,
January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days
after January 1, 1900.
 The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date
when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is
purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date
would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the
January 1, 2008, issue date.
 Settlement, maturity, and basis are truncated to integers.

Page 177 of 219


 If settlement or maturity is not a valid date, INTRATE returns the #VALUE! error value.
 If investment ≤ 0 or if redemption ≤ 0, INTRATE returns the #NUM! error value.
 If basis < 0 or if basis > 4, INTRATE returns the #NUM! error value.
 If settlement ≥ maturity, INTRATE returns the #NUM! error value.
 INTRATE is calculated as follows:

where:
o B = number of days in a year, depending on the year basis.
o DIM = number of days from settlement to maturity.

Example
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to
show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to
see all the data.

Data Description

2/15/2008 Settlement date

5/15/2008 Maturity date

$1,000,000 Investment

$1,014,420 Redemption value

2 Actual/360 basis

Formula Description (Result) Result

=INTRATE(A2,A3,A4,A5,A6) Discount rate, for the 5.77%


terms of the bond
(0.05768 or 5.77%)

7.41 Using the IRR Function


This Excel tutorial explains how to use the Excel IRR function with syntax and examples.

DESCRIPTION
The Microsoft Excel IRR function returns the internal rate of return for a series of cash flows. The cash flows
must occur at regular intervals, but do not have to be the same amounts for each interval.

Page 178 of 219


SYNTAX
The syntax for the Microsoft Excel IRR function is:
IRR( range, [estimated_irr] )
Parameters or Arguments
range is a range of cells that represent the series of cash flows.
estimated_irr is optional. It is the your guess at the internal rate of return. If this parameter is omitted,
the IRR function assumes an estimated_irr of 0.1 or 10%.
NOTE
 Excel tries to recalculate the IRR until the result is accurate within 0.00001 percent. If after 20 tries Excel
has not calculated an accurate value, it will return the #NUM! error.

APPLIES TO
The IRR function can be used in the following versions of Microsoft Excel:
 Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

TYPE OF EXCEL FUNCTION


The IRR function can be used in Microsoft Excel as the following type of function:
 Worksheet function (WS)
 VBA function (VBA)

EXAMPLE (AS WORKSHEET FUNCTION)


Let's look at some Excel IRR function examples and explore how to use the IRR function as a worksheet
function in Microsoft Excel:

Page 179 of 219


Based on the Excel spreadsheet above:
This first example returns an internal rate of return of 28%. It assumes that you start a business at a cost of
$7,500. You net the following income for the first four years: $3,000, $5,000, $1,200, and $4,000.
=IRR(A1:A5)
This next example returns an internal rate of return of 5%. It assumes that you start a business at a cost of
$10,000. You net the following income for the first three years: $3,400, $6,500, and $1,000.
=IRR(B1:B4)

EXAMPLE (AS VBA FUNCTION)


The IRR function can also be used in VBA code in Microsoft Excel.
Let's look at some Excel IRR function examples and explore how to use the IRR function in Excel VBA code:
Dim LNumber As Double
Static Values(5) As Double

Values(0) = -7500
Values(1) = 3000
Values(2) = 5000
Values(3) = 1200
Values(4) = 4000

Page 180 of 219


LNumber = Irr(Values())
In this example, the variable called LNumber would now contain the value of 0.276668413.

7.42 Using the PARETO CHART


A Pareto chart combines a column chart and a line graph. The Pareto principle states that, for many events,
roughly 80% of the effects come from 20% of the causes. In this example, we will see that 80% of the
complaints come from 2 out of 10 (20%) complaint types.

1. First, sort your data in descending order. To


achieve this, click a number, on the Data tab,
click ZA.

2. Calculate the cumulative count. Enter the


formula shown below into cell C5 and drag the
formula down.

Page 181 of 219


3. Calculate the cumulative %. Enter the formula
shown below into cell D4 and drag the formula
down.

Page 182 of 219


Note: Cell C13 contains the total number of complaints. When we
drag this formula down, the absolute reference ($C$13) stays the
same, while the relative reference (C4) changes to C5, C6, C7, etc.
4. Select the data in column A, B and D. To
achieve this, hold down CTRL and select each
range.

Page 183 of 219


5. On the Insert tab, click Column and
select Clustered Column.

Page 184 of 219


6. Right click on the red bars (cumulative %)
and click Change Series Chart Type...

Page 185 of 219


7. Select Line with Markers.

Page 186 of 219


8. Right click on the red line and click Format
Data Series...

9. Select Secondary Axis.

Page 187 of 219


10. Right click the percentages on the chart,
click Format Axis, set the Maximum to 100 and
click Close.

Page 188 of 219


Result:

Page 189 of 219


Conclusion: the Pareto chart shows that 80% of the complaints come from 20% of the complaint types
(Overpriced and Small portions). In other words: the Pareto principle applies.

7.43 Using the ISPMT Function


This Excel tutorial explains how to use the Excel ISPMT function with syntax and examples.

DESCRIPTION
The Microsoft Excel ISPMT function returns the interest payment for an investment based on an interest rate
and a constant payment schedule. This function was created for backwards compatibility with Lotus 1-2-3.

SYNTAX
The syntax for the Microsoft Excel ISPMT function is:
ISPMT( interest_rate, period, number_payments, PV )
Parameters or Arguments
interest_rate is the interest rate for the investment.
period is the period to calculate the interest rate. It must be a value between 1 and number_payments.
number_payments is the number of payments for the annuity.
PV is the loan amount or present value of the payments.

APPLIES TO
The ISPMT function can be used in the following versions of Microsoft Excel:
 Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
TYPE OF EXCEL FUNCTION
The ISPMT function can be used in Microsoft Excel as the following type of function:
 Worksheet function (WS)

Page 190 of 219


EXAMPLE (AS WORKSHEET FUNCTION)
Let's look at an example to how you would use the ISPMT examples and explore how to use the ISPMT
function as a worksheet function in Microsoft Excel:
This first example returns the interest payment for a $5,000 investment that earns 7.5% annually for 2 years.
The interest payment is calculated for the 8th month.

=ISPMT(7.5%/12, 8, 2*12, 5000)


This next example returns the interest payment for a $8,000 investment that earns 6% annually for 4 years.
The interest payment is calculated for the 30th week.

=ISPMT(6%/52, 30, 4*52, 8000, 0 ,1)


This next example returns the interest payment for a $6,500 investment that earns 5.25% annually for 10
years. The interest payment is calculated for the 4th year.

=ISPMT(5.25%/1, 4, 10*1, 6500)

8.00 What-if tables


8.01 Using a one input Data Table command
In this example, we will examine the effects of different interest rates on the amount of money you have to
pay back when taking out a loan.
We will use the PMT function to calculate the monthly loan
payments.
The PMT function is covered within the functions section of this
manual, but for your convenience, the syntax is listed below:
PMT(rate,nper,pv,fv,type)
Where:
Rate: This is the loan interest rate.
Nper: This is the total number of loan payments.
Pv: This is the ‘present value’, (principal) or the total
amount that a series of future payments is worth now.
Fv: This is the ‘future value’, or a total amount you want to
have after the last payment is made. If Fv is not specified,
then it will default to 0 and thus the future value of the
loan is 0.
Type: This can be either 0 or 1 and donates when payments are
due (i.e. at the end of the period or at the start of each
period).
Open a workbook called One input data table.

Page 191 of 219


Notice the function in cell C5.
=PMT(B5/12,C17,-C16):

To construct the data table we need to first


select the following area of the worksheet:

Click on the Data tab and from within the Data


Tools group click on the What-If Analysis
button. Select the Data Table command from the
popup.

This will display the Data Table dialog box.

Page 192 of 219


We need to click within the Column input cell text box of this
dialog box, and click on the input cell, i.e. cell B5, as
indicated:

Clicking on the OK button will display the what-if payments, as


illustrated.

Save your changes and close the workbook.

8.02 Using a two input data table command


In the one-input data table example, we only asked a what-if
question that related to changes in interest rates. However, we
could also ask a what-if question relating to how many months to
spread the loan over. In this example we will see what happens if
this loan is spread over 36, 48 and 60 months.
Open a workbook called Two input data table.
Note the use of the PMT function in cell B4:
=PMT(C18/12,C17,-C16)

Page 193 of 219


To ask a two input, what-if question we first
have to select the relevant data, as
illustrated:

Click on the Data tab and from within the Data


Tools group click on the What-If Analysis
button. Select the Data Table command from the
popup.

This will display the Data Table dialog box.

Page 194 of 219


Click on the section of the dialog box called
Row input cell, and then click on cell C17.
Click on the section of the dialog box called
Column input cell, and then click on cell C18:

When you click on the OK button, the what-if


values will be inserted, as illustrated below:

Save your changes and close the workbook.

9.00 Audit
9.01 Tracing precedent cells
Open a workbook called Auditing.
To see the auditing tools available, click on the Formulas tab and
look within the Formula Auditing section.

Page 195 of 219


Click on cell F15.
Click on the Trace Precedents icon (within the
Formula Auditing group of the Formulas tab).

You will see the following displayed:

Click on this icon again, and you will see the


following:

Click on this icon again, and you will see the


following. As you can see each time your click
on this icon, you go “one layer back”:

Click on the Remove Arrows icon (within the


Formula Auditing group of the Formulas tab).

Page 196 of 219


9.02 Tracing the dependents of a cell
Following on from the previous example, click on cell C6.
Click on the Trace Dependents icon (within the
Formula Auditing group of the Formulas tab).

You will see the following:

Click on the Trace Dependents icon again and you


will see the following:

Page 197 of 219


Close the workbook without saving your changes.

9.03 Displaying all formulas within a worksheet


Open a workbook called Display formulas.
Select the table of data.

You see the results of the calculations, rather than the formula
displayed. Press CTRL + ` (grave accent), the table will then look
like this.

Page 198 of 219


TIP: If this does not work, you may be pressing the wrong keys.
Click on the Undo icon and try again after carefully examining your
keyboard.
Pressing this keyboard shortcut again will
toggle back to showing the effects of a formula
rather that the formula itself.
Close the workbook without saving your changes.

10.00 Adding Picture To A Cell


Sometimes, you may need to add a picture to a cell. The picture below shows an example:

1
3

Page 199 of 219


To do this, simply position your cursor to the
desired cell, the right click the mouse and
insert a Comment, as shown below:

Choose “Insert Comment”.


2 insert a comment but actually
Then, do not
3 cursor to the edge of the comment
position your
box, as shown below:
3
3
Position your
cursor here on
edge
3
3

Page 200 of 219


Then once you have positioned it here, and then
right click the mouse, and the following
dialogue screen would be displayed:

4
3

Choose “Format Comment…”.


4
3

Page 201 of 219


5
3

The following dialogue screen would now be displayed.


Select the tab labeled as Colors and Lines.
5
3

Page 202 of 219


6
3

Choose color, then pull down the selector up


6 till you see the following:
3

Page 203 of 219


7
3

Choose the Fill Effects, as shown above. 7


3

8
3

Once you have selected this, you will then see


8 the above dialogue screen, in which case you

3
Page 204 of 219
should be able to select the picture which you
previously saved, then click the OK and then the
other OK button, and your image would now be
displayed in the cell you have chosen:

8
3

11.00 Introduction – Connecting Excel to Large Database


What is PowerPivot?
No single answer addresses this question completely, so I will give you a few different answers, and try to
keep each one ultra-brief.
Keep in mind that all of these come from my own firsthand experience over the last five+ years – I am a
practitioner of PowerPivot, not a salesperson. My partners and I at my former company built a very
successful business applying it fulltime. I like to say that I preach what I practice, not the other way around.
***NOTE: If you’d like a jumpstart on maximizing the benefits of PowerPivot, one that takes a very
“commonsense” and visual approach, this book is written specifically for the 30 million heavy users of Excel
worldwide and aims to make your adoption/transition smooth and profitable.

1. It’s a Free Extension to Excel 2013 and 2013, Built by Microsoft


Yeah, it’s free, and it’s from Microsoft, as opposed to a third party. It dramatically extends the powers of
“normal” Excel, and more importantly, the powers of people who use it: people like me, and probably you
too if you are reading this.
It snaps right into Excel as if it had been there from the beginning:

Page 205 of 219


PowerPivot is now also included in Excel 2013 – the new “Data Model” features of pivots in 2013 are really
just PowerPivot, and the remaining functionality of the PowerPivot addin can be enabled with a single
checkbox (under Addins).

2. “The Best Thing to Happen to Excel in 20 Years”


Even though I agree 100%, that’s not my description. That comes from Mr. Excel himself, Bill Jelen. He’s said
this a number of places, but here he says it on the MrExcel.com forums:

3. A Much More Agile & Cost Effective Approach to Business Intelligence

PowerPivot Offers the Low Startup Cost and Agility of Spreadsheets


Blended with the Robustness and Low Ongoing Cost of “Traditional” BI
For more information on how PowerPivot accomplishes this, see the following three articles in CIMA Insight,
the monthly newsletter for the Chartered Institute of Management Accountants:

Page 206 of 219


1. Part One: Overview of PowerPivot’s Hybrid Approach

2. Part Two: A Cost Comparison of a Single Project Implemented Via Traditional Methods,
Subsequently Re-Implemented in PowerPivot

3. Part Three: Total ROI Analysis and Breakdown of How the Savings Are Achieved

4. Something That Turns Workbooks Into Industrial Strength Apps

PowerPivot Workbook – Click for Larger Version


Slick and interactive. And very straightforward to produce, using only Excel. No programming expertise
required.

5. An EXTENSION to things you ALREADY KNOW about Excel


It adds a lot of power to Excel, yes, but it doesn’t force Excel pros to learn a million new things. It’s still
PivotTables. It’s still Excel formulas. It just adds a number of important new capabilities that Excel pros will
never put down once they have tried them.
I like to say that PowerPivot’s new capabilities “rhyme with” the things already in Excel.

Page 207 of 219


On the Left: A Normal PivotTable. On the Right: A PowerPivot PivotTable.
Can You Spot the Difference? (Click for Larger Version)

6. A Way to handle Massive Volumes of Data in Excel


Normal Excel caps out at 1 Million rows of data per sheet. PowerPivot goes well beyond that and for most
people, you will find it actually HAS no practical limit.
For instance, here’s a workbook I like to demo that has 161 Million rows in a single sheet:

Special Sheet Type Can Hold 161 Million Rows


(Another Sheet in the Same File Holds Another 150 Million!)
That workbook, believe it or not, works just fine on my ultralight, 4GB of RAM laptop.

7. A Way to Add ANY Formula to a Pivot, and it Adjusts!


One of the most common desires in pivots: “I want to write a formula next to the pivot, and have that
formula adjust when I add/remove fields.”

Page 208 of 219


This “Pct Change Versus Last Year” Formula Could NOT Be Added to a Pivot in Normal Excel,
and Would Have Been Hard to Write Even OUTSIDE of the Pivot.
Simple in PowerPivot Though.
That in itself is pretty cool. But then when I rearrange the pivot, the formula just rearranges with it:

Rearrange the Pivot and the Formula Just Does the Right Thing
For more details on this, see this article on how PowerPivot makes your formulas Portable.
And for more details on points 4-7 above, see this article on the Top Five Ways in Which PowerPivot Helps Excel
Pros.

8. A Way to Turn Workbooks Into Self-Maintaining Web Applications

Page 209 of 219


That’s a PowerPivot workbook – Saved to the server and then viewed in the browser,
the user of this web application doesn’t even need Excel installed.
PowerPivot workbooks are self contained web applications, merely requiring a ‘Save as’ to make them
accessible in the browser as interactive solutions.”
That’s right:
1. Build a workbook.

2. Publish it to a secure server with one click.

3. Send the link to colleagues and/or partners and customers.

4. Schedule it to regularly refresh itself with the latest data. You never have to touch it again,
unless you want to improve it.

12.00 Introduction – Connecting Excel To Other Excel Workbooks


External References

Page 210 of 219


An external reference in Excel is a reference to a cell or range of cells in another workbook. Below you can
find the workbooks of three divisions (North, Mid and South).

Create External Reference

Page 211 of 219


To create an external reference, execute the following steps.
1. Open all workbooks.
2. In the Company workbook, select cell B2 and
type the equal sign =
3. On the View tab, click Switch Windows and
then click North.

4. In the North workbook, select cell B2 and


type a +

Page 212 of 219


5. Repeat step 3 and 4 for the Mid and South
workbook.
6. Remove the $ symbols in the formula of cell
B2 and copy the formula to the other cells.
Result.

Page 213 of 219


Alert
Close all workbooks. Change a number in the workbook of a division.
Close all workbooks again. Open the Company workbook.
A. To update all links, click Enable Content.
B. To not update the links, click the X.

Page 214 of 219


Note: if you see another alert, click Update or Don't Update.

Edit Links
On the Data tab, in the Connections group, click
the Edit links symbol to launch the Edit Links
dialog box.

Page 215 of 219


1. If you didn't update the links, you can still
update the links here. Select a workbook and
click Update Values to update the links to this
workbook. Note how the Status changes to OK.

Page 216 of 219


2. If you don't want to display the alert and
update the links automatically, Click Startup
Prompt, select the third option, and click OK.

Exercise

One-Input and Two-Input Data Tables


Note: Please download the workbook required for this exercise:

Day 5 – Exercise 01 – One-Input and Two-Input Data Tables.xlsx


Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 5 - Exercise 01 – 1-2 Input Tables – V0N


Using what you have practiced earlier in this
sections of advanced functions, perform the
exercise indicated on the workbook that was
handed down to you from the facilitator.

Page 217 of 219


Shared Workbook Using Google Docs
Note: Please download the workbook required for this exercise:

Day 5 – Exercise 02 – Shared Workbook.xlsx


Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 5 - Exercise 02 – SharedWkbk – V0N


Using what you have practiced earlier in this
sections of advanced functions, perform the
exercise indicated on the workbook that was
handed down to you from the facilitator.

Exercise 03 – Power Pivot Introduction (Excel 2013)


Note: Please download the workbook required for this exercise:

Day 5 – Exercise 03 – Power Pivot Introduction.xlsx


Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 5 - Exercise 03 – Power Pivot


Introduction – V0N
Using what you have practiced earlier in this
sections of advanced functions, perform the
exercise indicated on the workbook that was
handed down to you from the facilitator.

Exercise 04 – Excel Connectivity


Note: Please download the workbook required for this exercise:

Day 5 – Exercise 04 – Excel Connectivity.xlsx


Once you have completed this Exercise, save (and email to the
facilitators’ email address) the File as:

Your Complete Name – Day 5 - Exercise 04 – Excel Connectivity –


V0N
Using what you have practiced earlier in this
sections of advanced functions, perform the

Page 218 of 219


exercise indicated on the workbook that was
handed down to you from the facilitator.

Page 219 of 219

S-ar putea să vă placă și