You are on page 1of 52

10/13/13

Spreadsheet Modeling

This document is aut horized for use only by Srinivasarao Maddala. Copy or post ing is an
infringement of copy right .

Spreadsheet Modeling
Pretest Introduction

Welcom e to the pre-assessm ent test for the Spreadsheet Modeling tutorial. This test will allow y ou to assess
y our knowledge of som e basic m odeling skills.
To adv ance from one question to the next, select one of the answer choices and click the Subm it button.
After subm itting y our answer, y ou will not be able to change it or return to the question, so m ake sure y ou
are satisfied with y our selection before y ou subm it each answer.
Som e problem s ask y ou for a form ula. It is probably easiest to determ ine the correct form ula in Excel and
then paste it into the Pretest answer area. This will av oid sy ntax errors. For exam ple, if in Excel y ou ty pe in
the form ula = SUMIF(B1 :B1 0,C8,D1 :D1 0) and think that is the correct answer, just select
SUMIF(B1 :B1 0,C8,D1 :D1 0) in Excel and copy it. Then paste it into the input answer area within the
question.
Your results will be display ed im m ediately upon com pletion of the test. The results screen will display each
question with a graphic notation indicating y our score: X for incorrect and check m ark for correct.
Click Pretest in the m enu bar to the left to begin. You can also return to y our test results at any tim e (after
com pleting the exam ) by clicking Pretest Introduction and then Pretest.
Good Luck!

Introduction

Most work done by business analy sts can be categorized as either reporting (prov iding required data) or
analy sis (building m odels to help y our organization m ake the right decisions). In today 's world, m ost
business reporting and m odeling is done using Microsoft Excel. Com pleting this online course should
increase y our ability to use Excel to create reports and/or dev elop powerful business m odels. Ev en if y ou
hav e nev er used Excel before, we will teach y ou how to use Excel's powerful functions and chart capabilities
to solv e a m y riad of business problem s.
If y ou are a student, then during y our undergraduate or MBA program y ou will hav e to build m any m odels
to analy ze cases or build spreadsheet m odels in courses such as finance, m arketing, accounting, operations
and m anagem ent science. We will giv e y ou the spreadsheet knowledge needed to tackle the m any
analy tical questions that arise during y our course work.
If y ou are a business analy st, this course will introduce y ou to m any new concepts and tools that will help
y ou m ore quickly and accurately sum m arize business data. The course will also teach y ou how to dev elop
spreadsheet m odels that will help y our organization m ake better decisions.

The Company

Le Napoleon is a bakery specializing in French pastries, now owned by a partnership that includes its
two ex-pat French pastry chefs, Michel Toure, whose fam ily m ov ed to Strasbourg from Mali when he was
a sm all child, and Anne-Sophie Le Nguy en, who grew up in the Cognac region.
The two m et each other not long after m ov ing to the U.S. and found that not only did they hav e a shared
dream of business ownership but that each had strengths to offset the other's weaknesses. Both hav e
exceedingly refined tastes, but their success lies m ore in Michel's way with obscure ingredients and
techniques and Anne-Sophie's am bition and exceptional understanding of the custom er.
Le Napoleon got its start in a business incubator, and at first, the bakery had just a sm all stand at the
weekly farm er's m arket. Soon, though, satisfied custom ers began to place special orders. When Michel
and Anne-Sophia had to turn down their third wedding cake request, they decided to sit down and work
out a plan to m ov e out of the business incubator and into their own, dedicated location. The business is
now thriv ing.
1/52

10/13/13

Spreadsheet Modeling

In this course, we will use operations at Le Napoleon to illustrate som e of the problem s that businesses
both large and sm all m ust faceand Excel to illustrate solutions to those problem s.

Spreadsheet Modeling Overview

In the first three sections of this course we begin by fam iliarizing y ou with the Excel env ironm ent and
showing y ou how to m ov e around in a spreadsheet. If y ou hav e used Excel extensiv ely y ou m ay choose to
skip these chapters. In the Excel Form ulas and Functions sections, we thoroughly explain how to enter
and copy form ulas in Excel. We also will teach y ou about Excel's m any powerful functions including little
known functions such as MATCH and INDEX. Just like the key to a great recipe is the proper use of that
special spice or ingredient, the key to building a spreadsheet that solv es a business problem is often
m astery of Excel's m any powerful functions.
In the section on Excel Functions we cov er Excel's m any tools that can be used to create great looking and
inform ativ e reports (conditional form atting, piv ot tables, subtotals, SUMIFS and COUNTIFS functions,
etc.). In the Charts section, we show y ou how to use Excel to create inform ativ e charts. In the next
section, y ou will learn how to im port word files and Internet data into the Excel env ironm ent.
The Art of Spreadsheet Modeling section contains an extensiv e explanation of how to build spreadsheet
m odels to solv e a business problem . For exam ple, should a bakery open a new outlet? How should we plan
to sav e for retirem ent? In this section, we cov er m any exciting m odeling tools such as Auditing, spinner
controls, Goal Seek, Data Validation and Data Tables. The Using Excel Solv er section cov ers the Excel
Solv er tool which is used to find the optim al solution to a problem . The Three-Dim ensional Form ulas
section explains how 3 D form ulas and Excel's Table feature can m ake y ou m uch m ore efficient when y ou
dev elop spreadsheet m odels. Finally , the Monte Carlo Sim ulation closes the course by introducing y ou to
a really efficient m odel building tool. In that section, y ou will learn how Monte Carlo sim ulation can be
used to m odel the effect of uncertainty on business decisions.
The spreadsheet is the canv as for the business analy st. This course giv es y ou the "artistic skills" needed to
dev elop state of the art spreadsheet m odels for solv ing business problem s.

The Excel Environment

Ev en sim ple workbook tasks will becom e tedious and prone to errors if y ou do not know how to use Excel
efficiently . In this chapter we will introduce the following aspects of the Excel env ironm ent and basic
efficiency m easures.
Opening workbooks
The Excel 2 007 Ribbon and the Quick Access Toolbar
Working with worksheets
Workbook- and worksheet-lev el nav igation
Printing worksheets and workbooks
Sav ing workbooks as Excel and other file ty pes
Throughout this course, we will continue to present way s to increase not only y our proficiency in but also
y our efficiency with Excel.

Opening a workbook

To open a workbook, use any of the following techniques.


Double-click its icon in Windows Explorer. This will work as long as Windows knows that the file
can be opened in Excel.
If Excel is running, hit Ctrl-O or the Office Button (the round button in the upper-left-hand corner
of the Excel window) and browse for the file. You can use the "Files of ty pe" drop-down box to v iew a
num ber of different file ty pes.
If Excel is running and the icon representing y our file is the generic Windows icon (exam ple
below), but y ou know that Excel can read it, it m ight be easiest to drag the icon into the Excel
window. You can use this m ethod for any file ty pe that Excel can open.
Open the Excel Env ironm ent.xlsx file by any of the abov e m ethods. This file contains data from
2/52

10/13/13

Spreadsheet Modeling

questionnaires com pleted by custom ers of Le Napoleon. Leav e this file open, as we will continue to work
with it.
Open the Excel Env ironm ent_non_Excel.asp file by dragging its icon into the already running Excel
window. Note: If y our installation of Excel is not able to read this file, don't worry we will not be using
this file for any thing else.
Close the Excel Env ironm ent_non_Excel.asp file by clicking the X for the workbook. This is the button
that reads "Close Window" when the pointer hov ers ov er it.

The Excel 2007 Ribbon

The Ribbon in each of the Office program s organizes com m only used com m ands and features into
categories. Each category is represented by a tab, and each tab contains groups of subcategories.
For exam ple, in Excel, the Rev iew tab contains three groupsProofing, Com m ents, and Changes. Each
contains features com m only needed when rev iewing others' workbooks, or before sending y our own
workbooks out for rev iew or use by others.
Take som e tim e to explore the different tabs.

The Quick Access Toolbar

The Quick Access Toolbar is a custom izable docking place for features and com m ands that y ou use m ost
frequently . It is found just to the right of the Office Button and by default display s buttons for Sav e, Undo,
and Redo. No m atter which of the Ribbon's tabs is selected, the Quick Access Toolbar is alway s v isible.
Explore the custom ization options for the Quick Access Toolbar. In doing so, look at not only Popular
Com m ands but also All Com m ands. Once y ou configure the Quick Access Toolbar to suit y our needs, y ou
are only a click away from the features that y ou use the m ost.

Worksheets

Each workbook file contains one or m ore tabbed worksheets. You can easily set the num ber of worksheets
that y ou want new workbooks to contain, renam e sheets, and m ov e and delete worksheets.
Note that spaces, dashes, and certain other special characters are legal in sheet nam es, while other
characters, such as \ / ? are not. Also, although we hav e opted to use spaces in the sheet nam es in our
exam ple file, know that this can com plicate m ore adv anced uses of the program .
In the Excel Env ironm ent.xlsx file, renam e the bakery1 worksheet to bakery mon-thurs, bakery2 to bakery
fri-sun; mall1 to mall mon-thurs and mall2 to mall fri-sun.
Mov e sheets to be in this order: bakery mon-thurs, bakery fri-sun, mall mon-thurs, mall fri-sun.
Renam e Sheet1 to key. Mov e this sheet to the beginning of the workbook.
You can also m ov e or copy worksheets into another workbook. This is handy if y ou are working on a team
and need to bring people's indiv idual work into a single file.
Insert a new sheet and call it summary. Mov e it to the beginning of the workbook, before the key
worksheet. We will leav e this sheet blank for now.

Moving Around a Worksheet and Workbook


Learning a few hotkey s, howev er, will allow y ou to keep y our hands on the key board, which m any people
find im prov es efficiency . Som e nav igation hotkey s are
Ct rl-Home: Selects cell A1
Ct rl-End: Selects the cell at the intersection of the last-used colum n and last-used row on the
worksheet
Page Up: Scrolls up one screen
Page Down: Scrolls down one screen
Alt -Page Up: Scrolls left one screen
3/52

10/13/13

Spreadsheet Modeling

Alt -Page Down: Scrolls right one screen


Ct rl-Page Up: Selects the prev ious worksheet
Ct rl-Page Down: Selects the next worksheet
Ct rl-Tab: Mov es to the next open Excel workbook
Pressing the Alt key once will allow y ou to quickly select a ribbon using its letter key , and then select
item s on that ribbon using each item 's letter key . The screenshot below shows the ribbon when the Alt
key is pressed. Pressing the M key would open the Form ulas ribbon, and item s on that ribbon would then
be identified by their key s.
In the Excel Env ironm ent.xlsx file, starting with the bakery mon-thurs worksheet
Use Ctrl-Hom e to m ov e to cell A1 and Ctrl-End to m ov e to the last cell in the data range (observ e that
this m ay be a blank cell).
Use Ctrl-Hom e again to return to cell A1 .
Use Page Down to scan through the data one screen at a tim e.
Use Alt-Page Down and Alt-Page Up to scroll left and right.
Finally , use Ctrl-Page Down to m ov e to the next worksheet.
Continue to practice these nav igation hotkey s in the Excel Env ironm ent.xlsx file. You m ight find it
useful to keep a list of these hotkey s near y our com puter until using them becom es second nature.

Printing a Worksheet
In a later chapter, we will discuss print areas and page setup.
View the key worksheet in Print Prev iew. Note that before printing this worksheet, we will probably want
to m ake som e adjustm ents. Don't click Print; instead click the Close Print Prev iew button on the Print
Prev iew tab.

Saving a Workbook File

To sav e a workbook, hit Ctrl-S, or click the Sav e icon on the Quick Access Toolbar.
Sav e Excel Env ironm ent.xlsx as an .xls file.
Sav e the bakery mon-thurs worksheet as a .csv (com m a-separated v alues) file nam ed bakery1.csv.
Sav ing Exercise Solution

Working with Data: Basic Techniques

Our m ain goal in this chapter is to introduce efficient m ethods for working with cells and ranges. In this
chapter, we will use the file Working with Data.xlsx, so please download this workbook now. Please follow
along as we outline changes to the workbook.

Cells and Ranges

Each rectangular block in which data can be entered is a cell. Each cell has an address. In m ost
configurations of the program , this is the letter of the colum n and the num ber of the row that intersect at
that cell.
Excel 2 007 spreadsheets hav e 1 ,04 8,57 6 rows and 1 6 ,3 84 colum ns or ov er 1 7 m illion cells. By
com parison, Excel 2 003 spreadsheets hav e 6 5,53 6 rows and 2 56 colum ns.
A block of cells that is to be treated as a unit in som e operation (e.g., form atting, sum m ation) is called a
range. Ranges are known by the addresses of their upper-left-m ost cell and lower-right-m ost cell. A colon
serv es to separate the two addresses. In the screenshot below, the range B2 :C5 is selected.

Selecting Ranges

There are a num ber of way s to select ranges of cells. In this section, we will explore the selection of
contiguous cells using the selection pointer as well as the Ctrl and Shift key s. We will also discuss a m eans
4/52

10/13/13

Spreadsheet Modeling

of easily selecting ranges within a large dataset.

Selection Pointer
On the bakery mon-thurs worksheet, select the range F2 :F1 1 . Check the status bar for statistics on this
range.
While we are on the topic of statistical functions, it is worth pointing out that zero v alues are included
in av erages and other statistics, whereas blank cells are not.
Change y our status bar settings so that the fiv e statistics m entioned abov e av erage, count, m in,
m ax, and sum are display ed in the status bar when data is selected.

Ctrl and Shift


Holding down the Ctrl key tells Excel that y ou want to jum p to the end of the range. Holding down the
Shift key tells Excel to select all of the interm ediate cells along the way .
Practice with Ctrl, Shift, and Ctrl-Shift. On the key worksheet, select cell A2 . Hold down just the
Ctrl key and hit the right arrow key . The selected cell should now be R2 , the last cell in the
contiguous range A2 :R2 .
Select cell A2 again. This tim e, hold down just the Shift key and hit the right arrow key .Keeping
the Shift key held down, hit the right arrow key a few m ore tim es. You should see that Excel
adv ances one cell at a tim e, adding cells to the selection.
Select cell A2 a final tim e. Hold down both Ctrl and Shift, and hit the right arrow key . Excel
both "m ov es" all the way to R2 (Ctrl key behav ior) and retains the selection of the interm ediate
cells (Shift key behav ior).
In cases where there are blanks in the data, it is helpful to work with a split screen, as shown in the next
topic.

Splitting the Screen


The Split button on the View tab, in the Window group, can also be used to quickly split the screen both
horizontally and v ertically .
Check to see that y our installation of Excel is configured to show in the status bar at least the
m inim um , m axim um , and av erage of a selected range of data. Split the screen of the bakery fri-sun,
mall mon-thurs, and mall fri-sun worksheets. Then, by selecting data on each of the four questionnaire
results worksheets, quickly com pare basic statistics for the results of question (1 0) in colum n K,
Satisfaction with v ariety of goods, on a scale of 1 to 5.
There are, of course, functions and other way s of obtaining such statistics. But since selecting cells is
extrem ely fast, it can serv e as a good quick auditing tool, to double-check the results of functions.
Alternativ ely , if the screen is split, click the Split button on the View tab to un-split it.

Selecting All Cells in a Dataset Using Shortcut Keys


On the bakery mon-thurs worksheet, select any non-blank cell and use one of the two techniques described
to select the entire dataset. Then select a blank cell within the dataset and try this again. Either way , the
whole dataset should be selected.

Selecting All Cells on a Worksheet


The Select All button allows y ou to quickly select all cells on a worksheet.

Selecting Noncontiguous Ranges

Som etim es we want to select noncontiguous ranges, for exam ple, to form at a num ber of isolated cells at
once, or to include them in a function. In this section, we will explore two way s to select such ranges.

5/52

10/13/13

Spreadsheet Modeling

Using the Ctrl Key


On the bakery mon-thurs worksheet, select both B2 :B8 and M2 :M8.

Using F8 (Extend Selection) and Shift-F8 (Add to Selection)


You m ight like this technique.
The function key F8 and Shift-F8 can also be used to select ranges, including noncontiguous ranges.
When y ou hit F8 the first tim e, Excel enters "Extend Selection" m ode and behav es as if y ou had the
Shift key held down.
Once y ou hav e the selection that y ou want, hit F8 a second tim e to exit Extend Selection m ode. Your
selection will rem ain activ e unless y ou select another cell. If y ou want to select a second range, use
the trick described next, Shift-F8.
Hitting Shift+ F8 puts Excel in Add to Selection m ode. In other words, y ou can
Use F8 to select a range (rem em bering to hit F8 to exit Extend Selection m ode when y ou are
ready ).
Use Shift+ F8 to select a second range (which can also then be done with the F8/Extend Selection
technique).

Selecting Cells and Named Ranges

In this section, we will explore two way s of quickly selecting cells. These allow us to select a cell based on
its address (e.g., C2 4 ) or a cell or range of cells based on an assigned nam e (e.g., rev enue; surv ey _data).

In Name Box
The Nam e Box, found just abov e the header for colum n A, shows the nam e of the currently selected cell
or range (m ore on nam ed ranges in a later chapter). In the screenshot below, the Nam e Box reads A1 .
By ty ping a cell address or range nam e in the Nam e Box and hitting Enter, y ou can select (and jum p
to) cells or nam ed ranges.
On the bakery mon-thurs worksheet, ty pe L97, and hit Enter. Excel should take y ou to that cell. Now
return to the Nam e Box and click its drop-down arrow. You should see questions as an option; this is
because we hav e assigned the nam e questions to a range. Choose questions from the drop-down list to
jum p to this range.

With the F5 Key (Go To Dialog Box)


The function key F5 brings up the Go To dialog box, which can be used to select cells and jum p to nam ed
ranges. Sim ply hit F5 and choose the desired range nam e from the list display ed in the Go to: box, or
enter the desired cell address in the Reference: box.
On the bakery mon-thurs worksheet, use the F5 key to go to cell G9 9 . Then use it to go to the range
nam ed questions.
Note that the Go To dialog box keeps a running list of cells v isited in the current Excel session.

Selecting Otherwise Difficult to Select Cells with Go To Special

The Go To dialog box can also be used to select cells that would otherwise be fairly difficult to
com prehensiv ely identify and select. Clicking the Special button at the bottom -left corner of the Go To
dialog box brings up a list of ty pes of cells that users com m only need to select, such as blank cells, cells
containing errors, cells containing com m ents, and m any others.
Assum e m anagem ent at Le Napoleon wanted to add shading to the blank cells in the bakery mon-thurs
dataset, to see m ore easily whether just a few or m any item s on their questionnaire are being left blank.
(Incidentally , there is a function to return the num ber of blank cells in a range: the COUNTBLANK
function.) It would be v ery tim e-consum ing to select each blank cell by hand. This would also be prone to
6/52

10/13/13

Spreadsheet Modeling

error som e blank cells would likely be left out, and som e cells containing v alues would likely be selected
by m istake. The Special options in the Go To dialog box can take m ost of the work out of this task.
On the bakery mon-thurs worksheet, select any cell in the block of data. Hit the F5 key and click the
Special button. Choose Blanks, and hit OK. All blank cells within the block of data should now be selected.
Do not click any cells, or y ou will lose the selection! Now choose a fill color from the palette on the Hom e
tab (in the Font group, under the selector for font size), and all blank cells will be shaded. (Conditional
form atting, to be introduced in a future chapter), would be another way of shading these blank cells.)

Filling Series

For com m only used series and entries that Excel can populate to be part of a series (e.g., Bakery Item 1 ,
Bakery Item 2 ), y ou can use the Autofill handle to fill in as m uch of the series as y ou need. The Autofill
handle appears at the bottom right of a selected cell or range of cells; it appears to be a sm all square
superim posed on that corner of the black border around the selected cell.
When the pointer hov ers ov er the Autofill handle, it changes shape to resem ble a cross.
Like dates, tim es can be autofilled, with Excel augm enting the v alue in each cell by one hour. Unlike
with dates, howev er, the Auto Fill Options will not allow y ou to change the increm ent to fifteen m inutes
or a half-hour.
This sam e technique, specify ing the first two elem ents of the series before autofilling, could be used if y ou
wanted to create a series like {1 , 2 , 3 . . .} or {5, 1 0, 1 5 . . .}.
Another way to create a series like {1 , 2 , 3 . . .} is to use the Fill Series com m and. This is especially useful
if y ou often find y ourself ov ershooting the m ark when y ou drag with the m ouse.
In addition, y ou can define y our own custom fill series. For exam ple, Le Napoleon m ight want to define a
series based on a list of specialty pastries, hourly em ploy ees' nam es, or nam es of restaurants that procure
dessert offerings from the bakery . Once the series is defined, only one elem ent from the series would need
to be entered m anually ; the rest could be autofilled.
On the bakery mon-thurs worksheet, edit Question_1 to read Question 1 . Fill to com plete the series
through Question 1 6 .
Select the bakery fri-sun worksheet. In colum n A, below the Respondent label, create v alues from 1 to
1 00 v ia autofill.
Do the sam e for the mall mon-thurs worksheet (again using num bers from 1 to 1 00), but this tim e,
double-click rat her t han dragging t he aut ofill handle. Because there is a block of contiguous data
in the adjacent colum n, Excel fills the series to the end of that block.

For the mall fri-sun worksheet, use Fill Series to create num bers from 1 to 1 00.

Download the file Working with Data_products.xlsx. Using the data on Sheet1 , create a custom fill
series. Test y our series to see that it works. Then, if y ou wish, feel free to delete the series (v ia Excel
Options).

Copying and Moving Cell Entries

To copy and paste data, select the range to be copied and use Ctrl-C, the Copy button on the Hom e tab, or
the right-click context m enu to copy the data.
Then select the upper-right-m ost cell in y our desired destination range, and use Ctrl-V, the Paste button
on the Hom e tab, or the right-click context m enu to paste the data.
To m ov e data, y ou can Cut rather than Copy , and then Paste.
Alternativ ely , y ou can use the m ov e pointer:

The Undo Command


7/52

10/13/13

Spreadsheet Modeling

Many operations can be undone using either Ctrl-Z or the Undo button on the Quick Access Toolbar:
Or, if y ou need to undo m ultiple operations, the drop-down list next to the Undo button:
Excel 2 007 allows undo operations ev en after a sav e, but not once the file has been closed.
Be aware that the undo stack is shared by all open workbooks; i.e., y ou cannot undo only a change to
Book1 if after that change y ou m ade a change to Book2 . You could, howev er, undo the change to Book2
and then the change to Book1 .

Increasing Spreadsheet Readability

It is often the case that the person who designs a spreadsheet application is not the end user, or the only
user, of the file. Designing for usability by others is im portant. Am ong other considerations, y ou m ight
want to m inim ize the am ount of tim e it takes others to understand how y ou hav e organized a workbook, or
lim it the way s in which they can introduce errors into a workbook. You m ight want to control the kind of
data that can be entered in cells, prev ent users from deleting form ulas, or ev en keep the workbook window
from being resized.
In this chapter, we will look at a few sim ple things y ou can do to m ake y our worksheets m ore user-friendly
in term s of sim ple readability . We will continue to work with the data from Le Napoleon's questionnaire.
We will use the file Increasing Spreadsheet Readability .xlsx, so please download this workbook now. Please
follow along as we outline changes to the workbook.

Working with Rows and Columns

The sum m ary worksheet needs a better indication that the figures on that sheet are av erages of the
questionnaire data for which an av erage is a m eaningful m easure. We will want to insert som e rows to
hold that inform ation and set it off from the table of av erages.
The Insert button and Delete button on the Hom e tab, in the Cells group, can also be used to insert and
delete rows.
On the sum m ary worksheet, insert one row abov e row 1 . Enter the text "Av erage for questions (5)-(1 1 )"
in cell A1 .
On the summary worksheet, increase the height of row 2 . Select colum ns A through H and double-click to
auto-adjust them to their contents. The result is clearly undesirable. Click the Undo button. Later in this
chapter, we will wrap the text in rows 2 and 4 before adjusting the colum n widths.
Assum e an em ploy ee at Le Napoleon is analy zing the questionnaire data on the bakery mon-thurs
worksheet and wants to get an opinion from som eone outside the com pany . Clearly Le Napoleon would
want to keep custom ers' nam es and addresses priv ate. Assum ing that the interaction is to take place in
person (i.e., the em ploy ee is not sending the workbook file outside the com pany ), one quick solution would
be to tem porarily hide those colum ns.
Rows can be hidden in the sam e m anner.
We would like to note that while hiding colum ns (or form atting cells with, e.g., white font on white fill,
for that m atter) can keep data out of v iew, it is not a way of form ally protecting sensitiv e data.

Making Better Use of Screen Space

Colum n headers are often longer than the area needed to display the data under them . We saw this on
the summary worksheet when we auto-adjusted colum ns A:H; they becam e far wider than necessary to
display the data. If m anagem ent wants to be able to v iew not only the av erages on the summary sheet but
also the clarify ing text, the cells containing that text will need to be form atted to m ake better use of
screen space. We will use text wrapping and other form atting techniques to accom plish this.
Text can also be rotated for a better fit or appearance. We will rotate the headers for the questions on the
summary worksheet.
Cell C3 , which helps to clarify questions (6 )-(1 1 ), is long enough that it causes its colum n to be
8/52

10/13/13

Spreadsheet Modeling

considerably wider than the others. This could be rem edied by m erging cells C3 :H3 . Merging cells can
interfere with the ability to copy form ulas and com plete certain other operations. Instead, we will center
the text in cell C3 across the range C3 :H3 . Unlike a m erge and center operation, this will allow Excel to
continue to treat cells D3 :H3 as indiv idual cells.

Basic Cell Formatting

The font face, font size, font color, and fill color can be set in a num ber of way s. One is through the
buttons in the Font group on the Hom e tab, in the Form at Cells dialog box, another is v ia the m enu. We
will change sev eral form ats in order to m ake the summary worksheet easier to read.
Borders and patterns can also be set in the Form at Cells dialog box. We will apply borders and patterns to
the range on the summary worksheet that contains the av erages.
Note that borders (but not patterns) can also be applied using the buttons on the Hom e tab, or the m enu
that appears when y ou right-click a selection.

Basic Number Formats

We will continue to im prov e the look and readability of the summary worksheet by m aking use of som e
of the m any different way s of display ing num eric v alues in Excel. Specifically , we want to display the
results of question (5), "To the nearest dollar, how m uch was y our order?," as dollar v alues, and to display
the rem aining num eric v alues on the worksheet with fewer decim al places than are currently display ed.
Also use the Decrease Decim al button to decrease the num ber of decim als display ed for the av erages for
questions (6 )-(1 1 ) to two. Do not form at these as currency , howev er.
In the Form at Cells dialog box, there are other pre-program m ed way s of display ing currency v alues and
other ty pes of num bers.
Note that Excel does not actually perform currency conv ersion when y ou change a v alue from being
display ed as U.S. dollars to being display ed as Euros. If y ou wanted to perform currency conv ersions on a
worksheet, use the pre-program m ed Currency Rates data connection file to insert current exchange rates
into y our workbook and update them at specified interv als. You can access this feature from the Data tab,
v ia the Existing Connections button in the Get External Data group.
There are m any other way s of display ing v alues (including date and tim e v alues, these being stored as
num bers). The table below presents just a few possibilities for form atting the v alues 1 2 3 4 56 7 89 and
.1 2 3 4 56 7 89 .
Keep in m ind that form ats are cosm etic changes only (i.e., the dashes in the social security form at shown
abov e are characters added by Excel when the num ber is "printed" to the screen they do not reside in
the cell itself).
Rather than using a cy clical calendar, Excel stores dates as v alues on a num ber line. While we m ight see
the date June 7 , 1 9 9 9 , as hav ing som ething in com m on with June 7 , 2 008, Excel knows the first of these
as the v alue 3 6 3 1 8 and the second as 3 9 6 06 .
To the right are som e dates and their equiv alent num eric v alues in Excel. We can see from the first fiv e
exam ples that 1 /1 /1 9 00 is the beginning of the Excel epoch, and that each date is 1 greater than the day
before. As Excel understands it, Prince was born on 2 1 3 4 3 !
What this m eans is that v alues m eant to be num eric in nature can be display ed as dates, and v alues
m eant to be dates can be display ed as num bers. Expecting to see a cell display , for exam ple, the num ber
1 3 as the output of som e operation, and instead seeing 1 /1 3 /1 9 00, can cause a good deal of confusion to
the beginning Excel user. By the sam e token, Excel will also be happy to form at Prince's birthday ,
6 /7 /1 9 58, as Currency , display ing $2 1 ,3 4 3 .00 as a result.
There are m any way s to display dates in Excel; on the right are som e exam ples using the preprogram m ed options in the Date category . Despite the differing lev els of specificity display ed by the
form ats used, the cells shown here contain identical v alues.
As efficiently as y ou can, select the dates in colum n B of the bakery mon-thurs worksheet. Form at these as
num ber with two decim al places, then currency , then percent. Note that the underly ing v alue in each
cell does not change as y ou m ov e from form at to form at. Then apply the date form at of y our choice.
9/52

10/13/13

Spreadsheet Modeling

Le Napoleon's bakers are accustom ed to looking at dates in European form at, in which the day precedes
the m onth. Ev ery once in a while, the pastry kitchen ends up preparing a special order for the wrong day
a costly error!
Within the form atting options for dates, the Locale setting allows us to display dates in a num ber of preprogram m ed international form ats. The screenshot below shows a subset of these.
When recording special orders, at least, the staff at Le Napoleon m ight want to change the locale to
French (France). This would allow the staff to enter dates in m m /dd/y y y y form at but hav e them display
on the worksheet in dd/m m /y y y y form at.
Note: If we wanted to affect the way dates are entered, not just display ed, we would need to configure the
Regional Settings in Windows.
Finally , we can create custom date form ats by choosing the Custom category and entering the date
form at desired. We'll form at the date 8/1 /2 008 so that it reads correctly .
Many other possibilities exist for custom form atting; this is a good option to keep in the back of y our m ind!

Conditional Formatting

There are m any instances in which we m ight want only certain cells to display a special form at. Le
Napoleon, for exam ple, m ight want to highlight av erages on the summary worksheet that m anagem ent
considers subpar. While we could identify and form at those av erages m anually , conditional form atting is
easier. It is also m ore powerfulsince it is dy nam ic, we will not hav e to redo the form at if we obtain new
data that driv es som e av erages up and out of the range that we wanted highlighted.
On the summary worksheet, we will form at the av erages for questions (6 )-(1 1 ) if the v alue in the cell is
below 3 .
Now we can easily see that parking m ight be a good problem to address at the bakery location, whereas at
the m all location (where Le Napoleon sells goods sent ov er from the bakery ), the v ariety of baked goods
appears to be an issue.
Also on the summary worksheet, we could use data bars to m ake it easier to com pare at a glance the four
av erages for question (5) "To the nearest dollar, how m uch was y our order?"
We'll explore a few m ore exam ples of conditional form atting in the Increasing Spreadsheet
Readability _orders.xlsx workbook. This workbook contains brief details for a num ber of special orders
that the clerks at Le Napoleon hav e taken; we could use this to gauge the general size of an order, whether
it m ight inv olv e ingredients or com ponents not usually part of the pastry kitchen, and when it needs to
be deliv ered or av ailable for pick-up. We can assum e that adequate details for the creation of each order
are stored where the chefs can access them as needed.
First, let's form at the dates for orders needed this m onth with a red sty le, and the dates for those needed
next m onth with a y ellow sty le.
As usual, select all of the cells that the form atting should apply to (cells B2 :B3 5 on the orders worksheet
in the Increasing Spreadsheet Readability _orders workbook). Then, from the Conditional Form atting
m enu, select Highlight Cells Rules, then A Date Occurring...
In the m enu box that appears, choose This Month, and Light Red Fill with Dark Red Text.
Repeat this process, choosing Next Month and Yellow Fill with Dark Yellow Text.
Managem ent m ight want to see at a glance which order totals are abov e the av erage. Conditional
form atting has a num ber of preprogram m ed options that com pare v alues in indiv idual cells to the entire
range of cells chosen for form atting.
To form at all of the order totals that are abov e av erage, first select cells E2 :E3 5. From the Conditional
Form atting m enu, select Abov e Av erage (note the other options in this list before doing so!).
In the m enu box that appears, choose a predefined sty le, or define y our own custom sty le. We hav e chosen
Green Fill with Dark Green Text:
The tim e of day that an order is needed can determ ine whether kitchen staff needs to prepare part of the
order the prev ious day , or com e in extra-early that day , or perhaps stay late that ev ening. We would like
10/52

10/13/13

Spreadsheet Modeling

to be able to see at a glance what tim e an order is due, without risking the kind of m istake that can occur
by m isreading AM for PM or v ice v ersa.
The preprogram m ed color scales in the conditional form atting option prov ide an easy solution. Select
cells C2 :C3 5. Then, from the Conditional Form atting m enu, choose Color Scales, and select a color scale.
(The Blue - Yellow - Red and the Red - Yellow options both prov ide reasonably intuitiv e form atting for the
problem at hand.)
To the right is what the data should look like if y ou chose the Blue Yellow Red option.
Finally , let's rev isit the form atting that we applied to the order totals. In addition to hav ing all abov eav erage order totals shaded (which we hav e already done), let's say the kitchen wanted to see at a glance
how critical each order is in term s of rev enue.
A color scale like the one that we applied in the prev ious exam ple would prov ide one quick solution, but it
would com pete v isually with the shading already present on abov e-av erage v alues in this range. An icon
set is a better way of keeping the existing shading and m arking a new distinction.
Select cells E2 :E3 5 and, from the Conditional Form atting m enu, choose Icon Sets. The Red to Black sty le
fits nicely with what we are try ing to accom plish heredistinguish these data v alues in another way
without m aking the result too v isually confusing.
The order total data should now look like what y ou see on the right here.
Increasing Readability Solution
Color scales, icons, and data bars hav e default settings that determ ine what v alues will be giv en what
form ats. You can change these settings, perhaps choosing a different threshold between a red and a light
red icon, or associating the short end of a data bar with a static v alue rather than whatev er happens to be
the lowest num ber in the range of cells (handy if y our dataset contains negativ e v alues).
These settings are configured in the New Form atting Rule or Edit Form atting Rule dialog boxes, which
y ou can access as y ou are first apply ing a form at, or after the fact, v ia the Conditional Form atting m enu.
If y ou are setting up a new rule that y ou want to configure m ore closely , choose the More Rules option
(after selecting the general rule ty pe; e.g., Icon Sets).
If y ou want to go back and configure an existing rule, select the relev ant range of cells, and from the
Conditional Form atting m enu, choose Manage Rules.
In the dialog box that appears, select the rule to be custom ized and click Edit Rule. This will open the Edit
Form atting Rule dialog box, where y ou can m ake adjustm ents to the behav ior of the rule.
Conditional form atting prov ides for m uch m ore powerful options than those that we hav e just seen. We'll
rev isit the topic of conditional form atting in a later chapter.

Formatting and Other Options with Paste Special

Som etim es we form at a cell or range of cells with the font colors, borders, patterns, and num ber form ats
we want, only to find that there are other cells that need to be form atted in a sim ilar m anner. The
Form at Painter, found on the Hom e tab, will allow us to copy all of the form ats from a cell and then paint
other cells with these form ats. What if we want to transfer just som e form ats from one cell to another,
howev er?
Excel has special options that y ou can choose from when com pleting a copy -paste operation. The Paste
Special dialog box (accessible v ia the Paste drop-down list on the Hom e tab) is shown below.

Setting Up a Worksheet for Printing

Now that the summary worksheet contains the form atting we want, we can set it up to display the way
we want on the printed page.
On the Page Lay out tab, Page Setup contains options for selecting the paper size, orienting data, changing
m argins, and so on.
Now click the Office Button, and from the list of Print options, select Print Prev iew. By default, Excel will
11/52

10/13/13

Spreadsheet Modeling

send the entire contents of a worksheet to the printer. Since cells J1 4 and J1 5 contain the nam e and
phone num ber of the group that designed Le Napoleon's questionnaire, Excel will want to print those cells.
Howev er, to do this and still use only one pageas we requested when we configured the Page Setup
optionswill require shrinking ev ery thing to the point that our av erages m ight becom e difficult to read.
Instead, let's hav e Excel print only those cells we want by m arking a range on the worksheet for printing.
Am ong other things, the Sheet tab in the Page Setup dialog also allows y ou to control whether a
worksheet's gridlines will print, to repeat the contents of a row or colum n on each sheet (useful for
printing headers like our respondent's index num bers, or our question num bers on ev ery page of a
m ulti-page print job), and to print Excel's colum n headings (A, B, C, etc.) or row labels on each page of a
m ulti-page print job.

Excel Formulas

People use spreadsheets to com pute quantities of interest. In any cell of a spreadsheet we are free to enter a
form ula to com pute a quantity of interest. For exam ple, the m anagem ent of Le Napoleon m ight want to
com pute the following quantities:
Each em ploy ee's weekly pay check and the total weekly pay roll
The cost of producing v arious ty pes of cakes
The cost of purchasing sugar, butter, and flour from each supplier as well as the total am ount we
owe each supplier
The annual profit from the sale of Sacher Tortes, using v arious price and unit cost scenarios.
In this unit we will use Excel form ulas to efficiently and easily com pute these quantities of interest, We will
see that in order to efficiently use form ulas we m ust hav e an understanding of the spreadsheet Copy
com m and. Our work in this unit will use the file Excel Form ulas.xlsx, so please download this workbook
now.

Copying Formulas

In worksheet Wages of the file Excel Form ulas.xlsx we com pute the weekly wage for our 8 em ploy ees
(their nam es are in cells B4 :B1 1 ). For each em ploy ee we are giv en (in cells C4 :C1 1 ) the hours each
em ploy ee worked this week, and in cells D4 :D1 1 we are giv en each em ploy ee's hourly wage.
Now we could com pute Will Wong's salary in E5 with the form ula = C5*D5 and continue onward and
enter a form ula to com pute each em ploy ee's salary . Of course, if we hav e hundreds or thousands of
em ploy ees, this would be really tedious. Fortunately , Excel's ability to let us "copy " form ulas elim inates
this problem . What we really want to do in each of cells E4 :E1 1 is to m ultiply the two num bers to the left
of colum n E in the sam e row.
To accom plish this goal we sim ply "copy " our form ula in E4 to the cell range E5:E1 1 . Then in cells E5:E1 1
our copied form ula will try to do in cells E5:E1 1 exactly what it did in cell E4 (m ultiply the num bers in
the sam e row in colum ns C and D). Basically , when y ou copy a form ula that has no $ signs attached to
cell addresses (m ore on $ signs later, but do not worry about them now!), then if y ou copy a form ula down
a row the row num bering the form ula is increased by 1 , and if y ou copy a form ula across and to the right
one row the colum n num ber is increased by 1 .

The Autocomplete Formula Option


Try to use the Autocom plete feature to com pute the av erage am ount paid this week to our em ploy ees.
Hint: AVERAGE is the Excel function for com puting an av erage.

Entering Formulas by Pointing

If we ty pe in a com plex form ula, then we can easily ty pe in the incorrect cell reference. Most users of
Excel prefer to enter form ulas by "pointing" to the cells referenced in the form ula.
Use pointing to reenter the form ula used to com pute our total weekly pay roll.

Other Ways to Copy Formulas


12/52

10/13/13

Spreadsheet Modeling

In the sheet Suppliers of the workbook Excel Form ulas.xlsx we are giv en the per pound cost of purchasing
Sugar, butter and flour from our 6 suppliers. We are also giv en the pounds of each com m odity purchased
from each supplier.
In the cell range J9 :L1 4 we want to com pute the cost of ordering each com m odity from each supplier.

Absolute Addressing

Let's suppose that our Praline torte, Sacher torte, and Opera torte m ust each hav e the sam e diam eter
and height (which we enter in cells D1 0 and D1 1 ). Also assum e that the cost per cubic inch for the Praline
torte is $0.1 0, for the Sacher torte $0.1 1 , and for the Opera torte $0.1 2 . Let's create a spreadsheet (see
sheet Cakecost of file Excel_Form ulas.xlsx) that com putes the cost of producing each ty pe of cake. The
v olum e of a cake with radius r and
height h is r 2h. Here r = cake radius in inches and h = cake height in inches. Recall that radius =
diam eter/2 .
We want to enter a form ula in E1 5 to com pute the cost of producing the Sacher torte. Then we hope to
copy this form ula down to the range E1 6 :E1 7 and thereby com pute the cost of producing the other cakes.
Clearly our cost form ula in cell E1 5 will need to depend on the diam eter and height which are giv en in
cells D1 0 and D1 1 . The problem is that if we reference D1 0 and D1 1 in our form ula in cell E1 5 and copy
the form ula down, then D1 0 will change in cell E1 6 to D1 1 and D1 1 will change in cell E1 6 to a D1 2
reference. We do not want this to happen! The solution is to enter cell D1 0 in our form ula as $D$1 0 and
enter cell D1 1 in our form ula as $D$1 1 . A $ sign before the row of a cell reference ensures that when we
copy the form ula the row reference rem ains unchanged. Sim ilarly , a $ sign before the num ber in a cell
reference ensures that when we copy the form ula the colum n reference rem ains unchanged.

Using the F4 Key


Suppose we had not put $ signs on the D10 and D11 cell references in E15. Then when we copied the
form ula to cell E16 cell E16, would contain the following form ula: =PI()*(D11/2)^2*D12*D16.
This would certainly giv e an incorrect answer.

Hierarchy of Mathematical Operations

The astute student is probably wondering why we used parentheses in our cell E1 5 form ula, instead of
ty ping the form ula as:
=PI()*($ D$ 10/2)^2*$ D$ 11*D15.
Operation(s) contained in parentheses are carried out first followed by operations inv olv ing exponents.
Then div ision or m ultiplication operations are giv en equal precedence. Operations inv olv ing
m ultiplication and div ision are giv en equal precedence and are then carried out from left to right.
Finally , operations inv olv ing addition and subtraction are giv en equal precedence and are then carried
out from left to right.
Without the parentheses, Excel would square 2 (obtaining 4 ) and then com pute $ D$ 10/4 which equals
2 . We want, of course, the part of our form ula inv olv ing D10/2 to y ield 1 6 and not 2 . Inserting ( ) around
$ D$ 10/2 ensures that we first div ide the contents of cell D10 by 2 and then square the result (this y ields
42/2 = 8, as desired).

Summation Icon

Now let's efficiently com pute our total bill for each com m odity and the total am ount we need to pay
each supplier. To determ ine the total am ount we owe each supplier we could sim ply copy from H2 3 to
H2 4 :H2 7 the form ula = SUM(E2 3 :G2 3 ). Then we could com pute the total bill for each com m odity by
copy ing the form ula = SUM(E2 3 :E2 8) from cell E2 9 to the range F2 9 :G2 9 . There is nothing wrong with
this m ethod but here's an easier way .

Editing or Correcting Formulas


Showing the Actual Formula in a Cell
13/52

10/13/13

Spreadsheet Modeling

Do It Yourself Exercise

Suppose our annual dem and for Sacher Torte equals 7 000 m inus 2 00 tim es (price of Sacher Torte).
Producing Sacher Tortes incurs an annual fixed cost of $5000. Construct a table which shows how our
annual profit from Sacher Tortes v aries as the cost of producing a Sacher Torte v aries from $1 7 .00 to
$2 4 .00 and the price of a Sacher Torte v aries between $2 5 and $3 5.
Excel Form ulas Exercise Solutions

Useful Excel Functions

If y ou like to cook y ou know how judicious use of key ingredients is a key factor in m aking that perfect
m eal. Sim ilarly in Excel, m astery of Excel's m any powerful functions will help y ou create that "spreadsheet
m asterpiece".

IF Statements

Let's suppose Le Napoleon is considering three proposals for giv ing price discounts according to the
following guidelines:
Proposal 1: When quantity of a product bought by a custom er exceeds a giv en threshold, all units
of that product are discounted. For exam ple, if less than 1 00 Napoleons are bought by a custom er,
that custom er pay s $3 .50 per Napoleon. If at least 1 00 Napoleons are bought, the custom er pay s
$3 .1 5 per Napoleon.
Proposal 2: Instead of one price break point, there are two price break points. For exam ple, if a
custom er buy s fewer than 1 00 Napoleons, that custom er pay s $3 .50 per Napoleon. If between 1 00
and 1 2 9 Napoleons are bought, we giv e the custom er a 1 0% discount on each unit purchased. If at
least 1 3 0 Napoleons are bought, we giv e a 1 5% discount on each unit.
Proposal 3: When quantity of a product bought by a custom er exceeds a giv en threshold, all units
of that product are discounted. For exam ple, if less than 1 00 Napoleons are bought by a custom er,
that custom er pay s $3 .50 per Napoleon. If at least 1 00 Napoleons are bought, the custom er pay s
$3 .1 5 per Napoleon. If a custom er is a friend of an em ploy ee and that custom er's purchase
quantity exceeds the sam e threshold, the custom er receiv es an extra 50% discount on each unit
purchased.
You hav e been asked to set up a spreadsheet that com putes (giv en the quantity purchased of each
product) a custom er's total cost of purchasing each product.
To accom plish this goal we will use IF form ulas. IF form ulas let y ou conduct conditional tests on v alues
and form ulas. An IF form ula begins with a condition such as A1 > 1 0. If the condition is true, the form ula
returns the first v alue listed in the form ula; otherwise we m ov e on within the form ula and repeat the
process. We now illustrate how IF form ulas work by showing how to write form ulas im plem enting pricing
proposals 1 -3 .
We now show how to com pute the price paid by a custom er for each product and the total am ount paid if
the pricing structure is as follows. When quantity of a product bought by a custom er exceeds a giv en
threshold, all units of that product are discounted. For exam ple, if less than 1 00 Napoleons are bought by
a custom er, that custom er pay s $3 .50 per Napoleon. If at least 1 00 Napoleons are bought, the custom er
pay s $3 .1 5 per Napoleon. Please download file IF.xlsx.
We see, for exam ple, that if a custom er buy s 9 9 or fewer Napoleons, each one costs $3 .50 while if at least
1 00 Napoleons are bought, the custom er receiv es a 1 0% discount. Let's now write form ulas that com pute
for each custom er the unit price that custom er pay s for each product and the total am ount paid for each
product.
We now show how to com pute the price paid for each product and the total am ount paid if instead of one
price break point, there are two price break points. For exam ple, if a custom er buy s fewer than 1 00
Napoleons, that custom er pay s $3 .50 per Napoleon. If between 1 00 and 1 2 9 Napoleons are bought we
giv e the custom er a 1 0% discount on each unit purchased. If at least 1 3 0 Napoleons are bought we giv e a
1 5% discount on each unit.
We see, for exam ple, that if a custom er buy s 9 9 or fewer Napoleons, each one costs $3 .50, while if the
custom er buy s between 1 00 and 1 2 9 Napoleons, the custom er receiv es a 1 0% discount on each unit
14/52

10/13/13

Spreadsheet Modeling

purchased. If at least 1 3 0 Napoleons are bought, the custom er receiv es a 1 5% discount on each unit
purchased. Let's now write form ulas that com pute for each custom er the unit price that custom er pay s
for each product and the total am ount paid for each product.
We now show how to com pute the unit price paid for each product and the total cost of each product if the
following price structure is used. When quantity of a product bought by a custom er exceeds a giv en
threshold, all units of that product are discounted. For exam ple, if less than 1 00 Napoleons are bought by
a custom er, that custom er pay s $3 .50 per Napoleon. If at least 1 00 Napoleons are bought, the custom er
pay s $3 .1 5 per Napoleon. If a custom er is a friend of an em ploy ee and that custom er's purchase quantity
exceeds the sam e threshold, the custom er receiv es an extra 50% discount on each unit purchased. An x in
Colum n E indicates the person is a friend. Recall that in an IF statem ent we first check the left-hand-m ost
condition. Therefore we m ust first check if the custom er is a friend and has purchased enough to get a
discount. If so, that custom er's discount is 1 .5 tim es the entry in colum n D (which we com pute in colum n
F). If custom er is not a friend who has bought m ore than the num ber needed for the discount, then we
giv e a discount equal (in percentage term s) to the entry in colum n D. If neither condition is true, then
the custom er is charged the full price.
We had two ending ) in our IF statem ent: one to m atch each IF statem ent.
When we hav e m ore than one occurrence of IF in a form ula we refer to the form ula as a Nest ed IF
st at ement .
In addition to the AND operator, we can use the OR and NOT operators in a nested if statem ent.
AnOR operator returns "true" if and only if at least one of the conditions within( ) is true. For
exam ple, the form ula IF(OR(E2 = "x",G2 > = C2 ),(1 -F2 )*B2 ,B2 ) would giv e a 1 5% discount if a
person was a friend or ordered at least 1 00 Napoleons and would otherwise giv e no discount. A
NOT operator returns TRUE if and only if the condition within ( ) is FALSE. For exam ple, the
form ula = IF(NOT(E2 = ?x?),B2 ,IF(G2 > = C2 ,(1 -F2 )*B2 ,B2 )) would charge full price to any one who
is not a friend. Then for friends we would giv e a 1 5% discount if they ordered at least 1 00
Napoleons. Otherwise, we would charge full price.
Let's test our m astery of IF statem ents by try ing the following problem s:
Currently we charge $3 0 for a Sacher Tort and our com petitor charges $2 5. If our com petitor
charges below $2 0 we will lower our price to $2 5. Write a form ula which returns our price after
we enter the com petitor's price in the spreadsheet.
In the gam e of craps two dice are rolled with a total between 2 and 1 2 resulting. A 7 or 1 1 on first
roll results in a win, a total of 2 , 3 or 1 2 results in a loss, and otherwise the gam e continues. Write
a form ula that returns the gam e status after the first two dice are rolled.
IF Statem ent Exercise Solutions

Text Functions

Often we im port data to a spreadsheet from a web site or the corporate database. Many tim es the data
does not look the way we want. For exam ple, we m ay im port the current m onth's sales of each product
from a database and the data m ight look as follows:
We would like to extract the num ber sold of each product to a separate cell. For exam ple, put 1 7 8 in cell
F3 . Excel's collection of text functions helps us clean up and m anipulate data that does not quite look the
way we want. In this section y ou will m aster the LEFT, RIGHT, MID, LEN, FIND, VALUE, and
CONCATENATE text functions. Please download file Text.xlsx.
Let's now show how to extract the sales of each product to colum n G. The key is to find the first space and
take ev ery thing out of colum n E that is to the left of the first space.
There is a problem , howev er. Looking at colum n G we see that all entries are left justified. This m eans
that Excel will treat the contents of these cells as text, not as a num ber. Thankfully , the VALUE function
allows us to painlessly conv ert text to a num ber. Sim ply put between ( ) the text or cell whose contents
y ou conv erted to a num ber.
Sim ilar to the LEFT function, the RIGHT function (sy ntax RIGHT(cell, n)) will grab the right-hand-m ost
n characters from a cell. The LEN function (sy ntax Len(cell)) returns the num ber of characters
(including spaces ) in a cell. In colum n D of the sheet Names we are giv en the nam es of our em ploy ees.
In colum n G we will extract each em ploy ee's last nam e. First in colum n E we find the location of the space
between the first and last nam e. Then in colum n F we determ ine the num ber of characters in the person's
nam e (including the space). Finally , in colum n G we use the RIGHT function to extract the em ploy ee's
15/52

10/13/13

Spreadsheet Modeling

last nam e.
The MID function is used to extract part of a cell's contents that starts in "the m iddle" of the cell. The
sy ntax of the MID function is MID(cell, s, n). MID(cell, s, n) would start at character s of the giv en cell and
extract the next n characters. In sheet Middle we will use the MID function and FIND function to extract
each em ploy ee's m iddle nam e to colum n.
We will use the FIND function to find the location of the first and second spaces in the person's nam e. Then
we can use the MID function to extract to colum n G all characters between the first and second space.
This will, of course, result in colum n G containing each person's m iddle nam e.
All exercises for this chapter are in the file Textexercises.xlsx.
The sheet Movies giv es the num ber of copies of each m ov ie in stock at a v ideo store. Put the nam e
of the m ov ie in one colum n and the num ber of copies in the next colum n.
The sheet ID giv es a product ID, followed by a product nam e followed by a product price. Extract
the product nam e to a separate colum n. The price alway s is expressed using 4 characters.
Text Functions Exercise Solutions
Often data com es into Excel from a web site or data base separated by com m as, spaces, or other
characters. Using Data Text to Colum ns it is easy to parse the data to m ultiple colum ns of cells.
Worksheet Text to Columns contains each em ploy ee's nam e in cells D7 :D1 4 . Our goal is to place each
person's first nam e in colum n E, m iddle nam e in colum n F and last nam e in colum n G.
In worksheet email, cells G7 :G1 4 contain each em ploy ee's last nam e. We would like to giv e each em ploy ee
an em ail address by appending @Napoleon.com to the em ploy ee's last nam e. This is easily done using the
& sign which is often referred to as the concatenation operator. Any use of an & sign joins what com es
before and after the & sign. If y ou want to insert text enclose the text in ".
In sheet addresses com bine the street address, state, and zip code into a single cell.
Text Functions Exercise Solutions

Basic Date and Time Functions

Please download workbook Datesandtim es.xlsx. We begin by noting that if y ou bring up the Form at Cells
Dialog box (the easiest way to do this is to hit Control+ 1 ), then by selecting Date or Tim e y ou m ay choose
the way y ou want dates and/or tim es display ed.
Le Napoleon has entered in cells E6 :E1 0 the dates certain cash flows were receiv ed. They would like to
extract the m onth, day of the week, y ear, and day of the m onth into colum ns F-I, respectiv ely . The
following EXCEL DATE functions will help us accom plish this goal. For a giv en date:
MONTH(date) returns the date's m onth.
WEEKDAY(date,2 ) returns the day of the week for the date, with 1 = Monday , 2 = Tuesday , ...7 =
Sunday .
YEAR(date) returns the date's y ear.
DAY(date) returns the date's day of the m onth.
All exercises for this chapter are in the file Datehw.xlsx.
The file Datehw.xlsx contains the first day we sold each product and the first tim e of day we hav e the
product av ailable.
Extract the y ear, day of week, day of m onth, and m onth that we first sold each product.
Date and Tim e Exercise Solutions
Le Napoleon has entered in the range F1 4 :F1 7 the tim e 4 em ploy ees began their work day . They want to
extract the hour, m inute and second of the start tim e. The following EXCEL TIME functions will help us
solv e our problem :
For a giv en tim e HOUR(tim e) will return the hour for the giv en tim e.
For a giv en tim e MINUTE(tim e) will return the num ber of full m inutes after the hour for the
giv en tim e.
For a giv en tim e SECOND(tim e) will return the num ber of seconds for the giv en tim e.
16/52

10/13/13

Spreadsheet Modeling

Extract the hour and m inute at which we hav e each product first av ailable.
Date and Tim e Exercise Solutions
The EXCEL DATE function (sy ntax DATE(y ear, m onth, day of m onth)) allows us to recreate a date if we
are giv en the date's y ear, m onth, and day of m onth.
The EXCEL TIME function (sy ntax (Tim e(hour, m inute, second)) allows us to recreate a tim e giv en the
hour, m inutes after the hour, and seconds for the giv en tim e.
There is an easy way to display the current date or current date and tim e in a cell. Entering the function
= TODAY() (m ay be this used to be Katy Couric's fav orite function!) in a cell enters the current date, while
entering the form ula = NOW() display s the current date and tim e in a cell. Observ e in cell B3 that
entering = TODAY() ensures that the current data is alway s display ed in cell B3 , while entering = NOW()
in B5 ensures that the current date and tim e are entered in cell B5.
Finally , we note that if y ou form at a date as a num ber or choose the General form at, Excel returns the
num ber of day s that the giv en date is after January 1 , 1 9 00. Excel giv es January 1 , 1 9 00, a serial
num ber of 1 , January 2 1 9 00, a serial num ber of 2 , etc. If we form at a tim e as a num ber, Excel returns
the fraction of a day after m idnight that the giv en tim e occurs. To illustrate, look at the range D5:G1 0 of
the sheet Num ber.
Note, for exam ple, that August 1 5, 2 009 , is 4 0,04 0-1 day s after January 1 , 1 9 00. Also note that, for
exam ple, 5:4 0 PM is 7 4 % of the way between m idnight and the start of the next day .

Range Names

Suppose cell B500 of y our workbook contains Le Napoleon's sales in January and cell B501 contains our
February sales. If we want to com pute our total sales in January and February we could enter the
form ula = B500+ B501 . Then nobody would know what we are doing. Wouldn't it be nice (as the Beach
Boy s used to say ) if the form ula showed up as = JAN+ FEB. In this section we will show y ou how to nam e
cells or ranges of cells in y our spreadsheet and use the range nam es y ou create in y our form ulas. Using
range nam es often reduces the effort needed to create im portant form ulas. More im portant, using range
nam es m akes it easier for y our colleagues to understand y our work.
Please download files Rangetem p.xlsx and Rangehw.xlsx.
In the sheet Name Box of Rangetem p.xls we see our January and February sales. We would like to giv e
cell E5 the range nam e Jan (for January ) and cell E6 the nam e Feb (for February ). We can easily nam e
these cells using the Nam e Box (located right abov e the label for Colum n A).
The worksheet Create from selection giv es Le Napoleon's sales in som e U.S. cities. We would like to nam e
the actual sales am ount in colum n D with the city nam e from colum n C. For exam ple, we would like cell
D4 to be nam ed Los Angeles.
Using the Nam e Box to assign the city nam es to each sales v alue would require that we use the Nam e Box
2 4 tim es. There m ust be an easier way ! Excel's Create From Selection option allows us to create range
nam es based on the text in the spreadsheet.
How can we edit, or delete, range nam es? Sim ply use the Nam e Manager.
We often analy ze data in Excel. If y ou do not nam e the data, then y ou m ust point to the data each tim e
y ou use it in a form ula. If, for exam ple, our data is in Colum n A and our form ula is in Colum n Z then each
tim e we want to create a form ula we m ust m ov e back and forth between Colum ns A and Z. If we nam e
our data, we nev er need to point to the data again! In worksheet Quarterly Revenue, we list our rev enue in
each city for each quarter of the y ear. We will nam e each quarter of data and then com pute im portant
statistics for each quarter of sales.
We can also use the Paste Nam es dialog box to paste a list of all the workbook's range nam es into y our
worksheet.
Hopefully y ou are getting to like range nam es. You will probably return to spreadsheets y ou hav e
already worked on and create range nam es. At first glance y ou will probably be disappointed because the
range nam es will not show up in y our form ulas. To m ake sure y our range nam es are used in y our
form ulas y ou need to select Apply Nam es from the drop down arrow in the Nam e Manager portion of the
Form ula tab. Please v iew the workbook Apply Names in Rangetem p.xlsx. This workbook com putes the
profit earned from our Sacher Torte. Our form ula in cell E7 for profit currently reads as = (E4 -E5)*E3 -E6 .
17/52

10/13/13

Spreadsheet Modeling

Using range nam es we would like to express this form ula as = (price-unit_cost)*units_sold-fixed_cost.
Please download file Rangehw.xlsx.
In worksheet States, nam e each state's sales with the state abbrev iation. Then add up
Massachusetts and New York sales.
In worksheet Regions, create a nam e for all sales during each m onth and all sales in each region.
Write a form ula using range nam es that adds up all East sales and all April sales.
Range Nam es Exercise Solutions

Lookup Functions

Please download file Lookupstem p.xlsx. Consider the following three problem s:
Problem 1: Our unit cost per clair to a custom er depends on the num ber of clairs they order as shown
in worksheet Vlookup true. Write a form ula to determ ine the unit cost of clairs for the clients listed in
this worksheet.
Problem 2: In sheet Vlookup false we want to determ ine the cost of each order. To this we m ust look up
the price of the products listed in A2 0:A2 8. Write form ulas to determ ine the total cost of each order.
Problem 3: We are charging $3 0.00 for a Sacher Torte during the first quarter of 2 01 0. During each
quarter of 2 01 0 we want to increase the price 5%. Write a form ula that determ ines for any date in 2 01 0
the price of a Sacher Torte.
We will solv e our three problem s using lookup functions. Our first two problem s require the use of
VLOOKUP functions, while our third problem requires the use of HLOOKUP functions.
A VLOOKUP (V stands for v ertical) tries to "m atch" a num ber or text string in the first colum n of a range
of cells (called the table range). Then we m ov e to a desired colum n and return the num ber in the desired
colum n that is in the sam e row as the "m atch." If the first colum n of the table range is numbers in
ascending order, then we use the sy ntax VLOOKUP(lookup v alue, table range, colum n index).
This form ula will keep com paring the lookup v alue to the entries in the first colum n of the table range. As
long as the lookup v alue is > = to the num ber in the first colum n of the table range, we keep m ov ing down
the table. As soon as the lookup v alue is < the num ber in first colum n of the table range, we stop and
m ov e to the colum n index colum n to find the v alue returned by the lookup function. We now will use a
v lookup function to help us determ ine the total cost of each custom er buy ing clairs from Le Napoleon.
We hav e nam ed our table range C4 :D8 as lookcost. References to range nam es refer to the sam e range of
cells when we copy a form ula. This fact ensures that when we copy our v lookup form ulas we will not
hav e to place $ signs on the table range.
When the first colum n of the table range is not numbers in ascending order, then we should use the
following sy ntax for the v lookup function: v lookup(lookup v alue, table range, colum n index, false). The
insertion of false ensures that the lookup function will look for an exact m atch to the lookup v alue in the
first colum n of the table range. If such an exact m atch exists, then we pick off the entry in the colum n
index colum n of the row in the table range where the lookup v alue is m atched. If there is no m atch, then
the Exce1 error m essage #N/A, which m eans that there is no answer or no av ailable m atch, will appear.
Let's use v lookup with the false option to lookup (in worksheet v lookup false) the total cost of the products
orders based on rows 2 0-2 7 . We hav e nam ed our table range (A3 :B1 6 ) as lookprice.
When we want to m atch an entry in the first row rather than first colum n of a table range, then we use
an HLOOKUP (H for horizontal) function). The sy ntax is identical to VLOOKUP with row index replacing
colum n index. We now use HLOOKUP functions to solv e the following problem : We are charging $3 0.00
for a Sacher Torte during the first quarter of 2 01 0. During each quarter of 2 01 0 we want to increase the
price 5%. Write a form ula that determ ines for any date in 2 01 0 the price of a Sacher Torte.
Our work is in worksheet Growth. We hav e nam ed cell D1 growth and the table range C2 :F3 Dateprice.
Please download file Vlookuphw.xlsx.
Rows 3 -1 2 giv e the age and salary of som e of y our friends. In rows 1 5-1 8 write form ulas to enter
each person's age and salary .
18/52

10/13/13

Spreadsheet Modeling

When a custom er orders < 1 00 Pear Charlottes, that custom er pay s $2 5 per cake. When the order
is between 1 00 and 1 9 9 Pear Charlottes, they pay $2 3 .00 per cake. If they order at least 2 00 Pear
Charlottes the custom er pay s $2 0.00 per cake. Write a form ula that will com pute the cost of
ordering any num ber of Pear Charlottes.
VLOOKUP Exercise Solutions

Other Lookup & Reference functions

Two other useful functions in Excel's Lookup & Reference function category are INDEX and MATCH. The
INDEX function can be used to easily extract any entry from a rectangular array of cells. The MATCH
function can be used to locate a text string in a row or colum n. We will soon see that together these two
functions giv e us a great "one-two punch" that can be com bined to great benefit.
Sim ply stated, the INDEX function extracts an entry from a giv en row and colum n of a rectangular
array of cells. The sy ntax of the INDEX function is = INDEX(array , r, c.). Then the INDEX function
returns the entry in row r and colum n c of the giv en array . Please download the file
Indexm atchtem p.xlsx. Worksheet I ndex contains the m onthly sales for each product. Let's write a
form ula to return in cell B1 8 the sales of Opera Tortes during February .
Write a form ula that returns Vanilla clair sales during April.
Index and Match Exercise Solutions
The MATCH function looks to m atch a text string or num ber in a row or colum n. The sy ntax = MATCH
(lookup v alue, lookup range,0) works as follows. If the lookup range is in a single colum n, the MATCH
function finds the first occurrence of the lookup v alue and returns how m any rows down the lookup v alue
is in the lookup range. If the lookup range is in a single row, then the MATCH function finds the first
occurrence of the lookup colum n and returns how m any colum ns across the lookup v alue is in the lookup
range. The last argum ent of 0 is needed because usually our lookup range will not hav e sorted v alues. We
will not discuss MATCH functions with last argum ents of + 1 or -1 since they are rarely used. As an
exam ple of the use of the MATCH function let's find the first occurrence of Pear Charlotte in the list of
products in colum n F of worksheet Match and index. We note that if no m atch exists then Excel will return
a #N/A error.
What we want to do now is to write a form ula which will return, for any com bination of product and
m onth, the sales of the product during the giv en m onth. For exam ple, if we enter Pear Charlotte in cell
A1 8 and February in cell B1 8, we would like to hav e a form ula that returns the February sales of Pear
Charlotte. Our strategy will be to find the row for the product and the colum n for the m onth using the
MATCH function. Then we can use the INDEX function to return the actual product sales during the
giv en m onth.
Please download file Indexm atchhw.xlsx.
The worksheet Indexm atchhw.xlsx contains our em ploy ees nam es and salaries. Write a form ula
that would return the nam e of the em ploy ee with the largest salary . Hint: The MAX function
returns the largest num ber in a colum n.
Suppose we can enter an em ploy ee's nam e in cell D1 . Write a form ula in cell E1 2 that returns the
em ploy ee's salary .
Index and Match Exercise Solutions

Error Trapping

Suppose we attem pt to com pute av erage price as rev enue div ided by units sold. If units sold = 0 we will
get a #DIV/0! error. If we write a lookup form ula to return the price of a product and we m isspell the
product's nam e, we will receiv e a #N/A error. There are m any other error m essages that can pop up in
EXCEL. Using the Excel IFERROR function we can replace these error m essages by an explanatory text
m essage. The sy ntax of IFERROR is IFERROR(excel, form ula, desired m essage). If the Excel form ula
returns a v alue without an error, then this v alue is inserted in the cell. Otherwise the desired error
m essage is entered in the cell.
Please download the file Errortraptem p.xlsx. This worksheet shows the price for each product as well as
the quantity ordered of each product. We want to determ ine the av erage total cost of each ordered
product. Once we use a VLOOKUP form ula to determ ine the unit cost for each product, cell G1 4 would
19/52

10/13/13

Spreadsheet Modeling

determ ine the av erage cost of the orders. The problem is that we hav e ty ped in Napoleon in cell D1 2
instead of the actual product nam e Napoleon (piece) so a VLOOKUP form ula will y ield an error. Suppose
we want to ensure that any VLOOKUP which returns an error will hav e a _ show up instead of an error
m essage. To accom plish this goal we sim ply copy from F9 to F1 0:F1 3 the form ula
= IFERROR(VLOOKUP(D9 ,lookup,2 ,FALSE),"_"). Note we hav e also copied the form ula
= IFERROR(E9 *F9 ,"_") to G1 0:G1 3 to ensure that no error m essages show up in colum n G.
Please download the file errortraphw.xlsx.
File Errortrap.xlsx contains in colum ns A and B prices at which hom es were bought and sold. If a
hom e has not y et been sold, the sell price colum n say s not sold y et. In colum n C com pute the profit
earned on each sold house. If a house has not been sold, y our form ula should say not sold y et.
Error Trapping Exercise Solutions

Rounding Functions

Often we want to round the contents of a cell up or down to the nearest integer. The Excel functions
ROUNDUP, ROUNDDOWN, ROUND and INT are useful in these situations. A description of the sy ntax of
each function follows:
ROUNDUP(num ber,n) rounds the num ber up (away from 0) using n significant digits. Using n =
0 results in the num ber being rounded up to the nearest integer. For exam ple, ROUNDUP(3 .2 ,0)
returns 4 and ROUNDUP(PI(), 2 ) returns 3 .1 5.
ROUNDDOWN(num ber, n) rounds the num ber down (t oward 0) using n significant digits. Using
n = 0 results in the num ber being rounded down to the nearest integer. For exam ple,
ROUNDDOWN(3 .2 ,0) returns 3 while ROUNDOWN(PI(), 2 ) returns 3 .1 4 .
ROUND(num ber, n) rounds the num ber to n significant digits. If there is a tie on which num ber to
round to, Excel rounds to the highest num ber. For exam ple ROUND(3 .5,0) y ields 4 . Also
ROUND(3 .4 ,0)+ returns 3 and ROUND(3 .6 ,0) returns 4 .
INT(num ber) rounds the num ber down to the nearest integer. For exam ple INT(3 .4 ) returns 3
and INT(-4 .7 ) returns -5.
For positiv e num bers there is no difference between the ROUNDDOWN and INT function. For
exam ple INT(4 .8) = ROUNDDOWN(4 .8,0) = 4 . For negativ e num bers, howev er, the
ROUNDDOWN and INT functions m ay y ield different results. For exam ple INT(-4 .3 ) = -5 but
ROUNDDOWN(-4 .3 ,0) = -4 .
Please download the file Roundingfunctionstem p.xlsx. Suppose Le Napoleon m ust purchase flour in sacks
weighing a giv en am ount. Giv en a need for flour, how can we write a form ula that tells Le Napoleon how
m any sacks they need to purchase? We sim ply need to div ide the needed pounds of flour by the sack size
and then use the ROUNDDUP function to round the answer up to the nearest integer. We nam ed the
num ber of pounds in a sack with the range nam e package_size.
Now let's suppose when we pay a bill and are 1 full m onth late (1 m onth = 3 0 day s) we pay a 5% penalty .
If we are 2 full m onths late we pay a 1 0% penalty , and if we are 3 or m ore m onths late we pay a 1 5%
penalty . Giv en the num ber of day s we are late, we want to write a form ula that returns our percentage
penalty . Essentially we need to take DAYSLATE/3 0 and round it down to the largest integer
< = DAYSLATE/3 0. Then we can use a VLOOKUP form ula to return our percentage penalty . We will show
how either the INT function or ROUNDDOWN function can be used to solv e this problem .
Finally , let's suppose our penalty is based on the num ber of m onths (3 0 day s = a m onth) rounded to the
nearest m onth. For exam ple, 4 5-7 4 day s is two m onths, 1 5-55 day s is one m onth, etc. In this situation we
will use the ROUND function to round DAYSLATE/3 0 to the nearest integer.
Please download the file Roundingfunctionshw.xlsx.
This file giv es the dates when sev eral houses were bought and sold. Use rounding functions to
com pute the num ber of full y ears each house was owned before it was sold. Assum e 3 6 5 day s = 1
y ear. For exam ple, a house kept for 7 00 day s was kept for one y ear.
Com pute the num ber of y ears, rounded off to the nearest integer, for which each house was owned.
Hint: Subtracting dates giv es the num ber of day s between the dates.
Rounding Functions Exercise Solutions

The SUMPRODUCT Function


20/52

10/13/13

Spreadsheet Modeling

Suppose y ou hav e the num ber of hours each em ploy ee worked this week in cells A1 :A1 0 and the num ber
of hours each em ploy ee worked in cells B1 :B1 0. You want to com pute y our total pay roll for the week. We
could of course enter the form ula = A1 *B1 + A2 *B2 + ? + A1 0*B1 0. This would be tedious and we would
probably m ake som e errors while entering this form ula. Entering the form ula = SUMPRODUCT(A1 :A1 0,
B1 :B1 0) would be an easy way to com pute our total pay roll. Usually the SUMPRODUCT function has two
argum ents consisting of cell ranges hav ing exactly the sam e dim ension. Then the SUMPRODUCT
function m ultiplies the corresponding com ponents of each cell range. If one cell range is a row with n
cells, then the other cell range m ust also be a row with n cells. If one cell range is a colum n with n cells,
then the other cell range m ust be a colum n with n cells. Finally , if one cell range is a range with m rows
and n colum ns, then the other cell range m ust also contain m rows and n colum ns.
To illustrate the use of the SUMPRODUCT function, let's determ ine Le Napoleon's total pay roll for a week.
Please download the file Sum producttem p.xlsx.
Please download the file Sum producthw.xlsx. This file contains inform ation on how m any hours each
em ploy ee worked, how m any cakes they produce per hour, and the price of each cake. The file also
contains the cost per pound of purchasing sugar, butter, and flour and the am ount bought from each of Le
Napoleon's six suppliers.
Determ ine (with a single form ula) the total num ber of cakes produced.
Determ ine (with a single form ula) the total rev enue generated by the produced cakes.
Determ ine (with a single form ula) the total cost of buy ing sugar, butter, and flour from our 6
suppliers.
SUMPRODUCT Exercise Solutions

Modeling Uncertainty in Excel

If there is one thing we know about this world, it is that we do not know what is going to happen. For
exam ple, Le Napoleon does not know how m any Sacher Tortes will be dem anded each day . Excel contains
sev eral functions that help us m odel uncertain ev ents such as the daily dem and for Sacher Tortes. In this
section we will discuss two such functions: RAND() and RANDBETWEEN. In a future chapter we will
study in m ore detail how to use an Excel add-in @RISK to m odel uncertainty . The use of spreadsheets to
m odel uncertainty is often referred to as Monte Carlo sim ulation.
If y ou ty pe = RAND() in any cell, y ou will see a num ber between 0 and 1 .
Suppose Le Napoleon believ es there is a 3 0% chance that dem and for Sacher Tortes today will be for 3
tortes, a 50% chance dem and for Sacher Tortes will be for 4 tortes, and there is a 2 0% chance that today 's
dem and will be for 5 Sacher Tortes. We can use the = RAND() function to generate a random dem and for
Sacher tortes. Please download the file Randtortestem p.xlsx. The basic idea is to ensure that if our RAND()
v alue is < .3 we assign a dem and of 3 tortes, if our random num ber is between .3 and .8, then we assign a
dem and for 4 tortes, and if our random num ber is > = .8 we assign a dem and for 5 tortes. Then 3 0% of the
tim e this m ethod generates a dem and for 3 tortes; .8 - .3 = 50% of the tim e we generate a dem and for 4
tortes, and 1 - .8= 2 0% of the tim e we generate a dem and for 5 tortes.
Set up a spreadsheet that m odels the daily dem and for Pear Charlotte. There is a 6 0% chance the dem and
will equal 4 and a 4 0% chance the dem and will equal 8.
Modeling Uncertainty Exercise Solutions
Another useful Excel function for m odeling uncertainty is the RANDBETWEEN function. IF a and b are
integers and y ou enter = RANDBETWEEN(a,b) in a cell, then Excel is equally likely to return any integer
between a and b inclusiv e.
For exam ple, suppose Le Napoleon believ es that it is equally likely that today they will sell between 1 00
and 2 00 Napoleons. Then entering = RANDBETWEEN(1 00,2 00) in any cell will generate a random
dem and that reflects our v iew of what m ight happen.
The dem and for Praline tortes today is equally likely to be between 2 0 and 4 0. Write an Excel function
that can be used to m odel the daily dem and for Praline tortes.
Modeling Uncertainty Exercise Solutions

Excel Financial Functions


21/52

10/13/13

Spreadsheet Modeling

In y our finance classes y ou will hav e to perform calculations inv olv ing im portant financial concepts
such as Net present v alue (NPV), Internal Rate of Return (IRR), m ortgage pay m ent schedules, and
depreciation. Excel has m any useful functions that m ake these com putations a snap. In this section we
will discuss sev eral of Excel's im portant financial functions: XNPV, XIRR, PMT, and SLN.
Consider the cash flows shown in the worksheet Financialfunctionstem p.xlsx. Please download the file
Financialfunctionstem p.xlsx. Cells A1 :G1 0 of worksheet NPV and IRR giv e the am ount and dates of cash
flows for two different m achines that Le Napoleon is considering buy ing.
The question is which m achine is a better buy . A nav e decision m aker m ight say that Machine 1 is
better because the total v alue of the rev enues less costs is $1 000, while for Machine 2 this sum is $7 6 0.
This reasoning ignores the im portant concept of the tim e v alue of m oney . It is better to receiv e $1 now
than in the future. Sim ilarly , it is better to pay out $1 in the future than pay out $1 now. The proper way
to ev aluate projects which inv olv e cash flows occurring at different tim es requires us to assign a
discount rat e (usually between 1 0% and 2 0% per y ear) that incorporates the tim e v alue of m oney . A
discount rate of 1 0% m eans $1 receiv ed now is equiv alent to receiv ing $1 .1 0 a y ear from now. Div iding
both sides of this relationship by 1 .1 0 we find that $1 /1 .1 0 now is equiv alent to $1 receiv ed one y ear from
now. Sim ilar logic shows that $1 receiv ed 2 y ears from now is worth the sam e as receiv ing $1 /1 .1 2 now
and in general receiv ing $1 n y ears from now is the sam e as receiv ing 1 /1 .1 n dollars now, The Net
Present Value (or NPV) of a sequence of cash flows sim ply conv erts all cash flows to today 's dollars by
m ultiply ing cash flows receiv ed at tim e n by a factor 1 /(1 + discount rate) n which puts the cash flows into
today 's dollars.
If we enter the dates that our cash flows are receiv ed and the v alues of the cash flows into a spreadsheet,
then the XNPV function (sy ntax XNPV(rate, v alues, dates)) will return the NPV of the cash flow v alues
brought back to the first date. Here rate m ust be an annual discount rate. Let's utilize the XNPV function
to com pute the NPV for Machine 1 and Machine 2 . We will use the function wizard (indicated by the
sm all fx icon on y our ribbon) to input our form ula inv olv ing XNPV. The function wizard is a helpful aid
that m akes it easy to input the proper sy ntax for unfam iliar functions. You sim ply go the cell where y ou
want to enter the form ula and click on the Function Wizard icon. Then select the ty pe of function (here
we select Financial) and then m ov e to the list of functions. Next, ty pe in the first few letters (say XN for
XNPV) of the function's nam e and y ou will m ov e to the correct function. Then follow the prom pts and the
proper form ula will appear in y our cell! Let's now com pute the NPV for Machines 1 and 2 .
By the way a project with an NPV> 0 increases the com pany 's v alue while a project with an NPV< 0
decreases the com pany 's NPV.
An NBA play er will be a rookie in Nov em ber 2 01 0. Each y ear for six y ears he is paid $1 m illion a m onth
during the m onths of Nov em berApril. Assum ing a discount rate of 1 0% per y ear, what is the NPV of his
salaries as of January 1 5, 2 008?
Excel Financial Functions Exercise Solutions
The problem with NPV is that it can be difficult to determ ine the proper discount rate for the cash flows.
The idea of Internal Rate of Return (IRR) does not require a discount rate. The IRR of a sequence of cash
flows is sim ply the discount rate that m akes a project's NPV = 0. For exam ple if we discount a project's
cash flows at 1 2 % and get an NPV of 0, we can say this project, roughly speaking, is earning a 1 2 %
annual return on our inv estm ents. In rare cases, projects can hav e m ultiple IRR's or ev en no IRR, but we
will leav e discussion of that problem to y our finance professors! To find the IRR of a sequence of cash flows,
we will use the XIRR function (sy ntax XIRR(cash flows, dates, guess)). Guess is usually a "guess" at the
project's IRR (we recom m end using guesses in the range between -80% to + 80%). Without a Guess near
the project's actual IRR, Excel m ay return a #NUM error indicating that it cannot find an IRR. Therefore
we recom m end alway s try ing guesses of say -.8, -.4 , 0, .4 and .8. We will now use the XIRR function to
find the IRR for the cash flows associated with Machines 1 and 2 .
The relationship between IRR and NPV is as follows: NPV> 0 if and only if Project IRR> discount rate.
An oil com pany is going to drill a well costing $50 m illion on 5/1 5/2 009 . For each of the next 2 0 y ears
they expect to receiv e $5 m illion in rev enues. Assum ing each y ear's rev enue is concentrated m idy ear,
what is the IRR for this oil well?
Excel Financial Functions Exercise Solutions
Often we want to figure out the m onthly pay m ents in a car or housing loan. Excel's PMT function m akes
this easy ! The PMT function has the sy ntax PMT(rate, nper,pv ,fv ,ty pe).
Rate is the rate on the loan. If periods are y ears, this equals the annual rate. If periods are m onths,
22/52

10/13/13

Spreadsheet Modeling

this is the annual rate div ided by 1 2 .


Nper is the num ber of equal pay m ents needed to pay back loan.
PV is the am ount borrowed. PV should be entered with a positiv e sign since we will receiv e a check
for the am ount of the loan.
FV is the am ount of the ending pay m ent needed to pay off the loan. If there is no ending pay m ent,
then FV= 0. FV should be entered with a negativ e sign since we are pay ing m oney .
Use ty pe = 1 or True if the loan pay m ents are m ade at the beginning of the m onth. Use ty pe = 0 or
false if loan pay m ents are m ade at the end of the m onth.
Let's now m ov e to the sheet m ortgage pay m ent and calculate the m onthly pay m ents on a 2 0-y ear loan
with m onthly pay m ents and a 6 % annual rate under the following three conditions:
End-of-Month pay m ents
Beginning-of-m onth pay m ents
End-of-m onth pay m ents with an ending $3 0,000 pay m ent
Finally , let's com pute our m onthly pay m ent for end-of-m onth pay m ents when we m ake an ending
pay m ent of $3 0,000.
What is the m onthly pay m ent (assum ing end-of-m onth pay m ents) on a 3 0-y ear $3 00,000 loan?
Excel Financial Functions Exercise Solutions
PV function: com putes the v alue of an annuity .
FV function: com putes the future accum ulation when a constant sum of m oney is deposited each
period.
RATE function: com putes the effectiv e rate giv en num ber of pay m ents, size of each pay m ent, and
am ount borrowed.
NPER function: com putes the num ber of periods required to pay back a loan giv en the rate, size of
pay m ents, and am ount borrowed.
IPMT, PPMT, CUMPRINC and CUMIPMT: these functions help us calculate an am ortization
schedule which determ ines the breakdown each period between principal and interest.
We now describe the EXCEL SLN function which can be used to determ ine the depreciation am ount each
period when straight line depreciation is used. Excel also includes the DDB function (for Double Declining
Balance depreciation), SYD (Sum of y ears Digits depreciation), and VDB (v ariable declining balance
depreciation functions). Due to lack of tim e we will discuss only the SLN function.
The sy ntax of the SLN function is SLN((c, s, L). This function then com putes the depreciation
accum ulated each period for a m achine costing $c, hav ing a salv age v alue of $s and a useful life of L
y ears. In sheet SLN we com pute the annual depreciation ov er a 1 0-y ear period for a m achine costing
$4 00 hav ing a $50 salv age v alue.
What is the annual depreciation we can charge on a $4 000 m achine with a salv age v alue of $500 and a
5-y ear useful life?
Excel Financial Functions Exercise Solutions

COUNT, COUNTA, and COUNTBLANK Functions

Often we want to count the num ber of cells in a range that contain num bers, num bers or text, or
blanks. The COUNT, COUNTA, and COUNTBLANK functions serv e this purpose.
COUNT(cell range) counts how m any cells in cell range containing num bers.
COUNTA(cell range) counts how m any cells in cell range are not blank (contain text or num bers).
COUNTBLANK(cell range) counts how m any cells in cell range are blank.
Please download the file Countingfunctionstem p.xlsx. Using Excel's counting functions, let's count how
m any cells with num bers, how m any nonblank cells, and how m any blank cells are in the cell
range.D4 :E2 0.
Please download the file Counthw.xlsx.
Com pute the num ber of cells containing num bers in the cell range D2 :E1 2 .
Com pute the num ber of cells that are not blank in cell range D2 :E1 5.
Com pute the num ber of blank cells in the cell range D2 :E1 8.
23/52

10/13/13

Spreadsheet Modeling

Count Exercise Solutions

Excel Statistical Functions

Excel has m any useful functions that can be used to do basic statistical calculations. A brief description
of m any of these functions follows:
MAX(cell range) returns the largest num ber in a cell range.
MIN(cell range) com putes the sm allest num ber in a cell range.
LARGE(cell range, k) returns the k th largest num ber in a cell range.
SMALL(cell range) returns the k th sm allest num ber in a cell range.
AVERAGE(cell range) com putes the av erage of all num bers in a cell range.
RANK(k, cell range,0) returns the rank of a num ber k in a cell range, with the largest num ber
obtaining a rank of 1 , the 2 nd largest num ber a rank of 2 , etc..
RANK(k, cell range,1 ) returns the rank of a num ber k in a cell range, with the sm allest num ber
obtaining a rank of 1 , the 2 nd sm allest num ber a rank of 2 , etc..
The form ula VAR(cell range) com putes the v ariance of the num bers in a cell range.
The form ula STDEV(cell range) com putes the standard dev iation of the num bers in a cell range.
Please download the file Statisticalfunctionstem p.xlsx. This worksheet contains the am ount spent by Le
Napoleon's first 1 4 custom ers of the day . Let's use Excel's statistical functions to determ ine
The m ost m oney spent by a custom er.
The least m oney spent by a custom er.
The 3 rd largest am ount of m oney spent by a custom er.
The 4 th largest am ount of m oney spent by a custom er.
How each custom er's spending ranks am ong the 1 4 custom ers.
The v ariance and standard dev iation of the am ount spent by the 1 4 custom ers.
We hav e nam ed the cell range (E5:E1 8) containing the custom er spending data.
We will now show how to use the Excel Rank function to rank the am ount each custom er spent, with a
rank of 1 indicating the custom er who spent the m ost m oney and a rank of 1 4 indicating the custom er
who spent the least m oney .
Com pute the largest am ount of m oney spent by the last fiv e custom ers.
Com pute the sm allest am ount of m oney spent by the first four custom ers.
Com pute the 4 th largest am ount of m oney spent by a custom er.
Com pute the 6 th sm allest am ount of m oney spent by a custom er.
Com pute the v ariance and standard dev iation of the m oney spent by the first two custom ers.
Excel Statistical Functions Exercise Solutions

Conditional Counts

Please download the workbook Countiftem p.xlsx. This workbook contains data on m any sales
transactions m ade by Le Napoleon. Each row represents a transaction and contains the following
inform ation:
Product sold
Salesperson
Month during which sale was m ade
Location of sale: East, West, Midwest, or South
Units sold
Total sales rev enue.
For exam ple, the first sales transaction consisted of Charlene selling Napoleons in June in the South. She
sold 7 9 units for $2 7 6 .50. We hav e used Nam e Create from Selection to nam e each colum n's data with
the heading from row 5. For exam ple, we hav e nam ed the cell range C6 :C6 87 Month.
We m ight want to determ ine the num ber of transactions which were m ade in the South. Or we m ight
want to know the num ber of transactions m ade during April. Answering these questions is easy using the
EXCEL COUNTIF function. The sy ntax of the COUNTIF function is COUNTIF(range criteria). Then the
COUNTIF function returns the num bers of rows in the range that m eet a giv en criteria. For exam ple, the
form ula = COUNTIF(Location,"South") counts how m any tim es the word South occurs in Colum n D.
24/52

10/13/13

Spreadsheet Modeling

Let's now use the Excel COUNTIF function to answer the following 3 questions.
How m any transactions took place in the South?
How m any transactions were for exactly 84 units?
How m any transactions generated at least $2 00 of rev enue?
First let's calculate how m any transactions took place in the South.
How m any transactions inv olv ed sales of Pear Charlotte?
How m any transactions generated exactly $7 3 6 .00 of rev enue?
Conditional Counts Exercise Solutions
There are m any problem s which the COUNTIF function cannot solv e. For exam ple, suppose we want to
determ ine how m any transactions were com pleted by Charlene in the South. The COUNTIF function can
only handle criteria inv olv ing one colum n. Our current problem inv olv es criteria incorporating two
colum ns: Sales person and Location. For such problem s we can use the COUNTIFS function (new to Excel
2 007 !) The S at the end m eans that m ultiple or plural criteria are allowed. The sy ntax of the COUNTIFS
function is COUNTIFS(Criteria range 1 ,criteria 1 , Criteria range2 , criteria2 , ...Criteriarangen,
criterian). This counts the num ber of rows for which each criteria range m eets the desired criteria. To
illustrate the use of the COUNTIFS function, let's determ ine how m any transactions Charlene com pleted
in the South.
How m any transactions inv olv ed at least 50 units and were com pleted by Charlene in Nov em ber for
Napoleons?
Conditional Counts Exercise Solutions

Conditional Sums

The COUNTIF and COUNTIFS functions help us count the num ber of rows satisfy ing a giv en criteria.
The SUMIF function lets us add up all rows in a colum n for which the entries in a single colum n satisfy a
criteria. The SUMIFS function lets us add up all rows in a colum n for which m ore than one criteria is
satisfied.
The sy ntax of the SUMIF function is SUMIF(range, criteria, sum range). Then the form ula adds up all
entries in the sum range colum n for which the entries in the range colum n satisfy criteria. The criteria
for SUMIF (and SUMIFS) work just as they do for COUNTIF and COUNTIFS. Please download file
Sum iftem p.xlsx. This file contains exactly the sam e inform ation we used in our discussion of the
COUNTIF and COUNTIFS functions. Let's now use the SUMIF function to calculate the total rev enue
earned during each m onth of the y ear.
Now let's try to determ ine the total rev enue generated by each salesperson in each region. For exam ple,
we will need to add up each num ber in the rev enue colum n as long as the salesperson was Charlene and
the region was the East. Since we need t o use t wo crit eria t o det ermine which rows of revenue
are included in each calculat ion, we cannot use t he SUMIF funct ion. Fortunately , Excel 2 007 's
new SUMIFS function allows us to do conditional sum s inv olv ing m ultiple criteria. The sy ntax of SUMIFS
is SUMIFS(Sum range, Criteriarange1 ,criteria1 , Criteriarange2 ,criteria2 ,..Criteriarangen, criterian).
This function would add up all rows in the Sum range for which criteria 1 is satisfied in Criteriarange1 ,
Criteria2 is satisfied in Criteriarange2 , ...Criteriarangen is satisfied in Criteriarangen. We now use the
SUMIFS function to determ ine how m any units each salesperson generated in each region.
Com pute the total units and rev enue for each location.
Sum m arize by m onth the total rev enue generated by each salesperson.
Conditional Sum s Exercise Solutions

Removing Duplicates

Please download file Duplicatestem p.xlsx. The files Duplicatestem p.xlsx contains sales data organized by
salesperson, location, m onth, and product. Suppose we want a list of all the products sold. Perhaps we
want a list of ev ery product, salesperson, and location com bination. Excel 2 007 contains a powerful
feature: Rem ov e Duplicates that lets us easily find these lists. You sim ply select y our Data and then
choose Rem ov e Duplicates from the Data tab. Then y ou can tell Excel the colum ns for which y ou want a
list of duplicates. We recom m end m aking a copy of the data first, because som e of the original rows in
25/52

10/13/13

Spreadsheet Modeling

y our data will be rem ov ed when y ou perform Rem ov e Duplicates.


Let's begin by obtaining a unique list of products.
Find a list of salespeople.
Duplicates Exercise Solutions
Next we will find each unique com bination of product, salesperson and location. We will see that not
ev ery salesperson sold each product in each region!
Find each unique com bination of Product, Salesperson, and m onth.
Duplicates Exercise Solutions

Sorting in Excel

Often we want to sort our data to better understand it. For exam ple, we m ight want to sort our sales
database so that for each product we can see the transactions listed in the descending order of sales. We
m ight ev en want to sort our data based on cell or font color.
Please download file Sorttem p.xlsx. Our data is the fam iliar sales database. Each row shows the product,
salesperson, m onth location, units sold, and rev enue for a transaction. As our first exam ple of sorting,
let's sort our sales data so products are listed alphabetically and within each product the transactions are
listed in descending order of rev enue.
Sort the data so that for each location we see sales of each product listed in descending order of units.
Next let's show how to sort on color. We hav e highlighted som e rows of our data in y ellow and other rows
in green. Can we sort the data so that the green cells are on top followed by the y ellow cells?
Sort the data so that the y ellow cells are followed by the green cells.

Filtering Data

Filtering data m eans extracting a subset of rows from data. Please download file Filtertem p.xlsx.
For exam ple, we m ight want to filter or extract the following subsets of data:
All transactions inv olv ing tart sales in the east or Midwest.
All tart transactions in east or Midwest that inv olv ed at least 1 00 units.
All y ellow cells.
By selecting Filter from the data tab, y ou m ay filter data based on the entries in the cell (for
exam ple, select all entries in the east or west), num erical v alue of cell (select all transactions for
> = 1 00 units), filter data on text characteristics in cell (select all cells where product nam e begins
with S), or filter on cell or font color (extract all cells with a y ellow fill color).
Let's begin by locating all transactions inv olv ing tart sales in east or Midwest.
We note that in colum ns for which we hav e selected a filter criterion the drop down arrow is replaced by a
funnel. If we select the Filter icon from the ribbon then the dropdown arrows are cleared and our original
data returns.
Now suppose that y ou want to just focus on tart transactions in the east or Midwest that were for at least
1 00 units.
Finally , let's use the Filter to find all cells with y ellow entries in the product colum n.
Find all transaction for flans during January through March in the East.
Find all transactions by Charlene that ranked in the top 1 0 (m easured by units). Hint: Use the Top
1 0 filter.
Filtering Data Exercise Solutions

Subtotals
26/52

10/13/13

Spreadsheet Modeling

Suppose we want a breakdown of total sales by Location. Or perhaps we want sales totaled for each
Salesperson within each Location. Excel's Subtotals feature m akes it easy to obtain such breakdowns.
Before using the Subtotals feature y ou m ust sort the data according to the order corresponding to how
y ou want the data totaled. For exam ple, if we want a breakdown of sales by Location we should sort the
data by Location. If we want a total of how each Location's sales break down by Salesperson we should first
sort by Location and then sort by Salesperson. If we want a breakdown by Salesperson of each
Salesperson's sales by Location we should first sort by Salesperson and then by Location.
Let's suppose we want a breakdown of how each Location's sales breakdown by Salesperson. Please
download file Subtotalstem p.xlsx. Our file is sorted first by Location and then by Salesperson.
Next we will activ ate the Subtotals feature and tell Excel to total Units and Dollars for each salesperson
within each region.
Next we want to breakdown the totals for each Location by Salesperson. To do this we sim ply put the
cursor inside the data and select Subtotals. Then we choose to break things down at each change in
Salesperson and uncheck the Replace current Subtotals box. This ensures t hat our breakdown by
Salesperson will not replace our breakdown by Locat ion.
Recall that when y ou create subtotals, the higher the num ber in the outline, the less aggregated the
data.
For each m onth, obtain a breakdown of the units and rev enue for each product.
For each location, obtain a breakdown of sales by m onth.
Subtotals Exercise Solution 1
Subtotals Exercise Solution 2

Pivot Tables

Please download the file Piv ottabletem p.xlsx. NOTE: This file m ust be sav ed after opening in order to
properly function. The file contains the database of sales transactions we hav e used as well as a database
of different custom er transactions.
Piv ot tables allow us to "slice and dice" data any way we want and perform com plex calculations. In this
section we will use piv ot tables to effortlessly perform the following tasks:
Obtain a breakdown of total sales of each product during each m onth.
For each product, obtain a breakdown of the percentage of sales during each m onth.
Obtain a listing of our top 1 0 custom ers.
You create a Piv ot Table by placing y our cursor within y our data (the first row of each colum n needs a
heading or label) and then selecting Piv ot Table from the Insert tab. Then we "drag" the desired colum ns
of our choice to one of the following portions of the table:
Row Labels - If, for exam ple, we drag Month to the row label, then we will see (going down the
table) a breakdown of a desired set of data by Month.
Column Labels - If, for exam ple, we drag Month to the Colum n labels, then we will see (going
across a row) a breakdown of a desired set of data by m onth.
Values - If, for exam ple, we drag Month to the Row Labels and Units to the Values section, we will
obtain the total rev enue broken down by m onth (listed v ertically ), because we put Month in the
Row Labels Section.
Report Filt er - Dragging a colum n to the Report filter enables us to display analy sis for any
subset of the possible v alues for the colum n. For exam ple, if we place Month in the Row Labels
section, Product in the Report Filter, and Units in the Values section, then we can select any subset
of products and display a breakdown by m onth of the total units sold of any subset of products.
First, let's create a piv ot table that shows the total dollar sales v olum e of each product during each
m onth. All we need to do is drag Dollars to the Values section of the table, Month to the Row labels, and
Product to the Colum n labels.
Note that the sales totals in our piv ot table are not form atted in $s. We will now show how to form at the
rev enues in $s.
Perhaps we want to not sum m arize our data by total rev enue, but by av erage rev enue per transaction.
27/52

10/13/13

Spreadsheet Modeling

A nice feature of a piv ot table is the ease with which y ou can "drill down" to the data that was used for a
piv ot table cell's com putation. Let's show how to find all the transactions corresponding to Caram el clair
sales in January .
Now let's suppose we want to calculate the percentage of sales for each product that occur during each
m onth. We can do this by using the Value Field Settings dialog box.
Piv ot tables are a powerful tool to analy ze a com pany 's custom ers. In the worksheet customers we see a list
of transactions. For each transaction we are giv en the product, custom er (num bered 1 -2 0), and m onth.
We want to find out the identity of our 1 0 best custom ers. This requires that we sum m arize total dollar
sales by custom er. Then we will show y ou how to use Excel 2 007 's powerful sorting capabilities to pick out
our top 1 0 custom ers.
When y ou are within a piv ot table y ou m ay m odify m any portions of the Piv ot Table by clicking within
the Options or Designs portion of Piv ot Tools (located in right-hand corner of the ribbon). For exam ple,
clicking on Design allows us to change the form atting sty le of the table, the lay out of the table (com pact our current form at, outline or tabular) as well as the way totals and subtotals are display ed. From the
Lay out options we m ay change m any aspects of the table including the location in the spreadsheet, the
nam e of the spreadsheet, the source data etc.
We also note that the data included in a piv ot table can be sum m arized in a Piv ot Chart. We will discuss
piv ot charts in the following section.
Finally , if new data is included in a piv ot table, y ou m ay right-click and select refresh to update the piv ot
table calculations.
Find during each m onth the percentage of sales generated by each salesperson.
Determ ine the units sold by each salesperson of each product.
Determ ine our 5 worst custom ers.
Determ ine the av erage num ber of units per transaction sold of each product.
Piv ot Tables Exercise Solutions

Pivot Charts

Perhaps y ou noticed the Piv otChart button in the Piv otTable drop-down list:
A Piv ot Chart is sim ply a chart that is linked to a piv ot table and updates to display graphically whatev er
is selected for display in the Piv ot Table.
To create a Piv ot Table with a corresponding Piv ot Chart (y ou cannot hav e just a Piv ot Chart; there m ust
be an underly ing Piv ot Table to prov ide the chart's source data), choose Piv otChart from the drop-down
m enu. The steps are essentially the sam e as for creating a Piv ot Table, but y ou will now see a Piv ot Chart
as well.
One difference y ou will notice when y ou select the Piv otChart option is that when the Piv otChart is the
activ e object, the Colum n Labels and Row Labels areas of the piv ot table are now called Legend Fields and
Axis Fields, respectiv ely .
Once y ou hav e a Piv otChart, y ou can m ov e it and edit it as y ou would any chart. We will work with
charts in the next chapter. For now, we will m ov e the chart out of the way so that we can see the
Piv otTable underneath it fully .
This data m ight be better display ed as a line chart. In the next chapter we will see how to change an
existing chart's ty pe. The m aterial presented in the next chapter applies to Piv ot Charts as well as regular
charts.
The Piv ot Table and Piv ot Chart are linked; changing the filter on one changes the corresponding filter on
the other. Thus, if we want to v iew sales for January , February , and March for our three clair flav ors,
we can use either the drop-down lists in the Piv ot Table or the drop-down lists in the Piv ot Chart Filter
Pane. We'll use the Piv ot Chart Filter Pane.
Create a Piv otTable with Piv otChart to determ ine the rev enue brought in by each salesperson for each
location. Com pare the look of the chart when y ou use Location as the Axis field and Salesperson as the
Legend field, and the other way around.
Piv ot Exercise Solutions
28/52

10/13/13

Spreadsheet Modeling

To add a Piv ot Chart to an existing Piv ot Table, select the Piv ot Table. On the Options tab, click the
Piv otChart button:
Choose the desired chart ty pe, and a Piv ot Chart will appear, linked to the existing Piv ot Table.
Return to one of the Piv ot Tables that y ou created in exercises (1 )-(4 ) and add a Piv ot Chart.

Conditional Formatting: The Formula Option

In the "Excel Form ulas" chapter we studied m any of the outstanding conditional form atting in Excel
2 007 . Som etim es y ou hav e to create y our own form atting using the Form ula option. If y ou select a
range, y ou m ay select from the New Rules portion of the Conditional Form atting m enu. Then select Use a
Form ula to determ ine which cells to form at. Enter a form ula for the cell in the upper corner of the
selected range which is true if and only if y ou want the cell in the upper left corner of the range to hav e
the form at y ou select. Then Excel will aut omat ically copy t his formula t o t he rest of t he select ed
range. Whenever t he copied version of t he formula is t rue, Excel will insert t he select ed
format in t he cell. This m ethod is m ost easily explained by exam ple.
Please download file Form ulasform attem p.xlsx. In the sheet quarterly sales, we see quarterly rev enues for
Le Napoleon. We would like to highlight in green the quarters in which sales increased and highlight in
red the quarters during which sales decreased. We now show how to form at quarters in which sales
increased in green.
Next we will show how to ensure that all quarters in which sales decrease are colored red.
Next let's look at worksheet product and region. This worksheet contains the sales of Flans, Tarts, clairs
and Napoleons by region. We would like to highlight in y ellow for each product the region with the
largest sales. To do this we need to select the cell range E1 2 :H1 5, and after selecting the Form ula option
from conditional form atting, enter a form ula that will test whether E1 2 is the largest num ber in its
colum n. We could enter = E1 2 = MAX(E1 2 :E1 5). This form ula will be true if and only if E1 2 contains the
largest sales for Flans. Note, howev er, if we copy this form ula down to cell E1 3 the form ula becom es =
E1 3 = m ax(E1 3 :E1 6 ). Of course, we want this form ula to be = E1 3 = m ax(E1 2 :E1 5) so we need t o $ sign
t he 12 and 15 in our original formula. We do not dollar sign t he E because when we copy across
t o say F12 we want t he formula t o be =F12=max(F12:F15).
Set up a conditional form at for the worksheet product and region that highlights in red for each
region the product with the largest sales.
Set up a conditional form at that highlights any of the three largest num bers in the product and
region worksheet in red.
Conditional Form atting Exercise Solutions
When y ou receiv e a worksheet from som eone else, y ou m ight want to show all conditional form ats in the
worksheet. This can be accom plished using F5 special.

Charts

Excel m akes it easy to illustrate aspects of y our data using charts. Once y ou decide what ty pe of chart will
best m ake y our point, a basic chart can be m ade in just a few m ouse clicks. There are m any options for
custom izing charts as well. We will explore som e of these in this chapter.
We will start with the file Charts_creating.xlsx, so please download this workbook now. As alway s, please
follow along as we outline changes to the workbook.

Creating Charts

In the chapter on Useful Excel Functions, y ou saw how range nam es could com e in handy for
sum m arizing data. We will use part of the sam e dataset that y ou saw there as the source data for a line
chart, so that m anagem ent can see at a glance how sales are doing in the im portant Baltim ore-Boston
corridor. The pair of screenshots below shows the dataset (with the source data for the chart shaded) and
the chart that we would like to create from it.
To create a chart, first select the relev ant data, including necessary clarify ing text, and choose a chart
ty pe from the Insert tab. The data needed here is on the city quarterly revenues worksheet in the
29/52

10/13/13

Spreadsheet Modeling

Charts_creating.xlsx file that y ou should hav e downloaded.


Using the data on the product categories worksheet, create a chart that resem bles the one shown below.
(This is a stacked 3 -D chart.)
Using the data on the product line worksheet, we would like to create a bar chart that sum m arizes
rev enues for our single-serv ing item s (clairs and napoleons). The pair of screenshots below shows the
dataset (with the source data for the chart shaded) and the chart that we would like to create from it.
As y ou m ight im agine, in creating a chart from noncontiguous data, we will need to m ake use of the Ctrl
key (or other m eans of selecting noncontiguous cells). While y ou can select cells any way y ou like if y our
goal is just to form at them , the way in which you select the cells for a chart is important. The v ideo
dem onstrates what can happen if we aren't careful, as well as how to create the chart that we want.
The point here is that if at any point in selecting data for a chart y ou accidentally select the wrong cell,
or select a cell out of turn, it m ight be best to start ov er.
Using the data on the city quarterly revenues worksheet, create a chart that resem bles the one shown
below.
There are tim es when y ou m ight get halfway through custom izing a chart before y ou realize that a
different chart ty pe would support y our argum ent better. In cases like these, y ou don't hav e to start ov er
y ou can change a chart's ty pe after the fact.
On the product categories worksheet is a colum n chart illustrating special order totals for each of our four
product categories. This data would also be reasonably represented by a pie chart.
Changing a chart's ty pe can be done by right-clicking the chart and choosing Change Chart Ty pe from
the pop-up m enu, or by selecting the chart and clicking the Change Chart Ty pe button on the Design tab.
(This tab is av ailable only when the chart is selected.)
Change the chart from the exercise on Page 4 so that it resem bles the one shown below.
Recall the first chart that we created, the line chart with Quarter 1 - Quarter 4 rev enues for Boston, New
York, and Baltim ore. We'll now create a second line chart on the city quarterly revenues worksheet using
all of the cities in the Midwest region.
For the chart's source data, it m ight be tem pting to use the selection shaded in the screenshot below. After
all, we need the quarter labels, the city labels, and the data to chart. As y ou will see, howev er, this will
cause problem s.
First, we will try creating the chart using the selection described on the prev ious tab.
As it turns out, we need to include A1 so that the selected ranges hav e equal widths.
This tim e, we will take care to select ranges of equal width. This will take care of the problem but
another problem will crop up.
Why does Excel now place the quarters in the legend? Recall that whatev er there are m ore exam ples of,
Excel puts along the x-axis. Whatev er there are fewer exam ples of goes in the legend. We are using data
for six cities and four quartersso, by default, the quarters go in the legend. We will fix this problem on
the next tab.
Using the data on the product categories worksheet, create a chart that resem bles the one shown below.
Note that this chart com pares fruit flan and charlotte sales with fresh fruit tart sales.
To m ov e the cities into the legend and the quarters onto the axis, use the Switch Row/Colum n button on
the Design tab.
Change the chart from exercise on Page 1 0 so that it resem bles the one shown below.
Creating Charts Exercise Solutions
If y ou'v e created a chart and started to custom ize it only to find that y ou forgot to include labels in y our
selection, y ou can add those labels after the fact.
When y ou forget to include labels, Excel will use labels such as "1 ," "2 ," "3 ," etc. along the x-axis and
"Series 1 ," "Series 2 ," and so on in the legend. For exam ple, say we created the Boston-New York-Baltim ore
line chart using only the quarterly figures. The pair of screenshots below shows the dataset (with the
30/52

10/13/13

Spreadsheet Modeling

source data for the chart shaded) and the resulting line chart.
Please create this chart (on the city quarterly revenues worksheet) before continuing.
We now want to replace the x-axis labels and legend entries with the quarter designations and city
nam es.

Resizing and Moving Charts

We will continue with the file Charts_resizing-m ov ing.xlsx, which contains all of the work com pleted in
the prev ious section. Please download this workbook and follow along in it.
When y ou resize a chart, Excel resizes the elem ents within it, as well. We will resize the bar chart on the
product line worksheet to reduce its height a bit.
Still on the product line worksheet, we will m ov e the bar chart to fit under the data.
If we instead wanted the chart on a different sheet, that's easy to do, too.
You can also select the chart and use the Mov e Chart button on the Design tab.
Insert a new worksheet and renam e it city revenue charts. Reposition the sheet so that it
im m ediately follows the city quarterly revenues sheet. Mov e one of the two Boston-New YorkBaltim ore charts and the Midwest city chart from the city quarterly revenues worksheet to the new
sheet. Then resize and m ov e them on that sheet as y ou like.
Delete the other Boston-New York-Baltim ore chart from the city quarterly revenues sheet. (Select
the chart and hit the Delete key , or right-click the chart and choose Cut.)
Resizing and Mov ing Exercise Solutions

Basic Formatting of Charts

We will continue with the file Charts_form atting.xlsx, which contains all of the work com pleted in the
prev ious section. Please download this workbook and follow along in it.
We want to m ake som e im prov em ents, such as adding a title, rem ov ing the legend, adding data labels,
and so on, to the following charts:
the bar chart on the Sheet4 worksheet
the Boston-New York-Baltim ore line chart on the city revenue charts worksheet
the pie chart on the product categories worksheet
The tabs that follow show the before and after v ersions of these three charts and explanations of the
changes m ade.
Our bar chart could be m ade m ore appealing by (1 ) adding a chart title, (2 ) rem ov ing the legend, (3 )
adding a title to clarify the x-axis, and (4 ) rem ov ing the v ertical gridlines.
Our Boston-New York-Baltim ore line chart could be m ade m ore appealing by adding a chart title and
adding a title to clarify the y -axis. For the y -axis, we will choose a rotated title to sav e space and still
prov ide readability .
We chose to ov erlay the chart title. This would look better if the chart title area had a fill color or texture.
We will discuss fill options later in this chapter.
Using the data on the city quarterly revenues worksheet, create a chart that resem bles the one shown
below.
Basic Form atting Exercise Solutions
Looking at our pie chart, it is clear that tortes are our m ost im portant category when it com es to special
orders, but without data labels, it isn't clear whether the data used for the chart represent tens,
hundreds, or ev en thousands of orders.
In addition to adding a title to this chart, we will add labels to show (a) the v alue that each segm ent
represents and also (b) its percentage of the whole. Also, to draw attention to the fact that special orders
31/52

10/13/13

Spreadsheet Modeling

for clairs and napoleons are also im portant, we will rotate the pie to bring that segm ent closer to the
front. Finally , we will m ov e the legend to the bottom and resize and reposition the plot area.
On the city quarterly revenues worksheet, in a new colum n, sum the quarterly v alues for each city . Then,
using the totals obtained, create a chart that resem bles the one shown below.
Note: The cities can be placed on the chart by choosing Category Nam e (in the sam e dialog box where y ou
choose Percentages). Each city nam e will appear in a text box, which y ou can m ov e off to the side, as we
hav e done.

Formatting Axes and Data Series

We will continue with the file Charts_form atting-axes-data-series.xlsx, which contains all of the work
com pleted in the prev ious section. Please download this workbook and follow along in it.
Som etim es additional gridlines can help keep a chart from being m isread. We'll add m inor horizontal
gridlines to the Midwestern city rev enue line chart and then change the settings so that they are not
ov erwhelm ing. Finally , we will add v ertical gridlines. (We'll add a title, too.)
Refer back to the bar chart on the Sheet4 worksheet (or to the screenshots below), representing March
rev enues for napoleons and clairs, our single-serv ing products.
Say $500 is one of m anagem ent's benchm arks for these products, and we want to be able to tell at a
glance how each is perform ing against that benchm ark. To represent how m uch abov e the $500 m ark
these sales are, we'll change the x-axis so that the v alues start at $500. We'll also fix the m axim um v alue
at $2 000.
Finally , we'll form at each bar with its own color and change the gap between bars (which will also serv e
to increase the width of each bar).
Finally , we'll explore a few other basic form atting options, using the Boston-New York-Baltim ore chart on
the city revenue charts worksheet. We'll change the form at of the title and y -axis v alues, and we'll add a
border to the legend and a texture to the chart area, title area, and plot area. Finally , we'll copy and paste
the chart and apply one of the preset chart sty les.
Pretty m uch ev ery thing on a chart can be form attedand in a large num ber of way s!
You m ight want to use a secondary axis when charting m ultiple data series that cannot be com pared to
each other directly - units sold and rev enue is one exam ple.
Using the data on the product categories worksheet, create a chart that resem bles the one shown below.
Note: The title is in 1 4 -point font, y axis v alues run in increm ents of 2 5, the legend has a gray dashed
border, the chart area has no border, and there is a gradient fill.
Form atting Axes and Data Series Exercise Solutions

Customizing Charts

We will continue with the file Charts_custom izing.xlsx, which contains all of the work com pleted in the
prev ious section. Please download this workbook and follow along in it.
Recall the pie chart representing special orders in the m onth of March, on the product categories
worksheet. Managem ent would now like one just like it, but representing bakery sales. You could create
and form at a new chartor y ou could copy and paste the existing chart, change its source data, and
enter a new title.
Change the chart that y ou created as an exercise in the last section to resem ble the one shown below, no
longer showing bakery sales.
We can't help but notice that while we sold a lot of tortes as special orders, that category isn't doing so well
in the bakery . This is som ething we'd like to note; after all, these are high-profit item s, and they keep
longer when com pared to fresh fruit tarts, for exam ple. Selling m ore of these would certainly help the
business. We'll first rotate the pie to call attention to our torte sales, and then pull out ("explode") the torte
segm ent for greater effect.
32/52

10/13/13

Spreadsheet Modeling

It m ight also be useful to annotate the chart, to point out our observ ation regarding torte sales. To do this,
we'll add a text box to our chart.
Using the data on the product categories worksheet, create a chart that resem bles the one shown below.
Custom izing Charts Exercise Solutions
The last m odification we'll m ake is to add appeal to the chart by m eans of an im age. We'll use a picture of
cakes and tarts as a background, in the chart area. We'll also m ake any form atting changes that the
chart requires, such as adding fill colors, changing font color for v isibility , and so on.
When we're finished, our chart will be quite appealing.
Now that we hav e our pie chart just the way we want it, we can sav e it as a tem plate so that we can
easily m ake other pie charts that follow the sam e form at.
When y ou sav e a chart as a tem plate, it is actually stored as a new chart ty pe.
One last exercise. We'll test our tem plate by using it to m ake another chart. To illustrate that the
tem plate is not tied to the source data of the chart used to m ake it, we'll create a pie chart using the
tem plate and a different dataset, on the product line worksheet.
The resulting chart is a bit ov erwhelm ing, but it illustrates the idea that a tem plate can be used on any
range of data appropriate for its chart ty pe.

Importing Data into Excel

Often we hav e data outside of Excel that we need to im port into Excel. Here are som e exam ples:
We m ay hav e a list of orders for Le Napoleon's products that has been ty ped into Word. Unless we can
im port our data into Excel, we will be unable to do any calculations on our data. How can data from
a word file be conv erted into Excel?
Le Napoleon wants to know av erage fam ily incom e in v arious locations. This will aid Le Napoleon in
determ ining where they should build a new bakery . They hav e found av erage fam ily incom e by
state on the Internet. How can they im port this data into Excel?

From a Text or Word File

Please download the file Order.docx. The file Order.docx giv es the location and the num ber of Napoleons
ordered this week. How can we im port this data into Excel?
When attem pting to im port a Word file into Excel, we first sav e the word file as a text file. Then we open
the text file with Excel and let Excel's Text Im port Wizard do the rest.

Using Web Queries to Import Data from the Web

Often we want to extract data from a web site into an Excel file so that we can analy ze the data. Web
queries are a useful way to get data from the web into Excel. You sim ply go the web site containing the
desired inform ation and copy the web site's URL. Then go to Excel and from the Data Tab choose from the
Get External Data section From Web. This will bring up the New Web Query dialog box. After pasting the
web site's URL into the New Web Query dialog box, y ou can check the desired tables and im port them into
Excel.
To illustrate web queries, let's suppose Le Napoleon has been incredibly successful and wishes to purchase
the Boston Celtics professional basketball team . Before m aking an offer to buy the team , Le Napoleon
wants to download current and future play er salaries into Excel so that they can analy ze the future
pay roll com m itm ents associated with purchasing the Celtics. The web site Hoopshy pe.com (m ust reading
for any professional basketball fan!) contains current and future salaries for all N.B.A. team s.

Exercises
Please download the file Knicksharv ard.txt.

33/52

10/13/13

Spreadsheet Modeling

The file Knicksharv ard.txt contains m any lineups for the New York Knicks basketball team . Here
is a sam ple lineup:
This lineup consisted of Lee, Curry , Randolph, Richardson and Robinson. The lineup play ed for 1 2 .3 8
m inutes and was beaten by 9 points.
Im port this data into Excel so that each play er's nam e is in a separate colum n. Also we want to know how
m any m inutes each lineup play ed and how m any points by which the lineup beat the other team . The
other data is not im portant. Im port this file into Excel. Hint: You will need text functions to extract the
num ber of m inutes. The VALUE function will conv ert text into a num ber.
Knicks Exercise Solution

The Art of Spreadsheet Modeling

A spreadsheet m odel is an attem pt to use a spreadsheet to build a representation of reality using logical
m athem atical relationships.
Organizations often use a spreadsheet m odel to help them m ake im portant decisions. Organizations also use
spreadsheet m odels to determ ine how changes in the external env ironm ent will im pact their success.
Here are som e exam ples of situations for which a spreadsheet m odel m ight be useful:
Should Le Napoleon open a m all kiosk to sell its products?
What price should Le Napoleon charge for a pastry ?
What percentage of rev enues should Le Napoleon spend on adv ertising?
How will Le Napoleon's lev el of cash on hand fluctuate during a ty pical m onth?
How m any bakers does Le Napoleon need to hire each y ear to be able to keep up with projected
dem and for its products?
What is the v alue of a ty pical Le Napoleon custom er?
How m any Flan cakes should Le Napoleon plan on baking each day ?
How m uch should Le Napoleon's m anager sav e for retirem ent?

Model Building Blocks

Each quantity inv olv ed in a spreadsheet m odel can be classified as an output, input, decision v ariable,
or calculation. These are the "LEGOS" we will use to build our m odel.
A m odel out put is the ultim ate quantity of interest that is com puted by the m odel. For exam ple, the
NPV generated by a new bakery or the expected tim e a custom er spends waiting in line at a bakery
m ight be a m odel output. A m odel m ay , of course, hav e m ultiple outputs. For exam ple, annual profit and
m arket share from a new bakery m ight be m odel outputs.
A m odel input is an assum ption about the v alue of a key quantity of interest that is needed to com pute a
m odel output. For exam ple, in our new bakery exam ple we probably need to assum e an annual growth
rate for units sold. In our waiting line exam ple, the av erage num ber of custom ers arriv ing at the bakery
per hour m ight be a m odel input. Models often hav e m any inputs!
Decision Variables are quantities that can be controlled by the decision m aker. In our new bakery
exam ple, Le Napoleon can certainly control price and adv ertising, so those would be decision v ariables. In
our waiting line exam ple, Le Napoleon can control the num ber of clerks waiting on the custom ers, so this
would be a decision v ariable.
The heart of any m odel is the set of relationships (usually im plem ented through Excel form ulas) that are
used to transform m odel inputs and decision v ariables into outputs. For exam ple, in the waiting line
exam ple, the following form ula can be used to determ ine how custom er waiting tim e depends on arriv al
rate and num ber of clerks.

Model Terminology

A m odel that prescribes a course of action is a prescriptiv e m odel. For exam ple, a m odel that
recom m ends a price for pastries would be a prescriptiv e m odel. A spreadsheet that dev elops a cash budget
which is used to predict Le Napoleon's cash needs ov er the next y ear would be a descriptiv e m odel.
34/52

10/13/13

Spreadsheet Modeling

A m odel in which all inputs and outputs are known with certainty is known as a determ inistic m odel. For
exam ple, if we assum e we know the unit cost of producing a Napoleon and know with certainty for any
price the dem and for Napoleons, it is a sim ple m atter to dev elop a determ inistic m odel that can be used to
find the profit m axim izing price for Napoleons. Of course, there is no way we can know with certainty the
dem and for Napoleons. Therefore we could choose to m odel the dem and for Napoleons as an uncertain
quantity . This would result in a stochastic m odel. We will learn about stochastic m odels in Unit 1 1 when
we discuss Monte Carlo Sim ulation.

The Spreadsheet Model Building Process

The following steps will often help us build a m odel:


STEP 1: What do we want to use the m odel to accom plish?
STEP 2: To accom plish our goal, what output quantities m ust be com puted?
STEP 3: What inputs and decision v ariables need to be determ ined in order to com pute the needed
outputs?
STEP 4: Identify the key logical relationships between our inputs, decision v ariables, and outputs.
In essence, this requires us to determ ine the calculations or form ulas that enable the m odel user to
turn the inputs and decision v ariables into output v alues.
STEP 5: Set up a spreadsheet that uses the logical relationships to relate inputs, decision
v ariables, and outputs.
STEP 6: If the m odel is prescriptiv e, use the m odel to m ake the key decisions.
STEP 7 : Identify the m odel's lim itations. For exam ple, are there any key factors that our m odel
does not consider?
We will soon use this m odel-building fram ework to help determ ine if Le Napoleon should open up a new
bakery . Before dev eloping the m odel, let's look at som e guidelines that can help y ou dev elop "intelligent"
m odels.

Rules to Guide Intelligent Modeling

Soon we will try to build a m odel that will help Le Napoleon decide whether or not to open up a new
bakery . The ideas used to dev elop our m odel can be used to dev elop a m odel which can determ ine if a
generic business v enture will be a success. The ideas used to dev elop our m odel can also be used when y ou
create a financial m odel to ev aluate a potential capital expenditure such as a plant expansion or purchase
of a new m achine. Before we dev elop our m odel, we giv e som e rules to guide "intelligent" m odel building.
Many of our rules will require knowledge of Excel tools that we hav e not y et cov ered (data tables,
spinners, etc.), but be assured that by the end of this chapter y ou will hav e m astered m any neat Excel
tools and ideas that will aid y ou in the process of intelligent m odel building.
When setting up a spreadsheet m odel, spreadsheet inputs and decision v ariables should never be hardcoded in formulas; input s and decision variables should alway s be ent ered in t heir own cells.
If an input or decision v ariable is hard-coded into a form ula, then a user of the m odel cannot easily
change the input and see the effects of an input change on m odel outputs. If a m odel input is entered in its
own clearly labeled cell, then the user of a m odel can easily change an input v alue or decision v ariable
and see how m odel outputs change. In a m ultiple worksheet m odel, inputs should be placed in a single
worksheet. Decision v ariables can be placed near inputs or giv en their own worksheet, if possible. In a
single worksheet m odel inputs and decision v ariables should be placed in a single area. A com m on lay out
structure is to place m odel inputs and decision v ariables on the top of a worksheet, followed by worksheet
calculations. The m odel outputs m ay then be placed below the calculations or to the right of the m odel
inputs and decision v ariables.
A spreadsheet m odel is easier to follow if we use different colors to denote each ty pe of building block. We
will use the following color-coding conv ention:
Yellow for Inputs
Blue for Decision Variables
Orange for Calculations
Gray for Outputs
The sam e color conv ention can be used to identify worksheets in a m ultiple worksheet workbook. For
exam ple, by right-clicking on the tab nam e of a worksheet containing inputs, we m ay select Tab Color
and color the tab nam e in y ellow.
35/52

10/13/13

Spreadsheet Modeling

If y ou hav e trouble determ ining how y our spreadsheet inputs and decision v ariables can be used to
calculate m odel outputs, y ou can use influence charts to dev elop an understanding of a m odel's key
form ulas and relationships. For exam ple, we will see that in dev eloping a m odel of the new bakery
decision, we can use an influence chart to determ ine what quantities m ust be com puted for us to
calculate profit during each y ear the bakery is operated.
As we saw in the chapter "Useful Excel Functions," range nam es can m ake it m uch easier to understand
spreadsheet form ulas. For exam ple, if cell A50 contains a product's price and cell B1 00 contains dem and
for a product, we could determ ine product rev enue with the form ula = A50*B1 00. Using range nam es,
this form ula would look som ething like price*dem and, which is m uch easier to understand.
Be wary of using range nam es in a m ulti-worksheet workbook. Successful use of range nam es in m ultiworksheet workbooks often requires knowledge of adv anced concepts such as sheet lev el worksheet nam es.
Without docum entation, a m odel user m ay not understand how a com plex form ula works. You can place
com m ents or annotations in cells to help the user better understand com plex form ulas. You can also use
text boxes to docum ent form ulas. Text boxes do not reside within the sam e cell as a form ula, but y ou can
use an arrow to point from the text box to the cell that is being explained in the text box.
With proper use of the copy com m and, y ou can enter a form ula in a single cell and copy the form ula
down 1 ,000,000 rows or across 1 6 ,000 colum ns! This sure beats ty ping in thousands of form ulas. When
copy ing form ulas, m ake sure y our use of absolute and relativ e addressing (the $ signs discussed in an
earlier chapter) is correct.
Any assum ptions we m ake about m odel inputs are bound to be in error. For exam ple, if we assum e sales
at a new bakery will grow 1 0% per y ear, they m ay v ery well grow 5% a y ear or ev en 2 0% a y ear. For
this reason, a m odeler should alway s do a sensitiv ity analy sis to determ ine how sensitiv e m odel outputs
are to changes in im portant m odel inputs. We will learn how to use Excel's data tables and spinners
features to facilitate sensitiv ity analy sis. A data table enables us to easily create a table that shows how
m ultiple inputs v ary with a change in a single input or how a single output v aries with changes in two
inputs.
A spinner enables y ou to change the v alue of an input sim ply by clicking on the up or down arrow of the
spinner control.
A m odel should also be tested for sensibility . For exam ple, if the unit cost of producing a pastry increases,
we would expect Le Napoleon's NPV from a new bakery to decrease and the profit m axim izing price to
increase.
Conditional form atting can be used to clarify a sensitiv ity analy sis. For exam ple, we can use conditional
form atting to highlight the profit-m axim izing price for different unit costs of producing a pastry .
Suppose our m odel recom m ends that Le Napoleon should build the bakery . Basically , this m eans that if
our input assum ptions are correct, then the bakery should be built. For our key inputs we can ask the
following question: how m uch would a key input hav e to change in v alue in order for our final decision to
change? For exam ple, we m ay currently be assum ing annual sales growth of 1 5%. For this v alue, our
m odel say s go ahead with the bakery . We m ight ask how bad an annual growth rate could be before
opening the bakery would be a poor decision. If we found, for exam ple, that if annual growth is -3 0% or
better we should still build the bakery , we would feel pretty good about going ahead with the bakery .
Using Excel's Goal Seek feature, we can easily determ ine the v alue of each input that would m ake the
project NPV = 0. This helps us determ ine how sensitiv e our final decision is to changes in each input.
Often users of a m odel will enter input v alues that are unreasonable and cause the spreadsheet form ulas
to y ield error m essages or unreasonable results. The considerate m odeler has an obligation to set up the
m odel so users will be inform ed when they hav e m ade an input error. For exam ple, suppose we m odel
Rev enue and Units sold as m odel inputs and we need to calculate price with the form ula
= rev enue/units_sold. If Units_sold = 0 we will receiv e an error m essage.(#DIV/0.) As explained in the
"Useful Excel Functions" chapter, we can use IFERROR (or often an IF statem ent) to inform the m odel user
of his or her input error. For exam ple, com puting price with the form ula
= IFERROR(Rev enue/Units_Sold,"Units sold m ust be > 0") would inform the user of an error if the user
enters a v alue of units sold< = 0. Excel's Data Validation feature (to be cov ered later in this chapter) can
also be used to reduce the frequency of input errors.
You m ay also use the Error Checking option to check a worksheet for errors. Sim ply select the entire
worksheet by choosing the Select All button (between the Colum n A and Row 1 Label) and then choosing
Error Checking from the Form ula Tab. Excel will then point out all errors it finds in the worksheet. Often,
howev er, Excel flags form ulas that are OK.
36/52

10/13/13

Spreadsheet Modeling

Now, m atter how good y ou are at Excel, y ou will often receiv e spreadsheet m odels that contain com plex
form ulas that y ou do not understand. We will see that by highlighting part of a form ula and hitting F9 ,
y ou can see the v alue returned by any part of a com plex form ula. This often helps y ou better understand
how the form ula works. You can also use the Ev aluate Form ulas option from the Form ulas Tab to help
y ou step through a com plex form ula. If y ou use Ev aluate Form ulas and repeatedly choose Ev aluate, y ou
will see how Excel ev aluates the form ula.
Models need to be flexible so that they can easily incorporate changes. For exam ple, if a m odel requires
sales rev enues for products sold by a com pany , then we should set up the m odel so products can be added
or subtracted from the list of products. In our bakery m odel we do not know the num ber of y ears for
which the bakery will operate, so we should set up the m odel to easily enable us to v ary the num ber of
y ears of operation.
Excel's Table Feature can often m ake it easy to incorporate flexibility into y our m odel. As we will see, if
we add data points to our spreadsheet, the Table feature can ensure that form ulas and charts
autom atically are updated to include the new data.
It is not easy to do calculations on a m odel inv olv ing m ultiple worksheets. If y ou set up y our worksheets
in a consistent fashion, howev er, y ou can use 3 D form ulas to perform m any calculations of interest. For
exam ple, if each worksheet contains quarterly sales of all y our com pany 's products, it is a good idea to
alway s put the sales of a product during a giv en quarter in the sam e cell. Then y ou can easily use 3 D
form ulas to easily total the sales of each product ov er all the quarters. 3 D form ulas are cov ered in a
future chapter.
It is im portant to understand a m odel's lim itations. For exam ple, in m odeling whether or not we should
open a new bakery , m any inputs such as annual sales growth rate are not known with m uch certainty .
When there is a great deal of uncertainty about m odel inputs, y ou can use Monte Carlo sim ulation to
m odel inputs and "random v ariables" and thereby generate a range of possible outcom es for the m odel
output(s). For exam ple, we m ight find that giv en our assum ptions, there is a 9 2 % chance that a new
bakery will m ake m oney . This would indicate that we should go ahead with the bakery .
We all m ake m istakes. When y ou m ake a m istake select Undo (Control + Z) ASAP, to undo it!

Building a Model

Le Napoleon is considering opening up a new bakery in Bloom ington, Indiana. You hav e been hired to
dev elop a m odel to determ ine whether opening the new bakery is a good idea. As we build our m odel, y ou
will see m any of our intelligent m odeling rules in action, and y ou will learn about m any of Excel's
outstanding m odel-building capabilities, such as data tables, spinners, com m ents, etc.
Let's use the m odel-building process to help get us started.
St ep 1: What do we want to use the m odel to accom plish?
We want to determ ine whether or not Le Napoleon should open the new bakery .
STEP 2: To accom plish our goal, what output quantities m ust be com puted?
If the NPV of the cash flows from the bakery is positiv e, the bakery will enhance ov erall profitabilty
(ev en if it m ay hav e a negativ e short term effect,) and probably should be built. from the bakery is
positiv e, the bakery will enhance ov erall profitabilty (ev en if it m ay hav e a negativ e short term effect,)
and probably should be built. Recall from the chapter "Useful Excel Functions" that m axim izing NPV
instead of the sum of profits ensures that we properly account for the tim e v alue of the m oney .
Since y ou hav e not y et begun y our studies m any of y ou do not know how to com pute cash flows. In
this exam ple, we will assum e no taxes and no depreciation of the bakery building costs, which we will
assum e are im m ediately expensed. We will also ignore changes in working capital. (Do not worry if y ou
do not understand these term s; after taking accounting y ou will!) Under these assum ptions cash flows
equal profits, which are sim ply calculated as rev enues less expenses.
STEP 3: What inputs and decision v ariables need to be determ ined in order to com pute the needed
outputs?
Le Napoleon m ust determ ine the size of the bakery and the price to charge for pastries. We will m ake
the bakery size and pastry price for each y ear of operation decision v ariables. Determ ining our
spreadsheet inputs will be easier once we hav e started to work on Step 4 or the m odel-building process.
37/52

10/13/13

Spreadsheet Modeling

Recall that Step 4 of the m odel-building process is to identify the key logical relationships between inputs,
decision v ariables, and outputs. We will use influence charts to help us identify the m odel inputs as well
as how the inputs and decision v ariables can be used to calculate the bakery 's NPV.
Influence charts prov ide a conv enient way to organize the relationships between spreadsheet inputs,
outputs, and outcom es. Powell and Baker (Managem ent Science: The Art and Science of Modeling with
Spreadsheets, 2 007 ) prov ides an excellent discussion of influence charts. In an influence chart, we use
the following sy m bols to represent aspects of the m odel:
A hexagon 8is used to represent the m odel output.
An oval is used to represent other outputs.
A t riangle is used to represent an input v alue that is known with certainty .
A rect angle is used to represent a decision v ariable.
A double circle is used to represent an input that is stochastic or not known with certainty .
Arrows are used to represent the relationships between v arious quantities. For exam ple, the following
diagram would indicate that the com putation of profit requires knowledge of rev enue and Total Cost.
Please download the file Influencechart.xlsx.
We will now use an Influence Chart to determ ine the quantities needed to com pute our m odel output
(bakery NPV).
We will assum e an annual discount rate for profits of 1 5%. This m eans that $1 of profit earned a y ear
from now is equiv alent to $ 1/1.15 earned now. In m odeling bakery building costs (call it BBC) as a
function of the annual capacity x of the bakery (call it x = num ber of pastries that can be baked per
y ear), it is tem pting to assum e BBC= kx. Usually , howev er, the cost of building is m ade up of a fixed cost
plus a per-unit cost. We will follow this route and assum e BBC = 4 00,000+ 3 x. That is, there is a fixed cost
of $4 00,000 incurred in building a bakery and a cost of $3 per unit of pastry capacity . If y ou believ e that
there is a dim inishing cost of adding each unit of capacity y ou m ight try a m odel of the form BBC= Fixed
cost + kx b , where 0< b< 1 . This will ensure that each additional unit of capacity will incur a sm aller cost.
We now need to figure out how to com pute annual bakery profits. Let's use an influence chart to help us
determ ine how to com pute annual bakery profits.
We need to realize that Year t + 1 dem and and Year t + 1 unit cost are related to the v alues of these
quantities during the prior y ear. The following influence charts shed light on the nature of these
relationships.
We know that each y ear's price is a decision v ariable. To sim plify our m odel we will assum e Le Napoleon
assigns a Year 1 price and thereafter price grows by the sam e percentage (5%) each y ear. Initially we will
assum e a Year 1 price of $3 .00. For sim plicity , we will assum e each y ear's dem and is a linear dem and
curv e of the form Year 1 dem and = a - bp. This is probably unrealistic because if price is sufficiently large
this equation predicts negativ e dem and. Despite this fact, m any analy sts utilize a linear dem and curv e.
Many analy sts assum e dem and = ap - b. This is called the power or constant elasticity dem and curv e.
How can we determ ine a and b for our dem and curv e? The param eter a is sim ply the estim ated annual
dem and if we chose a price of $0. Let's suppose 4 2 0,000 pastries. The param eter b is our estim ated loss in
annual dem and if we increase the price by $1 . We will assum e b = 6 0,000. Placing the v alues of a and b
in cells rather than directly in form ulas will m ake it easy to change the v alues of a and b and determ ine
how this im pacts the bakery 's projected v iability .
For dem and after y ear 1 we will use a two-stage growth m odel. We assum e that dem and will grow at a
rather large rate (say 1 5%) for a giv en num ber of y ears (say 5). Thereafter the annual growth rate in
dem and will reach a reduced or "steady state" lev el which is a giv en fraction (say 1 /3 ) of the initial
growth rate.
We will sim ply assum e a giv en unit cost for the first y ear of sales ($1 .50 during y ear 2 01 3 ). Then we
assum e that each y ear unit cost grows at the sam e rate (assum ed to be 6 %). We note that costs usually
are assum ed to grow at a faster rate than prices, and our choice of input param eters reflects this v iew of
the world.
We will assum e that all construction costs are paid on 1 /1 /2 01 2 . Sales are assum ed to begin on 1 /1 /2 01 3 .
At what date should we book all profits for a giv en y ear, say 2 01 3 ? Since profits are earned throughout
38/52

10/13/13

Spreadsheet Modeling

the y ear, it seem s reasonable to "book" our profits for any y ear at the y ear's m idpoint. Therefore we will
assum e the bakery 's profits for any y ear are all receiv ed on June 3 0 of that y ear. Then we will use the
XNPV function (see Chapter 5) to com pute the NPV of the profits receiv ed by the bakery .
From our influence charts we can identify the following key relationships:
Year
Year
Year
Year
Year

t
t
t
t
t

Profit = Year t Rev enue - Year t Total Cost


Rev enue = (Year t units sold)*(Year t Price)
Units Sold = Minim um (Capacity , Year t Dem and)
+ 1 Dem and = (Year t Dem and)*(Year t + 1 Dem and Growth rate)
+ 1 Unit Cost = (Year t Unit cost)*(Year t + 1 Unit Cost Growth Rate)

We will now see that arm ed with our knowledge of copy ing form ulas it will be a snap to set up a
spreadsheet that transform s our input assum ptions into a project NPV for the new bakery !
Le Napoleon has hired a new m anager, Charlene Wu. Charlene is try ing to build a m odel to help her
determ ine how to sav e for retirem ent. What would be som e key inputs into her m odel? What would be the
decision v ariables? What m ight be the m odel outputs?

Set up the Spreadsheet Model

Please download the file Copy of Data Table.xlsx.


To begin the set up of our spreadsheet m odel, we will enter our estim ates for input param eters and
decision v ariables.
By m aking judicious use of range nam es and copy ing, we m ay easily enter the spreadsheet assum ptions
into our spreadsheet. We will hide the colum ns for y ears 2 01 9 -2 02 1 , so we can see both the first and last
y ears of our m odel.

Data Tables

Giv en our assum ed v alues for our inputs and decision v ariables, the positiv e NPV indicates we should
build the bakery . Of course, our inputs and decision v ariable estim ates m ay not be correct or be subject to
change. We would like to exam ine how sensitiv e our m odel output (NPV) is to changes in our decision
v ariables and/or inputs. Data tables are probably the tool m ost widely used to perform sensitiv ity
analy sis in Excel. A one-way dat a t able allows us to determ ine how a change in a single input or
decision v ariable changes one or m ore spreadsheet outputs or calculations. We will use a one-way data
table to determ ine how a change in price affects bakery NPV. For sim plicity we will assum e that all Le
Napoleon's bakeries hav e a capacity of 3 00,000 pastries per y ear. To create a one-way data table, we
begin by listing, in a colum n, possible v alues for our input or decision v ariable (in this case, price). Then
we enter the form ulas for the outputs of interest going across a row (starting one row abov e first input
v alue and one colum n to the right of the listed input v alues). After selecting Data Table from the What-If
portion of the data tab, we can m ake our Data Table com pute the v alue of each listed form ula for each
listed input v alue. Then we can see how sensitiv e our form ulas (usually m odel outputs) are to changes in
a decision v ariable or m odel input.
Let's suppose that Le Napoleon is considering a pastry price between $3 and $8 during 2 01 3 .
Our table shows that a m axim um NPV of $2 ,57 7 ,883 is attained by charging a price of $4 .50. We used
the Highlight Cells conditional form atting option to highlight in red the largest NPV v alue. This is
useful because if we change ot her input s or decision variables, t hen t he red format t ing will
st ill indicat e t he NPV maximizing price.
You cannot delete or edit a portion of a data table. Try and delete the contents of any cell in the data table
and y ou will find y ou cannot delete the contents of the cell. If y ou select the table range and right-click
and select Paste Special and then choose Values, y ou lose the data table structure but y ou can delete the
contents of the cell(s) or edit their contents.
Som e of y ou who hav e tried to duplicate our work m ay hav e been disappointed to find that all the
com puted quantities in the data were the sam e. If this is the case, sim ply hit F9 (the recalculate key ) and
y ou will see the correct output v alues com puted. The m ethod in which Excel fills up a data table depends
on the calculation m ode y ou choose. By selecting Calculation Options from the Form ulas tab, y ou m ay
choose from one of the following calculation options: Autom atic, Autom atic Except for Tables, and
Manual. We now giv e a brief explanation of each of these calculation options.
39/52

10/13/13

Spreadsheet Modeling

Autom atic - This setting is the usual setting. All form ulas and data tables recalculate when data or
form ulas are entered into the spreadsheet.
Autom atic Except for Tables - If y ou choose this setting, then y our form ulas will recalculate
whenev er y ou enter data or form ulas into y our spreadsheet. Y our dat a t ables will not
recalculat e unless y ou hit t he F9 key . This setting is useful in large spreadsheets because in
large spreadsheets recalculation of data tables can be tim e consum ing.
Manual - When Calculation Mode is on Manual, no form ulas or data table will recalculate unless
y ou hit the F9 key . Manual calculation is useful in a large spreadsheet, because in large
spreadsheets recalculation of form ulas can be tim e consum ing. Rem em ber that in Excel 2 007 a
spreadsheet can hav e up to 1 ,04 8,57 6 rows and up to 1 6 .3 9 4 colum ns.
Please download the file Kioskexam ple.xlsx.
The file kioskexam ple.xlsx contains a m odel to estim ate the annual profit from a kiosk in Bloom ington
Indiana's College Mall. Create a one-way data table that shows how profit, rev enue, and v ariable cost
v ary as the price of a pastry v aries in $0.2 5 increm ents between $1 .2 5 and $3 .50.
Data Tables Exercise Solutions

Two-Way Data Tables

With a two-way data table, we can v ary two inputs or decision v ariables and see how the changes in
these quantities change a single output. We will now use a two-way data table to see how the NPV of the
new bakery changes as we v ary (in $0.50 increm ents) the Year 1 price between $3 .00 and $8.00 and
v ary the Year 1 Unit cost between $1 .00 and $3 .00. To create a two-way data table, we begin by listing
v alues of one input or decision v ariable going down a single colum n. Then we m ov e up one row and ov er
one colum n and list the v alues of the other input or decision v ariable. Then we enter the output form ula
we wish calculated directly abov e the first input v alue.
To finish constructing the two-way data table, we select the table range (the range containing the v alues
of inputs, the output form ula, and the cells where we will com pute NPV v alues for each com bination of
inputs). Then we select the row and colum n input cells for the data table and we are done!
As described in Unit 5, we used the Conditional form atting Form ula option to highlight in y ellow for each
unit cost the NPV m axim izing price. We see that as the unit cost increases to $2 .00 or higher, the NPV
m axim izing price jum ps from $4 .50 to $5.00. Com m on sense tells us that cost increases are passed on to
custom ers, so our m odel passes this test of sensibility . Each row of the data table shows that as costs
increase, NPV decreases. Again that is a sensible result.
For the file Kioskexam ple.xlsx construct a two-way data table that shows how profit changes as price
changes from $1 .2 5 to $3 .00 (in $0.2 5 increm ents) and unit cost ranges from $0.80 to $1 .2 0 (in $0.1 0
increases).
Two-Way Data Tables Exercise Solutions

Goal Seek

Please download the file Goalseek.xlsx. We hav e now established that if we build a 3 00,000 pastry
annual capacity and charge $4 .50 during 2 01 3 , the bakery will add ov er $2 m illion in v alue to Le
Napoleon. Of course, this result assum es that our assum ptions about v alues for other inputs are accurate.
Before building the bakery it would be a good idea to determ ine how m uch our other m odel inputs m ust
change to m ake building the bakery a bad idea (NPV< 0). Excel's Goal Seek feature is perfectly suited to
this task. Essentially , Goal Seek allows us to find the v alue of a cell that m akes a particular form ula hit a
desired v alue. For exam ple, we will use Goal Seek to determ ine the annual growth rate in dem and that
would cause the bakery NPV drop to 0.
We bring up Goal Seek by selecting What If Analy sis from the Data Tab and then choosing Goal Seek. The
Goal Seek Dialog box will occur and we will need to fill in the following inputs:
Set Cell: The form ula which we use to assum e a desired v alue. In our situation the set cell will be
cell B2 9 which contains the calculated NPV.
To Value: The v alue or "goal" that we want our Set Cell to assum e. In our situation we want To
Value to equal 0, because an NPV< 0 would change our decision.
By Changing Cell: The cell that can be changed to enable our Set Cell to hit the desired goal. In
our case the By Changing Cell will be the Beginning Growth rate (cell D9 ).
40/52

10/13/13

Spreadsheet Modeling

For the file Kioskexam ple.xlsx determ ine the lev el of annual dem and needed for the kiosk to earn
$1 00,000.
Goal Seek Exercise Solutions

Auditing

Often we receiv e large and com plex spreadsheets from colleagues. It is often difficult to understand the
logic that was used to create the spreadsheet. For exam ple, if we sent our spreadsheet to a colleague, they
m ight hav e trouble understanding how our assum ed Beginning Growth Rate affects our NPV
calculations.
Excel's Auditing Tool m akes it easy to determ ine how spreadsheet inputs and outputs are related. To
illustrate the use of the Auditing Tool, let's begin by determ ining how our assum ed Beginning Growth
Rate is used in our NPV calculations.
Suppose that we receiv e a spreadsheet and we are not sure what inputs or decision v ariables are needed to
com plete a calculation. By selecting Trace Precedents, we can find all inputs and decision v ariables that
are needed to com plete a calculation. To illustrate the use of Trace Precedents, let's determ ine what
inputs are needed to com pute our 2 01 4 Rev enue.
When I receiv e a m ulti-sheet workbook I usually cringe in fear because it is difficult to determ ine how
things fit together. The Auditing Tool can often be used to decode the logic used in a m ulti-sheet
workbook. Please download the file Audittwosheets.xlsx.
In the workbook Audittwosheets.xls we hav e com puted in the worksheet Outputs the annual profit from
opening a kiosk in a m all. How can we find the input assum ptions that were used to com pute the profit?

Flexibility

We hav e assum ed that the new bakery will be open for 1 0 y ears. Clearly the bakery m ight be open for
m ore or less than 1 0 y ears. We now show how to change our spreadsheet form ulas so that we can easily
v ary the num ber of y ears the bakery is open.
Modelers often like to define "scenarios" which consist of a set of v alues for all inputs. For exam ple, a
com m on procedure is to define a Best Case, Worst Case, and Most Likely scenario. We will show how to use
VLOOKUP functions to easily set up scenarios.
Please download the file Copy _of_flexible.xlsx.
We will now m odify our m odel so that we can v ary the num ber of y ears of operation for the bakery up to
2 0 y ears. The 2 0th y ear of operation would be 2 03 2 so we selected the cell range N1 7 :N1 8 and copied
this range to the range O1 7 :X3 2 . This adds the num bers 1 1 , 1 2 , 2 0 to row 1 7 and adds to row 1 8 the
m idpoints of each y ear through the last possible y ear of operation 2 03 2 . Next we will m ov e to the cell
containing our NPV calculation B2 9 and change the form ula to ensure that all profits through 2 03 2 (if
any ) will be picked up in our NPV calculation.
We now enter in cell D1 6 the num ber of y ears the bakery will operate. Using Create from Selection, we
nam ed this cell Years_of_Operation. Clev er use of IF statem ents will ensure that no profit is earned when
the bakery is not being operated. Basically we will enter in rows 2 0-2 5 of Colum n a form ula that enters
the phrase No operation after the bakery ceases operations. Then in row 2 7 we will ensure profit is $0 after
the bakery ceases operation.

Comments and Text Boxes

A considerate m odeler will annotate his or her spreadsheet with docum entation that helps users of the
m odel understand the m odel's com plexities and intricacies. To insert a com m ent in a cell, sim ply m ov e to
the cell where y ou want to put the com m ent and from the Rev iew Tab select New Com m ent. Then ty pe
the com m ent within the box that appears. Cells with com m ents are indicated by a sm all red triangle in
the cell. Let's show how to put a com m ent in cell D8 that docum ents the m eaning of cell D8.
The following tips will help y ou m anage y our com m ents:
Selecting Edit Com m ent lets y ou edit a com m ent.
41/52

10/13/13

Spreadsheet Modeling

Selecting Delete Com m ent lets y ou delete a com m ent.


Selecting Show/Hide Com m ent allows y ou to toggle between showing and hiding a com m ent.
Selecting Show All Com m ents allows y ou to toggle between showing all com m ents and hiding all
com m ents.
To control the printing of com m ents, select the Page Lay out tab and click on the sm all arrow
beneath Print titles. The Page Setup dialog box will appear. From the Sheet tab, clicking on
Com m ents allows y ou to choose one of the following options:
1 . Print com m ents as they appear on the worksheet.
2 . Print all com m ents at the bottom of the sheet.
3 . Print the worksheet so no com m ents print.
After inserting a rectangle shape in a spreadsheet, we m ay ty pe in the "text box" som e text to docum ent a
cell and use an arrow to point to the cell.
By clicking on the red triangles, y ou can v iew som e other com m ents we added to the m odel. Of course,
clicking Show All Com m ents will let y ou v iew or hide all com m ents.

Error Trapping

Before passing y our spreadsheet m odel onto y our colleagues, y ou should build into y our m odel checks
that reduce the possibility of errors, or at the least indicate the occurrence of spreadsheet errors.
Rev iewing our m odel, we see the following possibilities of errors:
If price is high enough, we m ight see the unrealistic occurrence of a negativ e dem and. To rem edy
this problem , we will m odify our y ear 1 dem and form ula to ensure that negativ e y ear 1 dem and
cannot occur.
Clearly the y ears of high growth m ust not exceed the num ber of y ears of operation. We will use an
IF statem ent to ensure that if this condition is v iolated, the user is inform ed of that fact.
Num ber of y ears of operation should not be allowed to exceed 2 0. We will use DATA VALIDATION
to ensure that this is the case. Using Data Validation, we can prev ent the entry of a num ber > 2 0
in cell D1 6 .
In cell E2 1 we will m odify our form ula for y ear 1 dem and to ensure that negativ e dem and cannot occur.
In cell D8 we enter y ears of high growth. In cell B8 we will enter a form ula that will warn the user if
Years of High Growth > Years of Operation.
We will now use Excel's Data Validation feature, to ensure that the user can only enter in cell D1 6 a v alue
for y ears of operation between 5 and 2 0. To use Excel's Data Validation feature select the range of cells for
which y ou want to create a v alidation criteria. Then sim ply specify the criteria. For exam ple, cell D1 6
m ust contain a whole num ber between 5 and 2 0. As long as the entered v alue m eets the v alidation
criteria, things are fine. If the entered v alue does not satisfy the v alidation criteria, the user will be
greeted by an error m essage.

Using F9 and Evaluate Formula Feature

You will often encounter com plex spreadsheet form ulas that are difficult to understand. After selecting
any part of a form ula and hitting F9 , Excel will ev aluate or show the v alue of the selected portion of the
form ula. This can often help y ou better understand a com plex form ula. Just m ake sure y ou hit escape
before exiting the form ula or y ou will lose the form ula. Selecting Ev aluate Form ula followed by Ev aluate
will allow y ou to see a step-by -step ev aluation of a form ula.

Scenarios

Please download file Scenarios.xlsx. Let's suppose we want to create a Best, Worst, and Most Likely
scenarios for our new bakery decision. We can enter input v alues corresponding to each scenario in our
spreadsheet and show how our NPV changes in each scenario. Let's suppose our three scenarios are defined
by the following choices of param eters.
We want to set up our spreadsheet so that the user can choose a scenario (Worst, Most Likely , or Best) and
then the input param eters autom atically change and the user can v iew the NPV corresponding to that
scenario. We will enter the param eter v alues for each scenario in the spreadsheet and then use VLOOKUP
42/52

10/13/13

Spreadsheet Modeling

functions to pick off the input param eters corresponding to the scenario. We will use a neat Excel feature
the Data Validation drop down box to allow the user to enter the scenario nam e.
To begin, we ty pe the scenario nam es and input param eter v alues in the cell range H8:N1 1 . Note we used
word wrap so the headings for each input wrap around the cell. Then we recopied the NPV calculation to
cell D2 so the NPV can be easily v iewed with the input param eters. We nam ed the range H9 :N1 1 Lookup
to facilitate the entry of our form ulas.
Modify the created scenarios so that the steady state growth rate is included in each scenario.

Spinners

Please download file Spinners.xlsx. We now show how easy it is to insert spinners for an input into a
spreadsheet m odel. Clicking on a spinner enables us to easily change the v alues of a m odel input and see
how the m odel's outputs change. We will create spinners that let us easily change Years of Operation and
Beginning Growth rate.
Before inserting spinners in our worksheet, y ou will need to configure Excel so y ou can see the Dev eloper
tab on the ribbon.
Next, we need to bring up the list of Form Controls, from which we can select a spinner.
Let's suppose that we want to create a spinner that allows us to v ary in cell D1 6 y ears of operation
between 5 and 2 0 y ears. Let's also create a spinner that allows us to easily v ary the Beginning growth
rate in cell D9 between 0% and 50%. To begin, we will select the spinner control and drag a spinner to cell
E1 6 .
Next we will "activ ate" the spinner so it controls cell D1 6 . Let's assum e that we want to v ary Years of
Operation between 5 and 2 0, in increm ents of 1 y ear.
You m ight think that if "y ou hav e seen one spinner y ou hav e seen them all." Linking a spinner to cell D9 ,
howev er, is a little tricky . Let's suppose that our beginning growth rate in dem and (which is entered in
cell D9 ) should be allowed to v ary between 0% and 50% in 1 % increm ents. What m akes this tricky is that
the m inim um increm ent on a spinner is 1 , not .01 . To work around this problem , we link the spinner to
cell F9 and in cell D9 ent er t he formula =F9/100. Now we can set the spinner in E9 so that cell F9
v aries from 0-50 in increm ents of one. This will cause cell D9 to v ary between 0 and 50 in increm ents of
.01 .
Of course, we see by clicking on our spinners that increasing Years of Operation or Beginning growth rate
increases NPV, as expected.
Insert a spinner that allows the ratio of Steady State growth to Beginning growth to v ary from 0 to 0.8 in
increm ents of 0.1 .

Model Limitations

Ev ery m odel has its lim itations. Here are som e lim itations of our m odel:
We hav e assum ed a linear dem and curv e. Often the relation between price and dem and is not
linear.
The two-stage growth m odel m ay not be accurate. To test the v alidity of the two-stage growth
m odel we could check whether the dem and growth for past bakery openings has followed the twostage growth m odel.
Our m odel for building cost as a function of capacity m ay not be accurate. Modelers often assum e
that building a plant with capacity x incurs a cost of a+ bx k., where 0< k< 1 . This ty pe of m odel
ensures that the cost of adding additional units of capacity decreases as m ore units are added.
Finally , none of our param eters are known with certainty . If we are highly uncertain about our
m odel inputs, we should use Monte Carlo Sim ulation to m odel the probability distribution of each
input and generate a range of possible NPV's. Then we could m ake statem ents such as "I am 80%
sure the bakery will hav e a positiv e NPV." In Unit 1 1 we will introduce y ou to the fascinating
world of Monte Carlo sim ulation.
You hav e been asked to build a m odel to help Le Napoleon's m anagers with retirem ent planning. The
inputs to the m odel should be as follows:
43/52

10/13/13

Spreadsheet Modeling

Current age
Present size of retirem ent account
Required Annual Withdrawal during retirem ent y ears (in today 's dollars)
Annual Contribution to retirem ent fund (Decision Variable)
Age of Retirem ent
Annual Inflation Rate
How m any y ears y our retirem ent sav ings should last
Annual rate of return on inv estm ent account
Our m odel outcom e m easure is "Did I hav e enough m oney to last through retirem ent and m aintain m y
desired standard of liv ing?" Set up a spreadsheet m odel to help Le Napoleon's m anagers with their
retirem ent planning.
Model Lim itations Exercise Solutions

Using Excel Solver

In this unit we will show y ou how to use the Excel Solv er. The Excel Solv er is used to solv e opt imizat ion
problems. An optim ization problem requires a decision m aker to find the best way to do som ething giv en a
set of restrictions or constraints. Here are som e exam ples of optim ization problem s that y ou will probably
encounter:
What product prices m axim ize a com pany 's profit?
What production schedule m inim izes the cost of m eeting dem and on tim e?
What is the cheapest way to ship Budweiser beer from the place of m anufacture to the local liquor
stores?
What asset allocation for retirem ent (between bonds, US stocks, Em erging Market stocks, real estate,
and com m odities) incurs the least risk for a desired lev el of expected return?
Please download file Solv er.xlsx.

Solving Optimization Problems


To begin, we m ust install the Excel Solv er. Click on the Office button (the ov al in the upper left hand
corner of y our screen).
Then choose Excel options and choose Add-ins. Then select the Solv er Add-in and click OK. If y ou now click
on the Data tab y ou should see an icon for the Solv er (denoted by a ? m ark) on the right hand side of y our
screen. This m eans the Solv er is ready to roll!
A Solv er m odel has three parts, specified in the Solv er dialog box.
Let's try to identify the three parts of the relev ant Solv er m odel for som e of our prev ious exam ples.

Developing a Solver Model

Now let's dev elop and solv e a Solv er m odel that can help Le Napoleon m axim ize its daily profit. The file
Solv er.xlsx giv es for each product the sales price, m inutes of baker tim e needed, ounces of flour needed,
ounces of sugar needed, and m axim um daily dem and for each product. We are also giv en the av ailable
quantity of baker tim e, flour and sugar.
Le Napoleon's goal is to determ ine the quantity to produce of each product that will m axim ize its daily
profit. Let's now identify the three parts of this Solv er m odel.
Target Cell: Maxim ize daily profit.
Changing Cells: How m any of each product m ust be produced? A fractional num ber of a product
is not acceptable.
Const raint s: Do not m ake m ore of a product than custom ers are willing to buy . Also, we cannot
use m ore baker tim e, flour, or sugar than what we hav e av ailable. We will also need to tell Solv er
that the num ber of units m ade of each product is non-negativ e.
Any set of v alues for our changing cells that m eets the problem 's constraints is called a feasible
solut ion. Solv er finds a set of feasible changing cell v alues that optim ize the target cell; that is, no set of
changing cell v alues that m eets the constraints can find a better target cell v alue. For our Solv er m odel,
44/52

10/13/13

Spreadsheet Modeling

Solv er will find an optim al target cell v alue of $83 1 .2 0. This m eans that no set of changing cell v alues
that satisfy the constraints can y ield a profit larger than $83 1 .2 0. There m ay be m ore than one set of
changing cells obtaining the optim al profit of $83 1 .2 0, but we cannot tell after running Solv er whether
or not the set of changing cells attaining the optim al target cell v alue is unique.
What m ust we track in our spreadsheet to set up our Solv er m odel?
We m ust track profit as a function of our changing cells.
We m ust track profit because profit is our target cell.
We m ust track the baker tim e used, sugar used, and flour used as a function of our changing cells
in order to see if our constraints on av ailable baker tim e and flour and sugar av ailability are
satisfied.
Next we will com pute the target cell v alue corresponding to our changing cell v alues. Our profit m ay be
com puted as
(Napoleons produced)*(Unit profit per Napoleon) + (Chocolate clairs produced)*(Unit profit per
Chocolate clair) + ...(Tahiti cakes produced)*(Unit profit per Tahiti Cake).
In cells E3 :G3 we hav e entered the am ount of baker tim e (in m inutes) and flour and sugar (in ounces)
that are av ailable. For exam ple, we hav e 5 workers working 4 80 m inutes per day , so we hav e 2 4 00
m inutes of baker's tim e av ailable. Next we will com pute our usage of baker tim e, flour and sugar. Again,
we will use Excel's wonderful SUMPRODUCT function.

Configuring Solver to Solve the Problem

We are now ready to use the Excel Solv er to find the profit-m axim izing product m ix. To activ ate the
Excel Solv er, sim ply choose Solv er from the Analy sis section of the Data tab. Recall that Solv er is not part
of the default installation of Excel; y ou m ust install it as described in section 1 of this chapter.
We are now ready to enter the target cell, changing cells and constraints for our m odel.
Next we will enter our range of changing cells (B5:B1 8).
Next we will enter our constraints in the Solv er window.
Next, let's ensure that we do not use m ore resources than we hav e av ailable.
Next, we need to ensure that the num ber of units produced of each product is an integer. After selecting
the range of cells that we desire to be integer, we sim ply select INT to ensure that Solv er will only
consider integer v alues of these changing cells.
Before telling Solv er to look for an optim al solution to our m odel, we need to look at two settings in the
Options Dialog Box: Assum e Non-negativ e and Assum e Linear Model.
If we feel that all changing cells in a problem m ust be non-negativ e, we should check the Assum e Nonnegativ e option. Clearly Le Napoleon cannot bake a negativ e am ount of any product, so this dialog box
m ust be checked.
In a Solv er m odel the target cell and changing cells are created by adding together term s of the following
form
(changing cell)*(const ant )
is a linear m odel. If the target cell and constraints of y our Solv er m odel are created by adding together
term s of this form , the Assum e Linear Model box should be checked. This enables the Solv er to use an
efficient m ethod (the sim plex algorithm ) to solv e y our problem . Solv er is guaranteed to find an optim al
solution to any linear m odel containing at m ost 2 00 changing cells and 2 00 constraints. Versions of
Solv er that can solv e larger problem s can be purchased from Solv er.com . Solv er has a m uch harder tim e
finding an optim al solution to a nonlinear m odel. For a discussion of nonlinear solv er m odels we refer the
reader to Practical Managem ent Science, 3 rd edition.
Our Solv er m odel is linear. For exam ple, the Target cell is calculated by adding together term s of the
form (units of product m ade)*(unit profit for a product). Thus the target cell is created by adding
together term s of the form specified by the bullet abov e. Therefore we check the Assum e Linear Model
option. By the way , if y ou try to solv e a linear Solv er m odel and do not check the Assum e Linear m odel
box, the Solv er m ay hav e a difficult tim e finding the optim al solution.
45/52

10/13/13

Spreadsheet Modeling

We are now ready to find the optim al solution to our Solv er m odel. After filling in the Options dialog box,
select OK. This will return y ou to the m ain Solv er dialog box.
Note that all 1 ,000 ounces of flour are used, but 1 2 m inutes of baker tim e and 3 6 ounces of sugar are
unused.
Le Napoleon has 3 bakeries and 5 retail outlets. Assum e the cost of baking a torte at a giv en bakery
and shipping the torte to a giv en retail outlet is as follows:
Each Bakery can bake up to 500 tortes per day . Each outlet needs 2 50 tortes deliv ered per day . What is
the cheapest way to get the needed tortes to the retail outlets? Hint: SUMPRODUCT can be used to
m ultiply com ponent by com ponent two rectangle cell ranges.
Suppose y ou work for an inv estm ent fund and m ust determ ine the asset allocation for a client
between bonds, US stocks, Em erging Market stocks, real estate, and com m odities that incurs the
least risk for a desired lev el of expected return. Describe the target cell, changing cells, and
constraints for an appropriate Solv er m odel. Is this m odel linear?
A drug com pany produces 4 drugs. The unit profit associated with a pound of each drug and the
resource usage for producing a pound of each drug are as follows:
2 ,000 hours of labor and 1 ,800 pounds of raw m aterial are av ailable. A fractional num ber of pounds can
be produced for any drug. Assum e dem and for each drug is unlim ited. How m any pounds of each drug
should be produced to m axim ize profit?
Solv er Exercise Solutions

Three-Dimensional Formulas, the Table Feature and Circular


References

It is often difficult to work with workbooks containing m ore than one worksheet. In this Unit we will discuss
Excel's 3 dim ensional (3 D) form ula capabilities. 3 D form ulas often m ake it easier to com bine data from
different worksheets.
Most users of Excel continually add new data (rows) to their spreadsheet or add new form ulas (colum ns) to
their spreadsheet; they are then frustrated when their form ulas, form atting and/or charts do not
autom atically update to include the changes in their worksheet. In this unit we show y ou how Excel's Table
feature can often ensure that y our form ulas, form atting, and/or charts will autom atically update to reflect
changes in y our spreadsheet.

Three-Dimensional Formulas

Please download the workbook 3 D.xlsx.


In this section we will begin by learning how to create three-dim ensional form ulas. Three-dim ensional
form ulas let y ou easily com bine data from m ultiple worksheets. For exam ple, we will show how to
com bine Le Napoleon's m onthly sales (listed in indiv idual worksheets) in a consolidated worksheet which
giv es total sales for each product.
The workbook 3 D.xlsx contains indiv idual worksheets for the units sold of each Le Napoleon product
during the m onths January through May . Note that in each worksheet the product nam es are listed in
cells I5:I1 8 with the sales for each product listed in cells J5:J1 8. Let's insert a new worksheet in which we
can total the sales of each product for the tim e fram e January through May .
Next we will enter the product nam es in cells I5:I1 8 of the consolidated worksheet.
Next we will use a three-dim ensional form ula to add up the fiv e m onthly sales v alues for each product.
Our form ula for chocolate clairs, for exam ple, will look like = SUM(Jan:May !J6 ). This will tell Excel to
add up cell J6 for all worksheets in the workbook between the Jan and May worksheets (inclusiv e).
In the file 3 D.xlsx determ ine the total sales of each product during the m onths February through April.
Three-Dim ensional Form ula Exercise Solutions

Using the Excel Table Feature


46/52

10/13/13

Spreadsheet Modeling

Please download the file Table.xlsx.


In this section we will discuss Excel 2 007 's Table feature. Most of the tim e when we start dev eloping a
spreadsheet, we enter data with each row representing data. For exam ple, we m ight enter sales of each
product in a different row. Then we usually add new data to the bottom of the spreadsheet and perhaps
add form ulas to the right of our data to analy ze the data. Usually we hav e to scram ble and m anually
change our form ulas or graphs to include the new data. We m ay also choose to extend the form atting
used for the original data to the new data.
Excel 2 007 's new Table feature m akes it a snap to add new rows of data or form ulas to a spreadsheet. The
Table feat ure ensures t hat , when we add new dat a or new formulas, our old formulas and
graphs will aut omat ically updat e t o include t he new dat a. Our old format t ing will also be
aut omat ically ext ended t o our new dat a.
At any tim e y ou can select a range of cells, and by hitting Control + T y ou will m ake that range of cells a
table.
To illustrate the use of the table feature, consider the worksheet data which giv es the rev enue from each
of Le Napoleon's products. Let's m ake this data a table and create a form ula that adds up total rev enue.
Now let's add a new row of data to the table and show that our total rev enue autom atically updates to
include the new data.
Now let's see what happens to a table when we add a form ula to the table. In colum n H of sheet new
form ula we will use the rank function to determ ine the ranking of each product's sales.
In worksheet Original graph we graph m onthly sales at Le Napoleon. With this setup, adding new data
will not cause the new data to be included in the graph. Then in worksheet Graph new Data we will show
how to graph the data so that new data will autom atically be included in the graph.
Note that if we add m ore data to the bottom of the spreadsheet, the new data will not show up on our
graph. Let's solv e that problem !
Associating a table with our data before we create the graph ensures that new data added to the bottom of
the spreadsheet will autom atically be included in the graph.
If y ou are going to use part of a spreadsheet as source data for a piv ot table, y ou should m ake the data a
table. Then when y ou refresh the data, the piv ot table calculations will reflect the new data.
In the file 3 D.xlsx determ ine the total sales of each product during the m onths February through
April.
Please download file Tablehw.xlsx. Worksheet Lookup of file Tablehw.xlsx contains sales of sev eral
products. Enter a form ula in cell H1 2 that will com pute sales for any product. The form ula should
work if new products are added to the product list.
Create a pie chart to sum m arize this sales data. The pie chart should update autom atically if new
product data is entered into the worksheet.
Worksheet NPV of file Tablehw.xlsx contains a set of cash flows and the dates of the cash flows.
Write a form ula that determ ines the NPV of these cash flows as of April 1 , 2 009 . Assum e an
annual discount rate of 1 0%. Your form ula should work if new cash flows are entered into the
spreadsheet.
Excel Table Feature Exercise Solutions

Circular References

A worksheet exhibits a circular reference(s) when the dependence of cells in a spreadsheet exhibits a
"looping" relationship. For exam ple, as shown below the v alue of cell E8 is needed to determ ine the v alue
of cell E9 , the v alue of cell E9 is needed to determ ine the v alue in cell E1 0 and the v alue in cell E1 0 is
needed to determ ine the v alue in cell E8.
Thus in this exam ple, the spreadsheet exhibits a form of circular logic in that the v alue in cell E8 refers
back to its own v alue. Circular references often result when y ou are building a m ultiple period
accounting Incom e Statem ent (called a pro form a) in which a com pany is allowed to borrow m oney . Then
the am ount borrowed is often com puted to m ake assets and liabilities equal. This creates a circular
reference because Debt affects cash, while cash affects total asset v alue, and total asset v alue affects debt.
47/52

10/13/13

Spreadsheet Modeling

It is easy to hav e Excel resolv e circular references. Sim ply select the Office Button and choose Form ulas.
Then sim ply check Enable Iterativ e Calculation and y our circular references will be autom atically
resolv ed! This setting will be sav ed when y ou sav e the workbook. Let's now look at a sim ple exam ple of
how circular references can be useful in solv ing business problem s.
Please download the file Circulartem p.xlsx. Le Napoleon has earned $2 ,000,000 in rev enues this y ear
and has incurred $1 ,2 00,000 in operating costs. Profits are taxed at 4 0%. Le Napoleon wants to share
their success with the com m unity by giv ing back 1 0% of their after tax profits to the Red Cross and Girl
Scouts. How m uch m oney should they giv e to charity ?
When we set up our spreadsheet we created the following relationships:
(Cell E8 v alue) = .1 *(Cell E1 0 v alue)
(Cell E9 v alue) = Rev enue - Costs - (Cell E8 v alue)
(Cell E1 0 Value) = .4 *(Cell E9 v alue).
When we check Enable iterativ e calculation, Excel keeps changing (the technical term is Gauss Seidel
Iteration!) the v alues in cells E8:E1 0 until all three equations shown abov e are satisfied.
Suppose baker John Paul Valjean earns $50,000 in taxable incom e. The state incom e tax rate is 8% and
the Federal incom e tax rate is 2 5%. The Federal tax rate applies to Taxable incom e less state incom e while
the state tax rate applies to taxable incom e less state tax paid. How m uch will our baker pay in state and
federal incom e taxes?
Circular Reference Exercise Solution

Monte Carlo Simulation

Monte Carlo sim ulation allows the user to "play out" or sim ulate an uncertain situation m any thousands
(or m illions) of tim es and see the range of outcom es than can be expected to occur. Knowledge of the range of
outcom es can be used to aid the decision-m aking process under uncertainty .
Prim itiv e Monte Carlo sim ulation can be done in the nativ e Excel env ironm ent, but m ost practitioners of
Monte Carlo sim ulation use Excel add-ins to perform Monte Carlo sim ulation. In our course we will giv e y ou
a brief introduction to a leading Monte Carlo sim ulation add-in: @RISK, which is published by Palisades
Corporation. Enrollm ent in this course giv es y ou access to @RISK for a 9 0-day period, so y ou can follow
along with our exam ples and attem pt the section exercises.
Although we will focus on @Risk in this chapter, it is not the only av ailable sim ulation add-in for Excel. A
worthy alternativ e is Cry stal Ball, dev eloped by Decisioneering (). Cry stal Ball has equiv alent
functionality to @Risk. Howev er, we hav e selected @Risk for usage in this Tutorial.

Uncertainty and Monte Carlo Simulation

The one thing that is certain in this world is that the future is uncertain. Businesses and organizations
often hav e to m ake decisions in the presence of uncertainty . For exam ple,
Each m orning Le Napoleon m ust decide how m any Napoleons to bake, knowing that the day 's
dem and is uncertain and that left-ov er Napoleons hav e little v alue.
Suppose y ou are selling y our house. You are hoping for $3 00,000, but y ou receiv e an offer of
$2 85,000. Should y ou accept the offer? You m ust m ake this decision in the presence of
uncertainty about future offers.
A drug com pany m ust determ ine the plant size that m ust be built long before the drug goes to
m arket. Of course, dem and for the drug is uncertain when the plant size decision is m ade. The
drug com pany does not ev en know whether the drug will com e to m arket at all!
We often try to juggle the asset allocation of our retirem ent portfolio between asset classes (say
stocks, bonds, gold, and com m odities). Of course the future returns on these asset classes are
uncertain, but we still need to m ake our asset allocation decisions.

Random Variables: The Key to Monte Carlo Simulation

You should recall that in our discussion of the Excel Solv er the key to building a m odel of a real life
48/52

10/13/13

Spreadsheet Modeling

situation was to identify the relev ant target cell, adjustable cells, and constraints. The key to building an
accurate Monte Carlo sim ulation m odel of a situation is to determ ine an appropriate random v ariable to
represent each source of uncertainty in the real life situation. Sim ply put, a random v ariable describes
an uncertain quantity by listing the v alues of the uncertain quantity along with a description of the
relativ e likelihood of all possible v alues. There are two ty pes of random v ariables: discrete and continuous
random v ariables.
For our purposes, a random v ariable is discrete if the random v ariable assum es an easily listed set of
v alues. Here are som e exam ples of discrete random v ariables. The probability of each v alue of a discrete
random v ariable m ust be non-negativ e, and the sum of the probabilities of all possible v alues m ust equal
1.
Total dots showing when we toss a die (1 , 2 , 3 , 4 , 5, 6 ). Each possible v alue occurs with an equal
probability of 1 /6 .
Perhaps the daily dem and for Napoleons can be m odeled as a discrete random v ariable with the
following v alues and probabilities.

The num ber of hits that Dav id Ortiz gets in a single gam e is a discrete random v ariable.
With @RISK we can use the RISKDISCRETE function to m odel a discrete random v ariable. For exam ple, if
our spreadsheet is set up as follows,
then entering the form ula = RISKDISCRETE(E8:E1 1 ,F8:F1 1 ) in a cell would generate v alues of a random
v ariable which assum es a v alue of 2 5 4 0% of the tim e, a v alue of 50 3 0% of the tim e, a v alue of 7 5 2 0% of
the tim e, and a v alue of 1 00 1 0% of the tim e.
A random v ariable is continuous if it can assum e all possible v alues on som e line interv al. For exam ple, a
com pany 's m arket share is a continuous random v ariable because m arket share can assum e any v alue
between 0 and 1 . Som e other exam ples of continuous random v ariables are
Annual sales growth
A random ly selected person's height
A random ly selected person's weight
Price of a product
Fixed cost of dev eloping a product
Price of a gallon of gasoline in a y ear
Value of Euro (in dollars) in a y ear
We often assum e (as an approxim ation) that a discrete random v ariable which can assum e m any v alues
can be m odeled as a continuous random v ariable. For exam ple, ev en though the num ber of Napoleons
dem anded daily is truly discrete, we m ight m odel the dem and for Napoleons as a continuous random
v ariable.
A continuous random v ariable has a zero probabilit y of assuming any part icular value. For
exam ple, there is a probability 0 that a random ly selected person is exactly 6 feet tall. To see this note
that to be exactly 6 feet tall a person's height would hav e to be
6 .00000000000000000000000000000000000000 (there should really be an infinite num ber of 0's
here!) feet tall, and the probability that a person's height exactly m atches this num ber is to all intents
and purposes zero.
So how can we m odel a continuous random v ariable? We m odel a continuous random v ariable by
defining a PROBABILITY DENSITY FUNCTION (pdf) for the random v ariable. A pdf is sim ply a nonnegativ e function whose v alue for a giv en num ber describes the relativ e likelihood of the random
v ariable assum ing a v alue near x. The area under a pdf between x and y is the probability that the
random v ariable assum es a v alue between x and y . The t ot al area under a pdf must equal 1. In our
dev elopm ent we will use two sim ple continuous random v ariables: the Uniform and Triangular random
49/52

10/13/13

Spreadsheet Modeling

v ariable.
A Uniform random v ariable (written U[a, b]) is sim ply a random v ariable that is equally likely to
assum e any v alue between a and b. For exam ple, if the daily dem and for Napoleons is equally likely to be
any where between 50 and 2 00 Napoleons, then our density for the dem and for Napoleons would look as
follows:
Note the density is uniform or constant ev ery where on the interv al [50, 2 00]. The height of the density
at each v alue between 50 and 2 00 is 1 /1 50 = 0.06 6 6 . This m akes the total area under the density
function equal to 1 . We see, for exam ple, the probability that dem and is between 80 and 1 7 0 is 6 0%. We
can m odel a U[a, b] random v ariable with the @risk function RISKUNIFORM(50,2 00). Entering this
function in a cell ensures that any v alue between 50 and 2 00 is equally likely to be entered in the cell.
In m ost situations, all v alues of a continuous random v ariable are not equally likely , and we m ust use a
random v ariable other than the Uniform random v ariable to m odel an uncertain quantity . Due to its
sim plicity , the triangular random v ariable is by far the m ost used random v ariable in Monte Carlo
m odeling. To illustrate the use of the triangular random v ariable, let's suppose we want to m odel the
m arket size for a new pastry . All we do is estim ate the lowest possible m arket size (say 4 0,000 units per
y ear), the m ost likely m arket size (say 6 0,000 units per y ear), and estim ate the largest possible m arket
size (say 7 0,000). Then we create a PDF for m arket size sim ply by constructing a triangle starting at the
lowest m arket size of 4 0,000. The height of the density increases along a straight line until we hit the
m ost likely v alue of 6 0,000 units. Now we m ake the triangle slope down until it hits the x-axis at 7 0,000
units. The m axim um height of the triangle is scaled so the total area under the PDF is 1 . See below
Note that our triangular PDF im plies, for exam ple, that there is an 87 .5% chance that m arket size is
between 4 5,000 and 6 5,000. Also a m arket size near 6 0,000 is twice as likely as a m arket size near
50,000 (because the density is twice as large at 6 0,000 as 4 0,000). We can m odel this random v ariable
using @RISK by entering the function RISKTRIANG(4 0000,6 0000,7 0000) in a cell. In such a cell, for
exam ple, a m arket size near 6 0,000 would be twice as likely as a m arket size near 4 0,000.
The triangular random v ariable has becom e popular because it generalizes the com m on practice of
analy zing a business case by creating a best case, worst case, and m ost likely scenario. The triangular
random v ariable sim ply allows for the possibility that any v alue between the best and worst case has a
chance of happening. Now let's show how to use Monte Carlo sim ulation and the @RISK add-in to help Le
Napoleon decide whether it should introduce a new product.
For each of these quantities, determ ine whether it should be m odeled by a discrete or continuous random
v ariable:
3 -Month Treasury bill rate in 6 m onths
Half-gallons of m ilk sold by a superm arket
Num ber of hearts in a bridge hand
Num ber of com petitors a com pany has in a giv en m arket
Unit cost of producing a product

Using @RISK to Simulate a New Product Introduction

Le Napoleon is try ing to decide whether or not to introduce a new pastry to com pete with sim ilar
offerings of other com panies. Three key quantities associated with this decision are highly uncertain:
Fixed cost of dev eloping the pastry . We will assum e that there is a 50% chance that the fixed cost is
$1 0,000; a 3 0% chance the fixed cost will be $3 0,000; and a 2 0% chance the fixed cost will be
$50,000.
The best case for annual m arket size of the new pastry is 7 0,000 units; the worst case is 4 0,000
units, and the m ost likely case is 6 0,000 units,
Le Napoleon's m arket share of the new pastry is equally likely to be any where between 2 0% and
50%.
We see that fixed cost can be m odeled as a discrete random v ariable (using the RISKDISCRETE function),
m arket size can be m odeled as a triangular random v ariable (using RISKTRIANG function), while m arket
share can be m odeled as a uniform random v ariable (using RISKUNIFORM function). We can express
profit and use @RISK to easily create a graph which giv es the range of possible profits that can occur. This
will help us determ ine whether to go ahead with the new pastry . We assum e price per pastry is $4 and
unit cost is $1 .50.
To begin, we open up @RISK by either clicking on the @RISK 5.0 icon on y our desktop or selecting START
50/52

10/13/13

Spreadsheet Modeling

PROGRAMS PALISADE DECISION TOOLS and selecting @RISK 5.0. You will see an @RISK m enu option on
the upper right hand portion of y our screen. Begin by clicking on the @RISK m enu. You will then see a
v ariety of icons. First we click on the Random /Static icon until it is red.
When this icon is red, hitting the F9 key results in random v ariables recalculating with the probabilities
im plied by the form ula. For exam ple, when this icon is red a RISKDISCRETE function will show each
possible v alue of the random v ariable, with the giv en probabilities.
We should also click on the Autom atically Show Graph icon so it is red. Then when we run our
sim ulation, a graph showing the range of possible outputs for any cell in the spreadsheet will
autom atically show on the screen.
Please download the file Sim newproduct.xlsx. Note we nam ed the cells D5:D1 3 with the nam es listed in
C5:C1 3 .
We will now m odel units sold, rev enue, v ariable cost, and profit at end of y ear (rev enue - v ariable cost fixed cost). We will round off the units sold so a fractional num ber of units cannot be sold.
Now we are alm ost ready to run our first Monte Carlo sim ulation! We begin by selecting all OUTPUT
CELLS for which we want @RISK to collect statistics. In our case this is sim ply the profit cell. Then we tell
@RISK how m any tim es we want to "play out" the sim ulation. This is called the num ber of Iterations. We
will sim ply choose 1 ,000 Iterations. If we place the cursor in our output cell and start the sim ulation,
then quickly @RISK will show us a graph showing the range of possible profits associated with the
introduction of the new product.
We are now ready to run our sim ulation.
We find that on av erage we m ake $2 5,56 0. If we m ov e the left-hand slider to 0, we can find the
probability of losing m oney to be only 1 3 %.
Our Monte Carlo sim ulation indicates that giv en our assum ptions about the uncertainty inv olv ed in the
dev elopm ent of the new pastry , there is an 87 % chance that after one y ear we will show a profit. Thus
the Monte Carlo sim ulation would strongly indicate that this new pastry is a go!
Suppose Le Napoleon plans to bake 2 00 Napoleons this m orning. Today 's dem and for Napoleons is
unknown but we believ e that the worst case is a dem and of 1 3 0 Napoleons; m ost likely dem and is
1 80 Napoleons, and best case is a dem and of 2 6 0 Napoleons. Suppose a Napoleon sells for $4 and
costs $2 .50 to produce. Finally assum e that Napoleons left ov er at the end of the day can be sold for
$0.50. On av erage how m uch profit will Le Napoleon expect to m ake today ? What is the
probability that Le Napoleon m akes m ore than $1 50?
Assum e that annual dem and for an Eli Lilly drug is equally likely to assum e any v alue between
6 0,000 and 9 0,000 units. Eli Lilly is planning to produce 80,000 units. It costs $3 to produce a
unit of the drug, and a unit of the drug sells for $1 0. Any leftov er drugs spoil and are worthless. A
cost of $1 0 per unit (due to custom er dissatisfaction) is assessed if we cannot m eet dem and. What is
the expected annual profit for this drug? What is the probability that Lilly will m ake m ore than
$3 00,000 this y ear from this drug?
Dev elopm ent of a drug requires three phases of research. Phase I is equally likely to take exactly 1
y ear or 2 y ears. Phase II has 50% chance of taking 2 y ears, a 3 0% chance of taking 4 y ears, and a
2 0% chance of taking 5 y ears. Phase III has an equal chance of taking 3 or 5 y ears. Assum e that
each phase is sure to succeed. On the av erage, how long will it take to com plete dev elopm ent of the
drug? What is the probability that will be com pleted 8 y ears from now?
Monte Carlo Exercise Solution 1
Monte Carlo Exercise Solution 2
Monte Carlo Exercise Solution 3

Final Exam Introduction

Welcom e to the final exam for the Spreadsheet Modeling tutorial. This test will allow y ou to assess y our
knowledge of som e basic m odeling skills.
To adv ance from one question to the next, select one of the answer choices and click the Subm it button.
After subm itting y our answer, y ou will not be able to change it or return to the question, so m ake sure y ou
are satisfied with y our selection before y ou subm it each answer.
51/52

10/13/13

Spreadsheet Modeling

Som e problem s ask y ou for a form ula. It is probably easiest to determ ine the correct form ula in Excel and
then paste it into the Final Exam answer area. This will av oid sy ntax errors. For exam ple, if in Excel y ou
ty pe in the form ula = SUMIF(B1 :B1 0,C8,D1 :D1 0) and think that is the correct answer, just select
SUMIF(B1 :B1 0,C8,D1 :D1 0) in Excel and copy it. Then paste it into the input answer area within the
question.
Your results will be display ed im m ediately upon com pletion of the test. The results screen will display each
question with a graphic notation indicating y our score: X for incorrect and check m ark for correct.
Click Final Exam in the m enu bar to the left to begin. You can also return to y our test results at any tim e
(after com pleting the exam ) by clicking Final Exam Introduction and then Final Exam .
Good Luck!

Credits
Courseware # 3 2 52

Authors:
Way ne Winst on, Professor of Operations & Decision Technologies at Indiana Univ ersity and Eli Lilly & Co
Faculty Fellow, dev eloped this tutorial to prov ide the user with a com prehensiv e understanding of
Spreadsheet Modeling. For ov er 1 0 y ears the author has taught Excel m odeling to thousands of analy sts at
organizations such as Microsoft, Eli Lilly , Cisco, EBay , US Arm y , GM, Ford, Pfizer, and Verizon. Way ne also
consults for the Dallas Mav ericks NBA team . He has won ov er 2 5 teaching awards.
Much of the tutorial content was also authored by Sarah Sherry , a senior lecturer in the Operation &
Decision Technologies departm ent at Indiana Univ ersity .

T he Production T eam:
Project Management : Andrea Sneiderm an
Mult imedia Product ion & Design: Jackie Watson and Kris Aring
Voice-Over Narrat ion: Walter Dixon
All Microsoft product screen shot(s) reprinted with perm ission from Microsoft Corporation.
Copy right Harv ard Business School Publishing. Copy ing or posting is an infringem ent of copy right.
Perm issions@hbsp.harv ard.edu or 6 1 7 -7 83 -7 86 0.

52/52

You might also like