Spreadsheet Modeling
Spreadsheet Modeling
This document is authorized for use only by MISHA BANSAL. Copy or posting is an infringement of copyright.
Spreadsheet Modeling
Pretest Introduction
Welcome to the pre-assessment test for the Spreadsheet Modeling tutorial. This test will allow you to assess your knowledge of some basic modeling skills.
To advance from one question to the next, select one of the answer choices and click the Submit button. After submitting your answer, you will not be able to change it or return to the question, so make
sure you are satisfied with your selection before you submit each answer.
Some problems ask you for a formula. It is probably easiest to determine the correct formula in Excel and then paste it into the Pretest answer area. This will avoid syntax errors. For example, if in Excel
you type in the formula =SUMIF(B1:B10,C8,D1:D10) and think that is the correct answer, just select SUMIF(B1:B10,C8,D1:D10) in Excel and copy it. Then paste it into the input answer area within the
question. Do NOT include any unnecessary spaces in your answers.
Your results will be displayed immediately upon completion of the test. The results screen will display each question with a graphic notation indicating your score: X for incorrect and check mark for
correct.
Click Pretest in the menu bar to the left to begin. You can also return to your test results at any time (after completing the exam) by clicking Pretest Introduction and then Pretest.
Good luck!
Introduction
Most work done by business analysts can be categorized as either reporting (providing required data) or analysis (building models to help your organization make the right decisions). In today's world,
most business reporting and modeling is done using Microsoft Excel. Completing this online course should increase your ability to use Excel to create reports and/or develop powerful business models.
Even if you have never used Excel before, we will teach you how to use Excel's powerful functions and chart capabilities to solve a myriad of business problems.
If you are a student, then during your undergraduate or MBA program you will have to build many models to analyze cases or build spreadsheet models in courses such as finance, marketing,
accounting, operations and management science. We will give you the spreadsheet knowledge needed to tackle the many analytical questions that arise during your course work.
If you are a business analyst, this course will introduce you to many new concepts and tools that will help you more quickly and accurately summarize business data. The course will also teach you how
to develop spreadsheet models that will help your organization make 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 family moved to Strasbourg from Mali
when he was a small child, and Anne-Sophie Le Nguyen, who grew up in the Cognac region.
The two met each other not long after moving to the U.S. and found that not only did they have a shared dream of business ownership but that each had strengths to offset the other's weaknesses.
Both have exceedingly refined tastes, but their success lies more in Michel's way with obscure ingredients and techniques and Anne-Sophie's ambition and exceptional understanding of the customer.
Le Napoleon got its start in a business incubator, and at first, the bakery had just a small stand at the weekly farmer's market. Soon, though, satisfied customers 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 move out of the business incubator and into their own, dedicated location.
The business is now thriving.
In this course, we will use operations at Le Napoleon to illustrate some of the problems that businesses both large and small must face—and Excel to illustrate solutions to those problems.
In the first three sections of this course, we begin by familiarizing you with the Excel environment and showing you how to move around in a spreadsheet. If you have used Excel extensively you may
choose to skip these chapters. In the Excel Formulas and Functions sections, we thoroughly explain how to enter and copy formulas in Excel. We also will teach you about Excel's many 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
solves a business problem is often mastery of Excel's many powerful functions.
In the section on Excel Functions, we cover Excel's many tools that can be used to create great looking and informative reports (conditional formatting, pivot tables, subtotals, SUMIFS and
COUNTIFS functions, etc.). In the Charts section, we show you how to use Excel to create informative charts. In the next section, you will learn how to import word files and Internet data into the
Excel environment.
The Art of Spreadsheet Modeling section contains an extensive explanation of how to build spreadsheet models to solve a business problem. For example, should a bakery open a new outlet? How
should we plan to save for retirement? In this section, we cover many exciting modeling tools such as Auditing, spinner controls, Goal Seek, Data Validation and Data Tables. The Using Excel Solver
section covers the Excel Solver tool which is used to find the optimal solution to a problem. The Three-Dimensional Formulas section explains how 3D formulas and Excel's Table feature can make
you much more efficient when you develop spreadsheet models. Finally, the Monte Carlo Simulation closes the course by introducing you to a really efficient model building tool. In that section, you
will learn how Monte Carlo simulation can be used to model the effect of uncertainty on business decisions.
The spreadsheet is the canvas for the business analyst. This course gives you the "artistic skills" needed to develop state of the art spreadsheet models for solving business problems.
Even simple workbook tasks will become tedious and prone to errors if you do not know how to use Excel efficiently. In this chapter, we will introduce the following aspects of the Excel environment
and basic efficiency measures.
Opening workbooks
Working with worksheets
Workbook- and worksheet-level navigation
Printing worksheets and workbooks
Saving workbooks as Excel and other file types
Throughout this course, we will continue to present ways to increase not only your proficiency in but also your efficiency with Excel.
Opening a Workbook
If Excel is running and the icon representing your file is the generic Windows icon (example below), but you know that Excel can read it, it might be easiest to drag the icon into the Excel
window. You can use this method for any file type that Excel can open.
• Open the Excel Environment.xlsx file by any of the above methods. This file contains data from questionnaires completed by customers of Le Napoleon. Leave this file open, as we will continue
to work with it.
• Open the Excel Environment_non_Excel.asp file by dragging its icon into the already running Excel window. Note: If your installation of Excel is not able to read this file, don't worry—we will not
be using this file for anything else.
• Close the Excel Environment_non_Excel.asp file by clicking the X for the workbook. This is the button that reads "Close Window" when the pointer hovers over it.
The Ribbon in each of the Office programs organizes commonly used commands and features into categories. Each category is represented by a tab, and each tab contains groups of subcategories.
For example, in Excel, the Review tab contains three groups—Proofing, Comments, and Changes. Each contains features commonly needed when reviewing others' workbooks, or before sending your
own workbooks out for review or use by others.
The Quick Access Toolbar is a customizable docking place for features and commands that you use most frequently. It is found at the top of the program window and by default displays buttons for
Save, Undo, and Redo. No matter which of the Ribbon's tabs is selected, the Quick Access Toolbar is always visible.
Explore the customization options for the Quick Access Toolbar. In doing so, look at not only Popular Commands but also All Commands. Once you configure the Quick Access Toolbar to suit your
needs, you are only a click away from the features that you use the most.
Worksheets
Each workbook file contains one or more tabbed worksheets. You can easily set the number of worksheets that you want new workbooks to contain, rename sheets, and move and delete worksheets.
On the summary worksheet, increase the height of row 2. Select columns 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 column widths.
RENAMING WORKSHEETS
Note that spaces, dashes, and certain other special characters are legal in sheet names, while other characters, such as \ / ? are not. Also, although we have opted to use spaces in the sheet names in
our example file, know that this can complicate more advanced uses of the program.
In the Excel Environment.xlsx file, rename the bakery1 worksheet to bakery mon-thurs, bakery2 to bakery fri-sun; mall1 to mall mon-thurs and mall2 to mall fri-sun.
MOVING WORKSHEETS
Move sheets to be in this order: bakery mon-thurs, bakery fri-sun, mall mon-thurs, mall fri-sun.
Rename Sheet1 to key. Move this sheet to the beginning of the workbook.
INSERTING WORKSHEETS
Insert a new sheet and call it summary. Move it to the beginning of the workbook, before the key worksheet. We will leave this sheet blank for now.
SCROLLBARS
HOTKEYS
Learning a few hotkeys, however, will allow you to keep your hands on the keyboard, which many people find improves efficiency. Some navigation hotkeys are
Pressing the Alt key once will allow you to quickly select a ribbon using its letter key, and then select items 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 Formulas ribbon, and items on that ribbon would then be identified by their keys.
EXERCISES
In the Excel Environment.xlsx file, starting with the bakery mon-thurs worksheet —
Use Ctrl-Home to move to cell A1 and Ctrl-End to move to the last cell in the data range (observe that this may be a blank cell).
Use Ctrl-Home again to return to cell A1.
Use Page Down to scan through the data one screen at a time.
Use Alt-Page Down and Alt-Page Up to scroll left and right.
Finally, use Ctrl-Page Down to move to the next worksheet.
Continue to practice these navigation hotkeys in the Excel Environment.xlsx file. You might find it useful to keep a list of these hotkeys near your computer until using them becomes second nature.
Printing a Worksheet
Select a range of cells from the key worksheet and view the Print Preview. Note that before printing this worksheet, we will probably want to make some adjustments. Don't click Print; simply click
Esc to return to the worksheet.
To save a workbook, hit Ctrl-S, or click the Save icon on the Quick Access Toolbar.
Our main goal in this chapter is to introduce efficient methods 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
Each rectangular block in which data can be entered is a cell. Each cell has an address. In most configurations of the program, this is the letter of the column and the number of the row that intersect
at that cell.
Worksheets in Excel 2007 and later have 1,048,576 rows and 16,384 columns — or over 17 million cells. By comparison, Excel 2003 spreadsheets have 65,536 rows and 256 columns.
RANGES
A block of cells that is to be treated as a unit in some operation (e.g., formatting, summation) is called a range. Ranges are known by the addresses of their upper-left-most cell and lower-right-most
cell. A colon serves to separate the two addresses. In the screenshot below, the range B2:C4 is selected.
Selecting Ranges
There are a number of ways 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 keys. We will also discuss a
means of easily selecting ranges within a large dataset.
Selection Pointer
On the bakery mon-thurs worksheet, select the range F2:F11. 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 values are included in averages and other statistics, whereas blank cells or cells containing text are not.
Change your status bar settings so that the five statistics mentioned above — average, count, min, max, and sum — are displayed in the status bar when data is selected.
Holding down the Ctrl key tells Excel that you want to jump to the end of the range. Holding down the Shift key tells Excel to select all of the intermediate 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 Q2, the last cell in the
contiguous range A2:Q2.
Select cell A2 again. This time, 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 more times. You should see that Excel
advances one cell at a time, adding cells to the selection.
Select cell A2 a final time. Hold down both Ctrl and Shift, and hit the right arrow key. Excel both "moves" all the way to Q2 (Ctrl key behavior) and retains the selection of the intermediate
cells (Shift key behavior).
In cases where there are blanks in the data, it is helpful to work with a split screen, as shown in the next topic.
EXERCISES
Check to see that your installation of Excel is configured to show in the status bar at least the minimum, maximum, and average 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 compare basic statistics for the results of question (10) in column
K, Satisfaction with variety of goods, on a scale of 1 to 5.
There are, of course, functions and other ways of obtaining such statistics. But since selecting cells is extremely fast, it can serve as a good quick auditing tool, to double-check the results of
functions.
Alternatively, if the screen is split, click the Split button on the View tab to un-split it.
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.
Sometimes we want to select noncontiguous ranges, for example, to format a number of isolated cells at once, or to include them in a function. In this section, we will explore two ways to select such
ranges.
The function key F8 and Shift-F8 can also be used to select ranges, including noncontiguous ranges. When you hit F8 the first time, Excel enters "Extend Selection" mode and behaves as if you had
the Shift key held down.
Once you have the selection that you want, hit F8 a second time to exit Extend Selection mode. Your selection will remain active — unless you select another cell. If you want to select a second
range, use the trick described next, Shift-F8.
Use F8 to select a range (remembering to hit F8 to exit Extend Selection mode when you are ready).
Use Shift+F8 to select a second range (which can also then be done with the F8/Extend Selection technique).
In this section, we will explore two ways of quickly selecting cells. These allow us to select a cell based on its address (e.g., C24) or a cell or range of cells based on an assigned name (e.g., revenue;
survey_data).
In Name Box
The Name Box, found just above the header for column A, shows the name of the currently selected cell or range (more on named ranges in a later chapter). In the screenshot below, the Name Box
reads A1.
By typing a cell address or range name in the Name Box and hitting Enter, you can select (and jump to) cells or named ranges.
On the bakery mon-thurs worksheet, type L97, and hit Enter. Excel should take you to that cell. Now return to the Name Box and click its drop-down arrow. You should see questions as an option;
this is because we have assigned the name questions to a range. Choose questions from the drop-down list to jump to this range.
On the bakery mon-thurs worksheet, use the F5 key to go to cell G99. Then use it to go to the range named questions.
Note that the Go To dialog box keeps a running list of cells visited in the current Excel session.
The Go To dialog box can also be used to select cells that would otherwise be fairly difficult to comprehensively identify and select. Clicking the Special button at the bottom-left corner of the Go To
dialog box brings up a list of types of cells that users commonly need to select, such as blank cells, cells containing errors, cells containing comments, and many others.
Assume management at Le Napoleon wanted to add shading to the blank cells in the bakery mon-thurs dataset, to see more easily whether just a few or many items on their questionnaire are being
left blank. (Incidentally, there is a function to return the number of blank cells in a range: the COUNTBLANK function.) It would be very time-consuming to select each blank cell by hand. This would
also be prone to error — some blank cells would likely be left out, and some cells containing values would likely be selected by mistake. The Special options in the Go To dialog box can take most 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 you will lose the selection! Now choose a fill color from the palette on the Home tab (in the Font group, under the selector for font size), and all blank cells will be
shaded. (Conditional formatting, to be introduced in a future chapter, would be another way of shading these blank cells.)
Filling Series
For commonly used series and entries that Excel can populate to be part of a series (e.g., Bakery Item 1, Bakery Item 2), you can use the Autofill handle to fill in as much of the series as you need. The
Autofill handle appears at the bottom right of a selected cell or range of cells; it appears to be a small square superimposed on that corner of the black border around the selected cell.
When the pointer hovers over the Autofill handle, it changes shape to resemble a cross.
This same technique, specifying the first two elements of the series before autofilling, could be used if you wanted to create a series like {1, 2, 3 . . .} or {5, 10, 15 . . .}.
EXERCISES
On the bakery mon-thurs worksheet, edit Question_1 to read Question 1. Fill to complete the series through Question 16.
Do the same for the mall mon-thurs worksheet (again using numbers from 1 to 100), but this time, double-click rather than dragging the autofill handle. Because there is a block of
contiguous data in the adjacent column, Excel fills the series to the end of that block.
For the mall fri-sun worksheet, use Fill Series to create numbers from 1 to 100.
Download the file Working with Data_products.xlsx. Using the data on Sheet1, create a custom fill series. Test your series to see that it works. Then, if you wish, feel free to delete the series
(via Excel Options).
To copy and paste data, select the range to be copied and use Ctrl-C, the Copy button on the Home tab, or the right-click context menu to copy the data.
Then select the upper-right-most cell in your desired destination range, and use Ctrl-V, the Paste button on the Home tab, or the right-click context menu to paste the data.
MOVE OPERATIONS
To move data, you can Cut rather than Copy, and then Paste.
Or, if you need to undo multiple operations, the drop-down list next to the Undo button:
Excel 2007 and later versions allow undo operations even after a save, but not once the file has been closed.
Be aware that the undo stack is shared by all open workbooks; i.e., you cannot undo only a change to Book1 if after that change you made a change to Book2. You could, however, undo the change to
Book2 and then the change to Book1.
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 important. Among other considerations, you
might want to minimize the amount of time it takes others to understand how you have organized a workbook, or limit the ways in which they can introduce errors into a workbook. You might want to
control the kind of data that can be entered in cells, prevent users from deleting formulas, or even keep the workbook window from being resized.
In this chapter, we will look at a few simple things you can do to make your worksheets more user-friendly in terms of simple 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.
The summary worksheet needs a better indication that the figures on that sheet are averages of the questionnaire data for which an average is a meaningful measure. We will want to insert some rows
to hold that information and set it off from the table of averages.
On the summary worksheet, insert one row above row 1. Enter the text "Average for questions (5)-(11)" in cell A1.
On the summary worksheet, increase the height of row 2. Select columns 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 column widths.
HIDE ROWS/COLUMNS
Assume an employee at Le Napoleon is analyzing the questionnaire data on the bakery mon-thurs worksheet and wants to get an opinion from someone outside the company. Clearly Le Napoleon
would want to keep customers' names and addresses private. Assuming that the interaction is to take place in person (i.e., the employee is not sending the workbook file outside the company), one quick
solution would be to temporarily hide those columns.
We would like to note that while hiding columns (or formatting cells with, e.g., white font on white fill, for that matter) can keep data out of view, it is not a way of formally protecting sensitive data.
WRAPPING TEXT
Column 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 columns A:H; they became far wider than
necessary to display the data. If management wants to be able to view not only the averages on the summary sheet but also the clarifying text, the cells containing that text will need to be formatted to
make better use of screen space. We will use text wrapping and other formatting techniques to accomplish this.
ROTATING TEXT
Text can also be rotated for a better fit or appearance. We will rotate the headers for the questions on the summary worksheet.
The font face, font size, font color, and fill color can be set in a number of ways. One is through the buttons in the Font group on the Home tab, in the Format Cells dialog box, another is via the menu.
We will change several formats in order to make the summary worksheet easier to read.
Note that borders (but not patterns) can also be applied using the buttons on the Home tab, or the menu that appears when you right-click a selection.
We will continue to improve the look and readability of the summary worksheet by making use of some of the many different ways of displaying numeric values in Excel. Specifically, we want to
display the results of question (5), "To the nearest dollar, how much was your order?" as dollar values, and to display the remaining numeric values on the worksheet with fewer decimal places than are
currently displayed.
Also use the Decrease Decimal button to decrease the number of decimals displayed for the averages for questions (6)-(11) to two. Do not format these as currency, however.
Note that Excel does not actually perform currency conversion when you change a value from being displayed as U.S. dollars to being displayed as Euros. If you wanted to perform currency conversions
on a worksheet, use the pre-programmed Currency Rates data connection file to insert current exchange rates into your workbook and update them at specified intervals. You can access this feature
from the Data tab, via the Existing Connections button in the Get External Data group.
Keep in mind that formats are cosmetic changes only (i.e., the dashes in the social security format shown above are characters added by Excel when the number is "printed" to
Rollover
do not reside formats
in the cell itself). below
for more information:
123456789
as Social Security Number
as ZIP+4
as Scientific
0.123456789
as Percentage
as Fraction
DATE FORMATS
Rather than using a cyclical calendar,
Excel stores dates as values on a number
line. While we might see the date June 7,
1999, as having something in common with June 7, 2008, Excel knows the first of these as the value 36318 and the second as 39606.
To the right are some dates and their equivalent numeric values in Excel. We can see from the first five examples that 1/1/1900 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 21343!
What this means is that values meant to be numeric in nature can be displayed as dates, and values meant to be dates can be displayed as numbers. Expecting to see a cell display, for example, the
number 13 as the output of some operation, and instead seeing 1/13/1900, can cause a good deal of confusion to the beginning Excel user. By the same token, Excel will also be happy to format Prince's
birthday, 6/7/1958, as Currency, displaying $21,343.00 as a result.
There are many ways to display dates in Excel; on the right are some examples using the pre-programmed options in the Date category. Despite the differing levels of specificity displayed by the formats
used, the cells shown here contain identical values.
As efficiently as you can, select the dates in column B of the bakery mon-thurs worksheet. Format these as number with two decimal places, then currency, then percent. Note that the underlying value
in each cell does not change as you move from format to format. Then apply the date format of your choice.
Within the formatting options for dates, the Locale setting allows us to display dates in a number of pre-programmed international formats. The screenshot below shows a subset of these.
When recording special orders, at least, the staff at Le Napoleon might want to change the locale to French (France). This would allow the staff to enter dates in mm/dd/yyyy format but have them
display on the worksheet in dd/mm/yyyy format.
Note: If we wanted to affect the way dates are entered, not just displayed, we would need to configure the Regional Settings in Windows.
Many other possibilities exist for custom formatting; this is a good option to keep in the back of your mind!
Conditional Formatting
There are many instances in which we might want only certain cells to display a special format. Le Napoleon, for example, might want to highlight averages on the summary worksheet that
management considers subpar. While we could identify and format those averages manually, conditional formatting is easier. It is also more powerful—since it is dynamic, we will not have to redo the
format if we obtain new data that drives some averages up and out of the range that we wanted highlighted.
On the summary worksheet, we will format the averages for questions (6)-(11) if the value in the cell is below 3.
Now we can easily see that parking might be a good problem to address at the bakery location, whereas at the mall location (where Le Napoleon sells goods sent over from the bakery), the variety of
baked goods appears to be an issue.
We'll explore a few more examples of conditional formatting in the Increasing Spreadsheet Readability_orders.xlsx workbook. This workbook contains brief details for a number of special orders that
the clerks at Le Napoleon have taken; we could use this to gauge the general size of an order, whether it might involve ingredients or components not usually part of the pastry kitchen, and when it
needs to be delivered or available for pick-up. We can assume that adequate details for the creation of each order are stored where the chefs can access them as needed.
As usual, select all of the cells that the formatting should apply to (cells B2:B35 on the orders worksheet in the Increasing Spreadsheet Readability_orders workbook). Then, from the Conditional
Formatting menu, select Highlight Cells Rules, then A Date Occurring...
In the menu 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.
To format all of the order totals that are above average, first select cells E2:E35. From the Conditional Formatting menu, select Top/Bottom Rules, and then Above Average (note the other options in
this list before doing so!).
In the menu box that appears, choose a predefined style, or define your own custom style. We have chosen Green Fill with Dark Green Text:
The preprogrammed color scales in the conditional formatting option provide an easy solution. Select cells C2:C35. Then, from the Conditional Formatting menu, choose Color Scales, and select a color
scale. (The Blue - Yellow - Red and the Red - Yellow options both provide reasonably intuitive formatting for the problem at hand.)
To the right is what the data should look like if you chose the Blue — Yellow — Red option.
A color scale like the one that we applied in the previous example would provide one quick solution, but it would compete visually with the shading already present on above-average values in this range.
An icon set is a better way of keeping the existing shading and marking a new distinction.
Select cells E2:E35 and, from the Conditional Formatting menu, choose Icon Sets. The Red to Black style fits nicely with what we are trying to accomplish here—distinguish these data values in another
way without making the result too visually confusing.
The order total data should now look like what you see on the right here.
These settings are configured in the New Formatting Rule or Edit Formatting Rule dialog boxes, which you can access as you are first applying a format, or after the fact, via the Conditional Formatting
menu.
If you are setting up a new rule that you want to configure more closely, choose the More Rules option (after selecting the general rule type; e.g., Icon Sets).
In the dialog box that appears, select the rule to be customized and click Edit Rule. This will open the Edit Formatting Rule dialog box, where you can make adjustments to the behavior of the rule.
Conditional formatting provides for much more powerful options than those that we have just seen. We'll revisit the topic of conditional formatting in a later chapter.
Sometimes we format a cell or range of cells with the font colors, borders, patterns, and number formats we want, only to find that there are other cells that need to be formatted in a similar manner.
The Format Painter, found on the Home tab, will allow us to copy all of the formats from a cell and then paint other cells with these formats. What if we want to transfer just some formats from one cell
to another, however?
Excel has special options that you can choose from when completing a copy-paste operation. The Paste Special dialog box (accessible via the Paste drop-down list on the Home tab) is shown below.
Now that the summary worksheet contains the formatting we want, we can set it up to display the way we want on the printed page.
On the Page Layout tab, Page Setup contains options for selecting the paper size, orienting data, changing margins, and so on.
Instead, let's have Excel print only those cells we want by marking a range on the worksheet for printing.
Excel Formulas
People use spreadsheets to compute quantities of interest. In any cell of a spreadsheet we are free to enter a formula to compute a quantity of interest. For example, the management of Le Napoleon
might want to compute the following quantities:
In this unit, we will use Excel formulas to efficiently and easily compute these quantities of interest. We will see that in order to efficiently use formulas, we must have an understanding of the spreadsheet
Copy command. Our work in this unit will use the file Excel Formulas.xlsx, so please download this workbook now.
Copying Formulas
In worksheet Wages of the file Excel Formulas.xlsx, we compute the weekly wage for our 8 employees (their names are in cells B4:B11). For each employee we are given (in cells C4:C11) the hours each
employee worked this week, and in cells D4:D11 we are given each employee's hourly wage.
Now we could compute Will Wong's salary in E5 with the formula =C5*D5 and continue onward and enter a formula to compute each employee's salary. Of course, if we have hundreds or thousands of
employees, this would be really tedious. Fortunately, Excel's ability to let us "copy" formulas eliminates this problem. What we really want to do in each of cells E4:E11 is to multiply the two numbers to
the left of column E in the same row.
To accomplish this goal we simply "copy" our formula in E4 to the cell range E5:E11. Then in cells E5:E11 our copied formula will try to do in cells E5:E11 exactly what it did in cell E4 (multiply the
numbers in the same row in columns C and D). Basically, when you copy a formula that has no $ signs attached to cell addresses (more on $ signs later, but do not worry about them now!), then if you
copy a formula down a row the row numbering the formula is increased by 1, and if you copy a formula across and to the right one row the column number is increased by 1.
Try to use the Autocomplete feature to compute the average amount paid this week to our employees. Hint: AVERAGE is the Excel function for computing an average.
If we type in a complex formula, then we can easily type in the incorrect cell reference. Most users of Excel prefer to enter formulas by "pointing" to the cells referenced in the formula.
Use pointing to reenter the formula used to compute our total weekly payroll.
In the cell range J9:L14, we want to compute the cost of ordering each commodity from each supplier.
Absolute Addressing
Let's suppose that our Praline torte, Sacher torte, and Opera torte must each have the same diameter and height (which we enter in cells D10 and D11). Also assume that the cost per cubic inch for the
Praline torte is $0.10, for the Sacher torte $0.11, and for the Opera torte $0.12. Let's create a spreadsheet (see sheet Cakecost of file Excel_Formulas.xlsx) that computes the cost of producing each type
of cake. The volume of a cake with radius r and height h is Πr2h. Here r = cake radius in inches and h = cake height in inches. Recall that radius = diameter/2.
We want to enter a formula in E15 to compute the cost of producing the Sacher torte. Then we hope to copy this formula down to the range E16:E17 and thereby compute the cost of producing the other
cakes. Clearly our cost formula in cell E15 will need to depend on the diameter and height which are given in cells D10 and D11. The problem is that if we reference D10 and D11 in our formula in cell E15
and copy the formula down, then D10 will change in cell E16 to D11 and D11 will change in cell E16 to a D12 reference. We do not want this to happen! The solution is to enter cell D10 in our formula as
$D$10 and enter cell D11 in our formula as $D$11. A $ sign before the row of a cell reference ensures that when we copy the formula the row reference remains unchanged. Similarly, a $ sign before the
number in a cell reference ensures that when we copy the formula, the column reference remains unchanged.
Suppose we had not put $ signs on the D10 and D11 cell references in E15. Then when we copied the formula to cell E16, cell E16 would contain the following formula: =PI()*(D11/2)^2*D12*D16.
The astute student is probably wondering why we used paranthesis in our cell E15 formula, instead of typing the formula as:
=PI()*($D$10/2)^2*$D$11*D15
Operation(s) contained in parentheses are carried out first followed by operations involving exponents. Then division or multiplication
operations are given equal precedence. Operations involving multiplication and division are given equal precedence and are then
carried out from left to right. Finally, operations involving addition and subtraction are given equal precedence and are then carried out
from left to right.
Without the parentheses, Excel would square 2 (obtaining 4) and then compute $D$10/4 which equals 2. We want, of course, the part
of our formula involving D10/2 to yield 16 and not 2. Inserting ( ) around $D$10/2 ensures that we first divide the contents of cell D10
by 2 and then square the result (this yields (8/2)2 = 16, as desired).
Summation Icon
SUMMING A RANGE OF CELLS WITH THE SUMMATION ICON
Now let's efficiently compute our total bill for each commodity and the total amount we need to pay each supplier. To determine the total amount we owe each supplier we could simply copy from H23 to
H24:H27 the formula =SUM(E23:G23). Then we could compute the total bill for each commodity by copying the formula =SUM(E23:E28) from cell E29 to the range F29:G29. There is nothing wrong
with this method but here's an easier way.
Do It Yourself Exercise
Suppose our annual demand for Sacher Torte equals 7000 minus 200 times (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 varies as the cost of producing a Sacher Torte varies from $17.00 to $24.00 and the price of a Sacher Torte varies between $25 and $35.
If you like to cook, you know how judicious use of key ingredients is a key factor in making that perfect meal. Similarly in Excel, mastery of Excel's many powerful functions will help you create that
"spreadsheet masterpiece."
IF Statements
INTRODUCTION
Let's suppose Le Napoleon is considering three proposals for giving price discounts according to the following guidelines:
Proposal 1: When quantity of a product bought by a customer exceeds a given threshold, all units of that product are discounted. For example, if less than 100 Napoleons are bought by a
customer, that customer pays $3.50 per Napoleon. If at least 100 Napoleons are bought, the customer pays $3.15 per Napoleon.
Proposal 2: Instead of one price break point, there are two price break points. For example, if a customer buys fewer than 100 Napoleons, that customer pays $3.50 per Napoleon. If between
100 and 129 Napoleons are bought, we give the customer a 10% discount on each unit purchased. If at least 130 Napoleons are bought, we give a 15% discount on each unit.
Proposal 3: When quantity of a product bought by a customer exceeds a given threshold, all units of that product are discounted. For example, if less than 100 Napoleons are bought by a
customer, that customer pays $3.50 per Napoleon. If at least 100 Napoleons are bought, the customer pays $3.15 per Napoleon. If a customer is a friend of an employee and that customer's
purchase quantity exceeds the same threshold, the customer receives an extra 50% discount on each unit purchased.
You have been asked to set up a spreadsheet that computes (given the quantity purchased of each product) a customer's total cost of purchasing each product.
To accomplish this goal, we will use IF formulas. IF formulas let you conduct conditional tests on values and formulas. An IF formula begins with a condition such as A1>10. If the condition is true, the
formula returns the first value listed in the formula; otherwise we move on within the formula and repeat the process. We now illustrate how IF formulas work by showing how to write formulas
implementing pricing proposals 1-3.
IMPLEMENTING PROPOSAL 1
We now show how to compute the price paid by a customer for each product and the total amount paid if the pricing structure is as follows. When quantity of a product bought by a customer exceeds a
given threshold, all units of that product are discounted. For example, if less than 100 Napoleons are bought by a customer, that customer pays $3.50 per Napoleon. If at least 100 Napoleons are bought,
the customer pays $3.15 per Napoleon. Please download file IF.xlsx.
We see, for example, that if a customer buys 99 or fewer Napoleons, each one costs $3.50 while if at least 100 Napoleons are bought, the customer receives a 10% discount. Let's now write formulas that
compute for each customer the unit price that customer pays for each product and the total amount paid for each product.
IMPLEMENTING PROPOSAL 2
We now show how to compute the price paid for each product and the total amount paid if instead of one price break point, there are two price break points. For example, if a customer buys fewer than
100 Napoleons, that customer pays $3.50 per Napoleon. If between 100 and 129 Napoleons are bought we give the customer a 10% discount on each unit purchased. If at least 130 Napoleons are
bought, we give a 15% discount on each unit.
We see, for example, that if a customer buys 99 or fewer Napoleons, each one costs $3.50, while if the customer buys between 100 and 129 Napoleons, the customer receives a 10% discount on each unit
purchased. If at least 130 Napoleons are bought, the customer receives a 15% discount on each unit purchased. Let's now write formulas that compute for each customer the unit price that customer
pays for each product and the total amount paid for each product.
IMPLEMENTING PROPOSAL 3
We now show how to compute 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 customer exceeds a
given threshold, all units of that product are discounted. For example, if less than 100 Napoleons are bought by a customer, that customer pays $3.50 per Napoleon. If at least 100 Napoleons are bought,
the customer pays $3.15 per Napoleon. If a customer is a friend of an employee and that customer's purchase quantity exceeds the same threshold, the customer receives an extra 50% discount on each
unit purchased. An x in Column E indicates the person is a friend. Recall that in an IF statement we first check the left-hand-most condition. Therefore, we must first check if the customer is a friend
and has purchased enough to get a discount. If so, that customer's discount is 1.5 times the entry in column D (which we compute in column F). If customer is not a friend who has bought more than the
number needed for the discount, then we give a discount equal (in percentage terms) to the entry in column D. If neither condition is true, then the customer is charged the full price.
IMPORTANT NOTES
We had two ending ) in our IF statement: one to match each IF statement.
When we have more than one occurrence of IF in a formula, we refer to the formula as a Nested IF statement.
In addition to the AND operator, we can use the OR and NOT operators in a nested if statement. An OR operator returns "true" if and only if at least one of the conditions within ( ) is true. For
example, the formula IF(OR(E2="x",G2>=C2),(1-F2)*B2,B2) would give a 15% discount if a person was a friend or ordered at least 100 Napoleons and would otherwise give no discount. A NOT
operator returns TRUE if and only if the condition within ( ) is FALSE. For example, the formula =IF(NOT(E2="x"),B2,IF(G2>=C2,(1-F2)*B2,B2)) would charge full price to anyone who is not a
friend. Then for friends we would give a 15% discount if they ordered at least 100 Napoleons. Otherwise, we would charge full price.
EXERCISES
Let's test our mastery of IF statements by trying the following problems:
Currently, we charge $30 for a Sacher Tort and our competitor charges $25. If our competitor charges below $20, we will lower our price to $25. Write a formula which returns our price after we
enter the competitor's price in the spreadsheet.
In the game of craps, two dice are rolled with a total between 2 and 12 resulting. A 7 or 11 on first roll results in a win, a total of 2, 3 or 12 results in a loss, and otherwise the game continues.
Write a formula that returns the game status after the first two dice are rolled.
Text Functions
INTRODUCTION
Often we import data to a spreadsheet from a web site or the corporate database. Many times the data does not look the way we want. For example, we may import the current month's sales of each
product from a database and the data might look as follows:
We would like to extract the number sold of each product to a separate cell. For example, put 178 in cell F3. Excel's collection of text functions helps us clean up and manipulate data that does not quite
look the way we want. In this section, you will master the LEFT, RIGHT, MID, LEN, FIND, VALUE, and CONCATENATE text functions. Please download file Text.xlsx.
In column G we will extract each employee's last name. First in column E we find the location of the space between the first and last name. Then in column F we determine the number of characters in
the person's name (including the space). Finally, in column G we use the RIGHT function to extract the employee's last name.
We will use the FIND function to find the location of the first and second spaces in the person's name. Then we can use the MID function to extract to column G all characters between the first and
second space. This will, of course, result in column G containing each person's middle name.
EXERCISES
All exercises for this chapter are in the file Textexercises.xlsx.
The sheet Movies gives the number of copies of each movie in stock at a video store. Put the name of the movie in one column and the number of copies in the next column.
The sheet ID gives a product ID, followed by a product name followed by a product price. Extract the product name to a separate column. The price always is expressed using 4 characters.
EXERCISES
In sheet addresses combine the street address, state, and zip code into a single cell.
Flash Fill
INTRODUCTION
Text functions are powerful, but some people have trouble mastering them. Excel 2013 has an amazing new feature, Flash Fill that uses pattern recognition to solve many problems that were previously
solved via text functions. To use Flash Fill simply enter a few examples of what you are trying to accomplish in a column adjacent to your data. As soon as Flash Fill enters some suggested entries hit
enter and you are done!
IMPORTANT NOTES
Flash Fill is not foolproof; sometimes it just does not get the pattern.
If your original data column has a heading you need to enter a heading in the same row of the column in which you want Flash Fill to enter data.
EXERCISES
For the data in the file Flashfilltemplate.xlsx use Flash Fill to
Enter employee names with the first and last names beginning with a lower-case letter.
Enter each employee's first name.
Please download workbook Datesandtimes.xlsx. We begin by noting that if you bring up the Format Cells Dialog box (the easiest way to do this is to hit Ctrl+1), then by selecting Date or Time you may
choose the way you want dates and/or times displayed.
EXERCISES
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 time of day we have the product available.
Extract the year, day of week, day of month, and month that we first sold each product.
For a given time HOUR(time) will return the hour for the given time.
For a given time MINUTE(time) will return the number of full minutes after the hour for the given time.
For a given time SECOND(time) will return the number of seconds for the given time.
EXERCISES
Extract the hour and minute at which we have each product first available.
Note, for example, that August 15, 2009, is 40,040-1 days after January 1, 1900. Also note that, for example, 5:40 PM is 74% of the way between midnight and the start of the next day.
Range Names
INTRODUCTION
Suppose cell B500 of your workbook contains Le Napoleon's sales in January and cell B501 contains our February sales. If we want to compute our total sales in January and February, we could enter
the formula =B500+B501. Then nobody would know what we are doing. Wouldn't it be nice (as the Beach Boys used to say) if the formula showed up as =JAN+FEB? In this section, we will show you
how to name cells or ranges of cells in your spreadsheet and use the range names you create in your formulas. Using range names often reduces the effort needed to create important formulas. More
importantly, using range names makes it easier for your colleagues to understand your work.
Using the Name Box to assign the city names to each sales value would require that we use the Name Box 24 times. There must be an easier way! Excel's Create From Selection option allows us to create
range names based on the text in the spreadsheet.
EXERCISES
In worksheet States, name each state's sales with the state abbreviation. Then add up Massachusetts and New York sales.
In worksheet Regions, create a name for all sales during each month and all sales in each region. Write a formula using range names that adds up all East sales and all West sales.
Lookup Functions
INTRODUCTION
Problem 2: In sheet Vlookup false we want to determine the cost of each order. To this we must look up the price of the products listed in A20:A27. Write formulas to determine the total cost of each
order.
Problem 3: We are charging $30.00 for a Sacher Torte during the first quarter of 2010. During each quarter of 2010 we want to increase the price 5%. Write a formula that determines for any date in
2010 the price of a Sacher Torte.
We will solve our three problems using lookup functions. Our first two problems require the use of VLOOKUP functions, while our third problem requires the use of HLOOKUP functions.
This formula will keep comparing the lookup value to the entries in the first column of the table range. As long as the lookup value is >= to the number in the first column of the table range, we keep
moving down the table. As soon as the lookup value is < the number in first column of the table range, we stop and move to the column index column to find the value returned by the lookup function.
We now will use a vlookup function to help us determine the total cost of each customer buying éclairs from Le Napoleon. We have named our table range C4:D8 as lookcost. References to range names
refer to the same range of cells when we copy a formula. This fact ensures that when we copy our vlookup formulas we will not have to place $ signs on the table range.
Let's use vlookup with the false option to lookup (in worksheet vlookup false) the total cost of the products orders based on rows 20-27. We have named our table range (A3:B16) as lookprice.
HLOOKUP
When we want to match an entry in the first row rather than first column of a table range, then we use an HLOOKUP (H for horizontal) function). The syntax is identical to VLOOKUP with row index
replacing column index. We now use HLOOKUP functions to solve the following problem: We are charging $30.00 for a Sacher Torte during the first quarter of 2010. During each quarter of 2010 we
want to increase the price 5%. Write a formula that determines for any date in 2010 the price of a Sacher Torte.
Our work is in worksheet Growth. We have named cell D1 growth and the table range C2:F3 Dateprice.
EXERCISES
Please download file Vlookuphw.xlsx.
Rows 3-12 give the age and salary of some of your friends. In rows 15-18 write formulas to enter each person's age and salary.
When a customer orders < 100 Pear Charlottes, that customer pays $25 per cake. When the order is between 100 and 199 Pear Charlottes, they pay $23.00 per cake. If they order at least 200
Pear Charlottes the customer pays $20.00 per cake. Write a formula that will compute the cost of ordering any number of Pear Charlottes.
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 column. We will soon see that together these two functions give us a great "one-two punch" that can be combined to great benefit.
INDEX
Simply stated, the INDEX function extracts an entry from a given row and column of a rectangular array of cells. The syntax of the INDEX function is =INDEX(array, r, c.). Then the INDEX function
returns the entry in row r and column c of the given array. Please download the file Indexmatchtemp.xlsx. Worksheet Index contains the monthly sales for each product. Let's write a formula to return
in cell B18 the sales of Opera Tortes during February.
EXERCISES
Write a formula that returns Vanilla éclair sales during April.
MATCH
The MATCH function looks to match a text string or number in a row or column. The syntax =MATCH (lookup value, lookup range,0) works as follows. If the lookup range is in a single column, the
MATCH function finds the first occurrence of the lookup value and returns how many rows down the lookup value 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 column and returns how many columns across the lookup value is in the lookup range. The last argument of 0 is needed because usually our lookup range will not
have sorted values. We will not discuss MATCH functions with last arguments of +1 or -1 since they are rarely used. As an example of the use of the MATCH function, let's find the first occurrence of
Pear Charlotte in the list of products in column F of worksheet Match and index. We note that if no match exists, then Excel will return a #N/A error.
EXERCISES
Please download file Indexmatchhw.xlsx.
The worksheet Indexmatchhw.xlsx contains our employees' names and salaries. Write a formula that would return the name of the employee with the largest salary. Hint: The MAX function
returns the largest number in a column.
Suppose we can enter an employee's name in cell D1. Write a formula in cell E12 that returns the employee's salary.
Error Trapping
INTRODUCTION
Suppose we attempt to compute average price as revenue divided by units sold. If units sold = 0 we will get a #DIV/0! error. If we write a lookup formula to return the price of a product and we
misspell the product's name, we will receive a #N/A error. There are many other error messages that can pop up in EXCEL. Using the Excel IFERROR function we can replace these error messages by
an explanatory text message. The syntax of IFERROR is IFERROR(excel, formula, desired message). If the Excel formula returns a value without an error, then this value is inserted in the cell.
Otherwise the desired error message is entered in the cell.
EXERCISES
Please download the file errortraphw.xlsx.
File Errortrap.xlsx contains in columns A and B prices at which homes were bought and sold. If a home has not yet been sold, the sell price column says not sold yet. In column C compute the
profit earned on each sold house. If a house has not been sold, your formula should say not sold yet.
Rounding Functions
INTRODUCTION
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
syntax of each function follows:
ROUNDUP(number,n) rounds the number up (away from 0) using n significant digits. Using n = 0 results in the number being rounded up to the nearest integer. For example,
ROUNDUP
Please download the file Roundingfunctionstemp.xlsx. Suppose Le Napoleon must purchase flour in sacks weighing a given amount. Given a need for flour, how can we write a formula that tells Le
Napoleon how many sacks they need to purchase? We simply need to divide 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 named the number of pounds in a sack with the range name package_size.
ROUND
Finally, let's suppose our penalty is based on the number of months (30 days = a month) rounded to the nearest month. For example, 45-74 days is two months, 15-44 days is one month, etc. In this
situation we will use the ROUND function to round DAYSLATE/30 to the nearest integer.
EXERCISES
Please download the file Roundingfunctionshw.xlsx.
This file gives the dates when several houses were bought and sold. Use rounding functions to compute the number of full years each house was owned before it was sold. Assume 365 days = 1
year. For example, a house kept for 700 days was kept for one year.
Compute the number of years, rounded off to the nearest integer, for which each house was owned.
Hint: Subtracting dates gives the number of days between the dates.
INTRODUCTION
Suppose you have the number of hours each employee worked this week in cells A1:A10 and the number of hours each employee worked in cells B1:B10. You want to compute your total payroll for the
week. We could of course enter the formula =A1*B1 +A2*B2 +? +A10*B10. This would be tedious and we would probably make some errors while entering this formula. Entering the formula
=SUMPRODUCT(A1:A10, B1:B10) would be an easy way to compute our total payroll. Usually the SUMPRODUCT function has two arguments consisting of cell ranges having exactly the same
dimension. Then the SUMPRODUCT function multiplies the corresponding components of each cell range. If one cell range is a row with n cells, then the other cell range must also be a row with n cells.
If one cell range is a column with n cells, then the other cell range must be a column with n cells. Finally, if one cell range is a range with m rows and n columns, then the other cell range must also
contain m rows and n columns.
SUMPRODUCT EXAMPLE
To illustrate the use of the SUMPRODUCT function, let's determine Le Napoleon's total payroll for a week. Please download the file Sumproducttemp.xlsx.
EXERCISES
Please download the file Sumproducthw.xlsx. This file contains information on how many hours each employee worked, how many 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 amount bought from each of Le Napoleon's six suppliers.
INTRODUCTION
If there is one thing we know about this world, it is that we do not know what is going to happen. For example, Le Napoleon does not know how many Sacher Tortes will be demanded each day. Excel
contains several functions that help us model uncertain events such as the daily demand for Sacher Tortes. In this section, we will discuss two such functions: RAND() and RANDBETWEEN. In a future
chapter, we will study in more detail how to use an Excel add-in, @RISK, to model uncertainty. The use of spreadsheets to model uncertainty is often referred to as Monte Carlo simulation.
EXERCISES
Set up a spreadsheet that models the daily demand for Pear Charlotte. There is a 60% chance the demand will equal 4 and a 40% chance the demand will equal 8.
For example, suppose Le Napoleon believes that it is equally likely that today they will sell between 100 and 200 Napoleons. Then entering =RANDBETWEEN(100,200) in any cell will generate a
random demand that reflects our view of what might happen.
EXERCISES
The demand for Praline tortes today is equally likely to be between 20 and 40. Write an Excel function that can be used to model the daily demand for Praline tortes.
In your finance classes, you will have to perform calculations involving important financial concepts such as Net present value (NPV), Internal Rate of Return (IRR), mortgage payment schedules,
and depreciation. Excel has many useful functions that make these computations a snap. In this section, we will discuss several of Excel's important financial functions: XNPV, XIRR, PMT, and SLN.
Consider the cash flows shown in the worksheet Financialfunctionstemp.xlsx. Please download the file Financialfunctionstemp.xlsx. Cells A1:G10 of worksheet NPV and IRR give the amount and
dates of cash flows for two different machines that Le Napoleon is considering buying.
XNPV
If we enter the dates that our cash flows are received and the values of the cash flows into a spreadsheet, then the XNPV function (syntax XNPV(rate, values, dates)) will return the NPV of the cash
flow values brought back to the first date. Here rate must be an annual discount rate. Let's utilize the XNPV function to compute the NPV for Machine 1 and Machine 2. We will use the function
wizard (indicated by the small fx icon on your ribbon) to input our formula involving XNPV. The function wizard is a helpful aid that makes it easy to input the proper syntax for unfamiliar functions.
You simply go the cell where you want to enter the formula and click on the Function Wizard icon. Then select the type of function (here we select Financial) and then move to the list of functions.
Next, type in the first few letters (say XN for XNPV) of the function's name and you will move to the correct function. Then follow the prompts and the proper formula will appear in your cell! Let's
now compute the NPV for Machines 1 and 2.
By the way a project with an NPV>0 increases the company's value while a project with an NPV<0 decreases the company's value.
EXERCISES
An NBA player will be a rookie in November 2010. Each year for six years he is paid $1 million a month during the months of November—April. Assuming a discount rate of 10% per year, what is the
NPV of his salaries as of January 15, 2008?
IRR
The problem with NPV is that it can be difficult to determine 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 simply the discount rate that makes a project's NPV =0. For example if we discount a project's cash flows at 12% and get an NPV of 0, we can say this project, roughly
speaking, is earning a 12% annual return on our investments. In rare cases, projects can have multiple IRR's or even no IRR, but we will leave discussion of that problem to your finance professors! To
find the IRR of a sequence of cash flows, we will use the XIRR function (syntax XIRR(cash flows, dates, guess)). Guess is usually a "guess" at the project's IRR (we recommend using guesses in the
range between -80% to +80%). Without a Guess near the project's actual IRR, Excel may return a #NUM error indicating that it cannot find an IRR. Therefore we recommend always trying 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.
EXERCISES
An oil company is going to drill a well costing $50 million on 5/15/2009. For each of the next 20 years they expect to receive $5 million in revenues. Assuming each year's revenue is concentrated
midyear, what is the IRR for this oil well?
PMT
Often we want to figure out the monthly payments in a car or housing loan. Excel's PMT function makes this easy! The PMT function has the syntax PMT(rate, nper,pv,fv,type).
Rate is the rate on the loan. If periods are years, this equals the annual rate. If periods are months, this is the annual rate divided by 12.
Nper is the number of equal payments needed to pay back loan.
PV is the amount borrowed. PV should be entered with a positive sign since we will receive a check for the amount of the loan.
FV is the amount of the ending payment needed to pay off the loan. If there is no ending payment, then FV=0. FV should be entered with a negative sign since we are paying money.
Use type =1 or True if the loan payments are made at the beginning of the month. Use type = 0 or false if loan payments are made at the end of the month.
Let's now move to the sheet mortgage payment and calculate the monthly payments on a 20-year loan with monthly payments and a 6% annual rate under the following three conditions:
End-of-Month payments
Beginning-of-month payments
End-of-month payments with an ending $30,000 payment
EXERCISES
What is the monthly payment (assuming end-of-month payments) on a 30-year $300,000 loan at an annual rate of 8%?
DEPRECIATION
We now describe the EXCEL SLN function which can be used to determine the depreciation amount each period when straight line depreciation is used. Excel also includes the DDB function (for
Double Declining Balance depreciation), SYD (Sum of years Digits depreciation), and VDB (variable declining balance depreciation functions). Due to lack of time we will discuss only the SLN
function.
The syntax of the SLN function is SLN(c, s, L). This function then computes the depreciation accumulated each period for a machine costing $c, having a salvage value of $s and a useful life of L years.
In sheet SLN we compute the annual depreciation over a 10-year period for a machine costing $400 having a $50 salvage value.
EXERCISES
What is the annual depreciation we can charge on a $4000 machine with a salvage value of $500 and a 5-year useful life?
INTRODUCTION
Often we want to count the number of cells in a range that contain numbers, numbers or text, or blanks. The COUNT, COUNTA, and
COUNTBLANK functions serve this purpose.
COUNT(cell range) counts how many cells in cell range containing numbers.
COUNTA(cell range) counts how many cells in cell range are not blank (contain text or numbers).
COUNTBLANK(cell range) counts how many cells in cell range are blank.
EXAMPLES
Please download the file Countingfunctionstemp.xlsx. Using Excel's counting functions, let's count how many cells with numbers, how many nonblank cells, and how many blank cells are in the cell
range D4:E20.
EXERCISES
Please download the file Counthw.xlsx.
Compute the number of cells containing numbers in the cell range D2:E12.
Compute the number of cells that are not blank in cell range D2:E15.
Compute the number of blank cells in the cell range D2:E18.
INTRODUCTION
Excel has many useful functions that can be used to do basic statistical calculations. A brief description of many of these functions follows:
MAX(cell range) returns the largest number in a cell range.
MIN(cell range) computes the smallest number in a cell range.
LARGE(cell range, k) returns the kth largest number in a cell range.
SMALL(cell range,k) returns the kth smallest number in a cell range.
AVERAGE(cell range) computes the average of all numbers in a cell range.
RANK(k, cell range,0) returns the rank of a number k in a cell range, with the largest number obtaining a rank of 1, the 2nd largest number a rank of 2, etc.
RANK(k, cell range,1) returns the rank of a number k in a cell range, with the smallest number obtaining a rank of 1, the 2nd smallest number a rank of 2, etc.
The formula VAR(cell range) computes the variance of the numbers in a cell range.
The formula STDEV(cell range) computes the standard deviation of the numbers in a cell range.
We have named the cell range (E5:E18) containing the customer spending data.
RANK
We will now show how to use the Excel Rank function to rank the amount each customer spent, with a rank of 1 indicating the customer who spent the most money and a rank of 14 indicating the
customer who spent the least money.
EXERCISES
Compute the largest amount of money spent by the last five customers.
Compute the smallest amount of money spent by the first four customers.
Compute the 4th largest amount of money spent by a customer.
Compute the 6th smallest amount of money spent by a customer.
Compute the variance and standard deviation of the money spent by the first two customers.
Conditional Counts
INTRODUCTION
Please download the workbook Countiftemp.xlsx. This workbook contains data on many sales transactions made by Le Napoleon. Each row represents a transaction and contains the following
information:
Product sold
Salesperson
Month during which sale was made
Location of sale: East, West, Midwest, or South
Units sold
Total sales revenue
For example, the first sales transaction consisted of Charlene selling Napoleons in June in the South. She sold 79 units for $276.50. We have used Name Create from Selection to name each column's
data with the heading from row 5. For example, we have named the cell range C6:C687 Month.
COUNTIF
We might want to determine the number of transactions which were made in the South. Or we might want to know the number of transactions made during April. Answering these questions is easy
using the EXCEL COUNTIF function. The syntax of the COUNTIF function is COUNTIF(range criteria). Then the COUNTIF function returns the numbers of rows in the range that meet a given
criteria. For example, the formula =COUNTIF(Location,"South") counts how many times the word South occurs in Column D.
Let's now use the Excel COUNTIF function to answer the following 3 questions.
First let's calculate how many transactions took place in the South.
EXERCISES
How many transactions involved sales of Pear Charlotte?
How many transactions generated exactly $736.00 of revenue?
COUNTIFS
There are many problems which the COUNTIF function cannot solve. For example, suppose we want to determine how many transactions were completed by Charlene in the South. The COUNTIF
function can only handle criteria involving one column. Our current problem involves criteria incorporating two columns: Sales person and Location. For such problems we can use the COUNTIFS
function. The S at the end means that multiple or plural criteria are allowed. The syntax of the COUNTIFS function is COUNTIFS(Criteria range 1,criteria 1, Criteria range2, criteria2, ...Criteriarangen,
criterian). This counts the number of rows for which each criteria range meets the desired criteria. To illustrate the use of the COUNTIFS function, let's determine how many transactions Charlene
completed in the South.
EXERCISES
How many transactions involved at least 50 units and were completed by Charlene in November for Napoleons?
Conditional Sums
INTRODUCTION
The COUNTIF and COUNTIFS functions help us count the number of rows satisfying a given criteria. The SUMIF function lets us
add up all rows in a column for which the entries in a single column satisfy a criteria. The SUMIFS function lets us add up all rows in a
column for which more than one criteria is satisfied.
SUMIF
The syntax of the SUMIF function is SUMIF(range, criteria, sumrange). Then the formula adds up all entries in the sumrange column for which the entries in the range column satisfy criteria. The
criteria for SUMIF (and SUMIFS) work just as they do for COUNTIF and COUNTIFS. Please download file Sumiftemp.xlsx. This file contains exactly the same information we used in our discussion
of the COUNTIF and COUNTIFS functions. Let's now use the SUMIF function to calculate the total revenue earned during each month of the year.
SUMIFS
Now let's try to determine the units sold by each salesperson in each region. For example, we will need to add up each number in the units column as long as the salesperson was Charlene and the
region was the East. Since we need to use two criteria to determine which rows of units are included in each calculation, we cannot use the SUMIF function. Fortunately, the
SUMIFS function allows us to do conditional sums involving multiple criteria. The syntax of SUMIFS is SUMIFS(Sumrange, Criteriarange1,criteria1, Criteriarange2,criteria2,..Criteriarangen,
criterian). This function would add up all rows in the Sumrange 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 determine how many units each salesperson generated in each region.
EXERCISES
Compute the total units and revenue for each location.
Summarize by month the total revenue generated by each salesperson.
Removing Duplicates
INTRODUCTION
Please download file Duplicatestemp.xlsx. The files Duplicatestemp.xlsx contains sales data organized by salesperson, location,
month, and product. Suppose we want a list of all the products sold. Perhaps we want a list of every product, salesperson, and
location combination. Excel contains a powerful feature, Remove Duplicates, that lets us easily find these lists. You simply select your
Data and then choose Remove Duplicates from the Data tab. Then you can tell Excel the columns for which you want a list of
duplicates. We recommend making a copy of the data first, because some of the original rows in your data will be removed when you
perform Remove Duplicates.
SINGLE-COLUMN DUPLICATES
Let's begin by obtaining a unique list of products.
EXERCISES
MULTI-COLUMN DUPLICATES
Next we will find each unique combination of product, salesperson and location. We will see that not every salesperson sold each product in each region!
EXERCISES
Find each unique combination of Product, Salesperson, and month.
Sorting in Excel
INTRODUCTION
Often we want to sort our data to better understand it. For example, we might want to sort our sales database so that for each product we can see the transactions listed in the descending order of sales.
We might even want to sort our data based on cell or font color.
EXERCISES
Sort the data so that for each location we see sales of each product listed in descending order of units.
EXERCISES
Sort the data so that the yellow cells are followed by the green cells.
Filtering Data
INTRODUCTION
Filtering data means extracting a subset of rows from data. Please download file Filtertemp.xlsx.
For example, we might want to filter or extract the following subsets of data:
By selecting Filter from the data tab, you may filter data based on the entries in the cell (for example, select all entries in the east or west), numerical value of cell (select all transactions for
>=100 units), filter data on text characteristics in cell (select all cells where product name begins with S), or filter on cell or font color (extract all cells with a yellow fill color).
TEXT FILTERS
Let's begin by locating all transactions involving tart sales in east or Midwest.
We note that in columns for which we have 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.
NUMBER FILTERS
Now suppose that you want to just focus on tart transactions in the east or Midwest that were for at least 100 units.
COLOR FILTERS
Finally, let's use the Filter to find all cells with yellow entries in the product column.
EXERCISES
Find all transaction for flans during January through March in the East.
Find all transactions by Charlene that ranked in the top 10 (measured by units). Hint: Use the Top 10 filter.
Subtotals
INTRODUCTION
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 makes it easy to obtain such
breakdowns. Before using the Subtotals feature you must sort the data according to the order corresponding to how you want the data totaled. For example, 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.
NESTED SUBTOTALS
Next we want to breakdown the totals for each Location by Salesperson. To do this we simply 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 that our breakdown by Salesperson will not replace our breakdown by Location.
EXERCISES
For each month, obtain a breakdown of the units and revenue for each product.
For each location, obtain a breakdown of sales by month.
Pivot Tables
INTRODUCTION
Please download the file Pivottabletemp.xlsx. NOTE: You may need to save the file locally for the PivotTable command to work. The file contains the database of sales transactions we have used as well
as a database of different customer transactions.
Pivot tables allow us to "slice and dice" data any way we want and perform complex calculations. In this section we will use pivot tables to effortlessly perform the following tasks:
Rows - If, for example, we drag Month to the Rows section, then we will see (going down the table) a breakdown of a desired set of data by Month.
Columns - If, for example, we drag Month to the Columns section, then we will see (going across a row) a breakdown of a desired set of data by month.
Values - If, for example, we drag Month to the Rows section and Units to the Values section, we will obtain the total revenue broken down by month (listed vertically), because we put Month in
the Rows Section.
Filters - Dragging a column to the Filters section enables us to display analysis for any subset of the possible values for the column. For example, if we place Month in the Rows section, Product
in the Filters, and Units in the Values section, then we can select any subset of products and display a breakdown by month of the total units sold of any subset of products.
FORMAT VALUES
Note that the sales totals in our pivot table are not formatted in $s. We will now show how to format the revenues in $s.
DRILLING DOWN
A nice feature of a pivot table is the ease with which you can "drill down" to the data that was used for a pivot table cell's computation. Let's show how to find all the transactions corresponding to
Caramel éclair sales in January.
TIMELINES
Beginning with Excel 2013, Timelines can be used to filter calculations for various time frames. To illustrate the use of Timelines, open the file Timelinestemp.xlsx, which gives the dates of each
customer transaction. You will now learn how to use a Timeline to slice and dice sales totals for a range of dates.
ANALYTICAL POTENTIAL
Pivot tables are a powerful tool to analyze a company's customers. In the worksheet customers we see a list of transactions. For each transaction we are given the product, customer (numbered 1-20),
and month. We want to find out the identity of our 10 best customers. This requires that we summarize total dollar sales by customer. Then we will show you how to use Excel's powerful sorting
capabilities to pick out our top 10 customers.
ADDITIONAL OPTIONS
When you are within a pivot table you may modify many portions of the Pivot Table by clicking within the Analyze or Design portion of Pivot Tools (located in right-hand corner of the ribbon). For
example, clicking on Design allows us to change the formatting style of the table, the layout of the table (compact - our current format, outline or tabular) as well as the way totals and subtotals are
displayed. From the Layout options we may change many aspects of the table including the location in the spreadsheet, the name of the spreadsheet, the source data etc.
We also note that the data included in a pivot table can be summarized in a Pivot Chart. We will discuss pivot charts in the following section.
Finally, if new data is included in a pivot table, you may right-click and select refresh to update the pivot table calculations.
EXERCISES
Find during each month the percentage of sales generated by each salesperson.
Determine the units sold by each salesperson of each product.
Determine our 5 worst customers.
Determine the average number of units per transaction sold of each product.
Use a Slicer to summarize sales during January-March.
Use a Timeline to summarize sales during the period Q1 2014 through Q2 2016.
Pivot Charts
Perhaps you noticed the PivotChart button on the PivotTable Tools Analyze tab:
A Pivot Chart is simply a chart that is linked to a pivot table and updates to display graphically whatever is selected for display in the Pivot Table.
To create a Pivot Table with a corresponding Pivot Chart (you cannot have just a Pivot Chart; there must be an underlying Pivot Table to provide the chart's source data), click the PivotChart button
from the PivotTable Tools' Analyze tab. The steps are essentially the same as for creating a Pivot Table, but you will now see a Pivot Chart as well.
This data might be better displayed as a line chart. In the next chapter we will see how to change an existing chart's type. The material presented in the next chapter applies to Pivot Charts as well as
regular charts.
EXERCISES
Create a PivotTable with PivotChart to determine the revenue brought in by each salesperson for each location. Compare the look of the chart when you use Location as the Axis field and Salesperson as
the Legend field, and the other way around.
Choose the desired chart type, and a Pivot Chart will appear, linked to the existing Pivot Table.
EXERCISES
Return to one of the Pivot Tables that you created in exercises (1)-(4) and add a Pivot Chart.
In the "Excel Formulas" chapter we studied many of the outstanding conditional formatting in Excel. Sometimes you have to create your own formatting using the Formula option. If you select a range,
you may select from the New Rules portion of the Conditional Formatting menu. Then select Use a Formula to determine which cells to format. Enter a formula for the cell in the upper corner of the
selected range which is true if and only if you want the cell in the upper left corner of the range to have the format you select. Then Excel will automatically copy this formula to the rest of the
selected range. Whenever the copied version of the formula is true, Excel will insert the selected format in the cell. This method is most easily explained by example.
EXERCISES
Set up a conditional format for the worksheet product and region that highlights in red for each region the product with the largest sales.
Set up a conditional format that highlights any of the three largest numbers in the product and region worksheet in red.
Charts
Excel makes it easy to illustrate aspects of your data using charts. Once you decide what type of chart will best make your point, a basic chart can be made in just a few mouse clicks. There are many
options for customizing charts as well. We will explore some of these in this chapter.
We will start with the file Charts_creating.xlsx, so please download this workbook now. As always, please follow along as we outline changes to the workbook.
Creating Charts
In the chapter on Useful Excel Functions, you saw how range names could come in handy for summarizing data. We will use part of
the same dataset that you saw there as the source data for a line chart, so that management can see at a glance how sales are doing
in the important Baltimore-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.
EXERCISES
Using the data on the product categories worksheet, create a chart that resembles the one shown below. (This is a stacked 3-D chart.)
The point here is that if at any point in selecting data for a chart you accidentally select the wrong cell, or select a cell out of turn, it might be best to start over.
EXERCISES
Using the data on the city quarterly revenues worksheet, create a chart that resembles the one shown below.
On the product categories worksheet is a column chart illustrating special order totals for each of our four product categories. This
data would also be reasonably represented by a pie chart.
EXERCISES
Change the chart from the exercise on Page 4 so that it resembles the one shown below.
For the chart's source data, it might be tempting 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 you will see, however, this
will cause problems.
As it turns out, we need to include A1 so that the selected ranges have equal widths.
Why does Excel now place the quarters in the legend? Recall that whatever there are more examples of, Excel puts along the x-axis. Whatever there are fewer examples of goes in the legend. We are using
data for six cities and four quarters—so, by default, the quarters go in the legend. We will fix this problem on a later screen.
EXERCISES
Using the data on the product categories worksheet, create a chart that resembles the one shown below. Note that this chart compares fruit flan and charlotte sales with fresh fruit tart sales.
EXERCISES
Change the chart from the exercise on Page 10 so that it resembles the one shown below.
Please create this chart (on the city quarterly revenues worksheet) before continuing.
Creating Charts Exercise Solutions
When you 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 example, say we created the Boston-New York-Baltimore line chart using only the quarterly figures. The pair of
screenshots below shows the dataset (with the source data for the chart shaded) and the resulting line chart.
We will continue with the file Charts_resizing-moving.xlsx, which contains all of the work completed in the previous section. Please download this workbook and follow along in it.
When you resize a chart, Excel resizes the elements within it, as well. We will resize the bar chart on the product line worksheet to reduce its height a bit.
You can also select the chart and use the Move Chart button on the Design tab.
EXERCISES
Insert a new worksheet and rename it city revenue charts. Reposition the sheet so that it immediately follows the city quarterly revenues sheet. Move one of the two Boston-New York-Baltimore
charts and the Midwest city chart from the city quarterly revenues worksheet to the new sheet. Then resize and move them on that sheet as you like.
Delete the other Boston-New York-Baltimore chart from the city quarterly revenues sheet. (Select the chart and hit the Delete key, or right-click the chart and choose Cut.)
We will continue with the file Charts_formatting.xlsx, which contains all of the work completed in the previous section. Please download this workbook and follow along in it.
We want to make some improvements, such as adding a title, removing the legend, adding data labels, and so on, to the following charts:
The pages that follow show the before and after versions of these three charts and explanations of the changes made.
We chose to overlay 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.
EXERCISES
Using the data on the city quarterly revenues worksheet, create a chart that resembles the one shown below.
In addition to adding a title to this chart, we will add labels to show (a) the value that each segment represents and also (b) its
percentage of the whole. Also, to draw attention to the fact that special orders for éclairs and napoleons are also important, we will
rotate the pie to bring that segment closer to the front. Finally, we will move the legend to the bottom and resize and reposition the
plot area.
EXERCISES
On the city quarterly revenues worksheet, in a new column, sum the quarterly values for each city. Then, using the totals obtained, create a chart that resembles the one shown below.
Note: The cities can be placed on the chart by choosing Category Name (in the same dialog box where you choose Percentages). Each city name will appear in a text box, which you can move off to the side,
as we have done.
FORMATTING AXES
We will continue with the file Charts_formatting-axes-data-series.xlsx, which contains all of the work completed in the previous
section. Please download this workbook and follow along in it.
Sometimes additional gridlines can help keep a chart from being misread. We'll add minor horizontal gridlines to the Midwestern city
revenue line chart (located on the City Revenue worksheet) and then change the settings so that they are not overwhelming. Finally,
we will add vertical gridlines. (We'll add a title, too.)
Say $500 is one of management's benchmarks for these products, and we want to be able to tell at a glance how each is performing
against that benchmark. To represent how much above the $500 mark these sales are, we'll change the x-axis so that the values start
at $500. We'll also fix the maximum value at $2000.
Finally, we'll format each bar with its own color and change the gap between bars (which will also serve to increase the width of each
bar).
EXERCISES
Using the data on the product categories worksheet, create a chart that resembles the one shown below.
Note: The title is in 14-point font, y axis values run in increments of 25, the legend has a gray dashed border, the chart area has no border, and there is a gradient fill.
SPARKLINES
Suppose you want to graphically summarize the number of Napoleons sold daily in all 23 cities where La Petit Bakery operates. You could create a single line graph which contains 23 lines, but that would be
very cluttered. Beginning with Excel 2010, Sparklines provides a neat way to summarize many data series with a graph for each series being placed in a single cell.
Customizing Charts
We will continue with the file Charts_customizing.xlsx, which contains all of the work completed in the previous section. Please
download this workbook and follow along in it.
Recall the pie chart representing special orders in the month of March, on the product categories worksheet. Management would now
like one just like it, but representing bakery sales. You could create and format a new chart—or you could copy and paste the existing
chart, change its source data, and enter a new title.
EXERCISES
Change the chart that you created as an exercise in the last section to resemble the one shown below, no longer showing bakery sales.
EXERCISES
Using the data on the product categories worksheet, create a chart that resembles the one shown below.
When you save a chart as a template, it is actually stored as a new chart type.
The resulting chart is a bit overwhelming, but it illustrates the idea that a template can be used on any range of data appropriate for its chart type.
Often we have data outside of Excel that we need to import into Excel. Here are some examples:
We may have a list of orders for Le Napoleon's products that has been typed into Word. Unless we can import our data into Excel, we will be unable to do any calculations on our data. How can
Please download the file Order.docx. The file Order.docx gives the location and the number of Napoleons ordered this week. How can we import this data into Excel?
When attempting to import a Word file into Excel, we first save the word file as a text file. Then we open the text file with Excel and let Excel's Text Import Wizard do the rest.
Often we want to extract data from a website into an Excel file so that we can analyze the data. Web queries are a useful way to get data from the web into Excel. You simply go the website containing
the desired information and copy the website'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, you can check the desired tables and import them into Excel.
To illustrate web queries, let's suppose Le Napoleon needs some time away from the bakery and wishes to purchase season tickets for the New England Patriots. Before buying the tickets, Le Napoleon
wants to download the team's schedule into Excel so that they can analyze what days they'll need to close the bakery for games. The website pro-football-reference.com contains team games and
schedule data.
Exercises
EXERCISES
Please download the file Knicksharvard.txt.
The file Knicksharvard.txt contains many lineups for the New York Knicks basketball team. Here is a sample lineup:
This lineup consisted of Lee, Curry, Randolph, Richardson and Robinson. The lineup played for 12.38 minutes and was beaten by 9 points.
Import this data into Excel so that each player's name is in a separate column. Also we want to know how many minutes each lineup played and how many points by which the lineup beat the other
team. The other data is not important. Import this file into Excel. Hint: You will need text functions to extract the number of minutes. The VALUE function will convert text into a number.
A spreadsheet model is an attempt to use a spreadsheet to build a representation of reality using logical mathematical relationships.
Organizations often use a spreadsheet model to help them make important decisions. Organizations also use spreadsheet models to determine how changes in the external environment will impact their
success.
Each quantity involved in a spreadsheet model can be classified as an output, input, decision variable, or calculation. These are the "LEGOS" we will use to build our model.
MODEL OUTPUTS
A model output is the ultimate quantity of interest that is computed by the model. For example, the NPV generated by a new bakery or the expected time a customer spends waiting in line at a bakery
might be a model output. A model may, of course, have multiple outputs. For example, annual profit and market share from a new bakery might be model outputs.
MODEL INPUTS
A model input is an assumption about the value of a key quantity of interest that is needed to compute a model output. For example, in our new bakery example we probably need to assume an annual
growth rate for units sold. In our waiting line example, the average number of customers arriving at the bakery per hour might be a model input. Models often have many inputs!
DECISION VARIABLES
Decision Variables are quantities that can be controlled by the decision maker. In our new bakery example, Le Napoleon can certainly control price and advertising, so those would be decision
variables. In our waiting line example, Le Napoleon can control the number of clerks waiting on the customers, so this would be a decision variable.
MODEL CALCULATIONS
The heart of any model is the set of relationships (usually implemented through Excel formulas) that are used to transform model inputs and decision variables into outputs. For example, in the waiting
line example, the following formula can be used to determine how customer waiting time depends on arrival rate and number of clerks.
Model Terminology
A model that prescribes a course of action is a prescriptive model. For example, a model that recommends a price for pastries would be a prescriptive model. A spreadsheet that develops a cash budget
which is used to predict Le Napoleon's cash needs over the next year would be a descriptive model.
We will soon use this model-building framework to help determine if Le Napoleon should open up a new bakery. Before developing the model, let's look at some guidelines that can help you develop
"intelligent" models.
Soon we will try to build a model that will help Le Napoleon decide whether or not to open up a new bakery. The ideas used to develop our model can be used to develop a model which can determine if
a generic business venture will be a success. The ideas used to develop our model can also be used when you create a financial model to evaluate a potential capital expenditure such as a plant expansion
or purchase of a new machine. Before we develop our model, we give some rules to guide "intelligent" model building. Many of our rules will require knowledge of Excel tools that we have not yet
covered (data tables, spinners, etc.), but be assured that by the end of this chapter you will have mastered many neat Excel tools and ideas that will aid you in the process of intelligent model building.
The same color convention can be used to identify worksheets in a multiple worksheet workbook. For example, by right-clicking on the tab name of a worksheet containing inputs, we may select Tab
Color and color the tab name in yellow.
Be wary of using range names in a multi-worksheet workbook. Successful use of range names in multi-worksheet workbooks often requires knowledge of advanced concepts such as sheet level
worksheet names.
A spinner enables you to change the value of an input simply by clicking on the up or down arrow of the spinner control.
A model should also be tested for sensibility. For example, 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 maximizing
price to increase.
Conditional formatting can be used to clarify a sensitivity analysis. For example, we can use conditional formatting to highlight the profit-maximizing price for different unit costs of producing a pastry.
You may also use the Error Checking option to check a worksheet for errors. Simply select the entire worksheet by choosing the Select All button (between the Column A and Row 1 Label) and then
choosing Error Checking from the Formula Tab. Excel will then point out all errors it finds in the worksheet. Often, however, Excel flags formulas that are OK.
Excel's Table Feature can often make it easy to incorporate flexibility into your model. As we will see, if we add data points to our spreadsheet, the Table feature can ensure that formulas and charts
automatically are updated to include the new data.
certainty. When there is a great deal of uncertainty about model inputs, you can use Monte Carlo simulation to model inputs and "random variables" and thereby generate a range of possible outcomes
for the model output(s). For example, we might find that given our assumptions, there is a 92% chance that a new bakery will make money. This would indicate that we should go ahead with the bakery.
Building a Model
SHOULD LE NAPOLEON OPEN A NEW BAKERY?
Le Napoleon is considering opening up a new bakery in Bloomington, Indiana. You have been hired to develop a model to determine whether opening the new bakery is a good idea. As we build our
model, you will see many of our intelligent modeling rules in action, and you will learn about many of Excel's outstanding model-building capabilities, such as data tables, spinners, comments, etc.
We want to determine whether or not Le Napoleon should open the new bakery.
If the NPV of the cash flows from the bakery is positive, the bakery will enhance overall profitabilty (even if it may have a negative short term effect,) and probably should be built. Recall from the
chapter "Useful Excel Functions" that maximizing NPV instead of the sum of profits ensures that we properly account for the time value of the money.
Since you have not yet begun your studies many of you do not know how to compute cash flows. In this example, we will assume no taxes and no depreciation of the bakery building costs, which
we will assume are immediately expensed. We will also ignore changes in working capital. (Do not worry if you do not understand these terms; after taking accounting you will!) Under these
assumptions cash flows equal profits, which are simply calculated as revenues less expenses.
Le Napoleon must determine the size of the bakery and the price to charge for pastries. We will make the bakery size and pastry price for each year of operation decision variables. Determining our
spreadsheet inputs will be easier once we have started to work on Step 4 or the model-building process.
Influence charts provide a convenient way to organize the relationships between spreadsheet inputs, outputs, and outcomes. Powell and Baker (Management Science: The Art and Science of Modeling
with Spreadsheets, 2010) provides an excellent discussion of influence charts. In an influence chart, we use the following symbols to represent aspects of the model:
A double circle is used to represent an input that is stochastic or not known with certainty.
We will now use an Influence Chart to determine the quantities needed to compute our model output (bakery NPV).
How can we determine a and b for our demand curve? The parameter a is simply the estimated annual demand if we chose a price of $0. Let's suppose 420,000 pastries. The parameter b is our
estimated loss in annual demand if we increase the price by $1. We will assume b = 60,000. Placing the values of a and b in cells rather than directly in formulas will make it easy to change the values of
a and b and determine how this impacts the bakery's projected viability.
For demand after year 1 we will use a two-stage growth model. We assume that demand will grow at a rather large rate (say 15%) for a given number of years (say 5). Thereafter the annual growth rate in
demand will reach a reduced or "steady state" level which is a given fraction (say 1/3) of the initial growth rate.
We will now see that armed with our knowledge of copying formulas it will be a snap to set up a spreadsheet that transforms our input assumptions into a project NPV for the new bakery!
EXERCISE
Le Napoleon has hired a new manager, Charlene Wu. Charlene is trying to build a model to help her determine how to save for retirement. What would be some key inputs into her model? What would
be the decision variables? What might be the model outputs?
Data Tables
SENSITIVITY ANALYSIS WITH A ONE-WAY DATA TABLE
Given our assumed values for our inputs and decision variables, the positive NPV indicates we should build the bakery. Of course, our inputs and decision variable estimates may not be correct or be
subject to change. We would like to examine how sensitive our model output (NPV) is to changes in our decision variables and/or inputs. Data tables are probably the tool most widely used to perform
sensitivity analysis in Excel. A one-way data table allows us to determine how a change in a single input or decision variable changes one or more spreadsheet outputs or calculations. We will use a
one-way data table to determine how a change in price affects bakery NPV. For simplicity we will assume that all Le Napoleon's bakeries have a capacity of 300,000 pastries per year. To create a one-
way data table, we begin by listing, in a column, possible values for our input or decision variable (in this case, price). Then we enter the formulas for the outputs of interest going across a row (starting
one row above first input value and one column to the right of the listed input values). After selecting Data Table from the What-If portion of the data tab, we can make our Data Table compute the value
of each listed formula for each listed input value. Then we can see how sensitive our formulas (usually model outputs) are to changes in a decision variable or model input.
Automatic - This setting is the usual setting. All formulas and data tables recalculate when data or formulas are entered into the spreadsheet.
Automatic Except for Data Tables - If you choose this setting, then your formulas will recalculate whenever you enter data or formulas into your spreadsheet. Your data tables will not
recalculate unless you hit the F9 key. This setting is useful in large spreadsheets because in large spreadsheets recalculation of data tables can be time consuming.
Manual - When Calculation Mode is on Manual, no formulas or data table will recalculate unless you hit the F9 key. Manual calculation is useful in a large spreadsheet, because in large
spreadsheets recalculation of formulas can be time consuming. Remember that in Excel a spreadsheet can have up to 1,048,576 rows and up to 16.394 columns.
EXERCISE
Please download the file Kioskexample.xlsx.
The file kioskexample.xlsx contains a model to estimate the annual profit from a kiosk in Bloomington Indiana's College Mall. Create a one-way data table that shows how profit, revenue, and variable
cost vary as the price of a pastry varies in $0.25 increments between $1.25 and $3.50.
With a two-way data table, we can vary two inputs or decision variables 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 vary (in $0.50 increments) the Year 1 price between $3.00 and $8.00 and vary the Year 1 Unit cost between $1.00 and $3.00. To create a two-way data table, we begin
by listing values of one input or decision variable going down a single column. Then we move up one row and over one column and list the values of the other input or decision variable. Then we enter
the output formula we wish calculated directly above the first input value.
EXERCISE
For the file Kioskexample.xlsx construct a two-way data table that shows how profit changes as price changes from $1.25 to $3.00 (in $0.25 increments) and unit cost ranges from $0.80 to $1.20 (in
$0.10 increases).
Goal Seek
Please download the file Goalseek.xlsx. We have now established that if we build a 300,000 pastry annual capacity and charge $4.50 during 2013, the bakery will add over $2 million in value to Le
Napoleon. Of course, this result assumes that our assumptions about values for other inputs are accurate. Before building the bakery it would be a good idea to determine how much our other model
inputs must change to make 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 value of a cell that makes a
particular formula hit a desired value. For example, we will use Goal Seek to determine the annual growth rate in demand that would cause the bakery NPV drop to 0.
Set Cell: The formula which we use to assume a desired value. In our situation the set cell will be cell B29 which contains the calculated NPV.
To Value: The value or "goal" that we want our Set Cell to assume. 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).
EXERCISE
For the file kioskexample.xlsx determine the level of annual demand needed for the kiosk to earn $100,000.
Auditing
Often we receive large and complex spreadsheets from colleagues. It is often difficult to understand the logic that was used to create the spreadsheet. For example, if we sent our spreadsheet to a
colleague, they might have trouble understanding how our assumed Beginning Growth Rate affects our NPV calculations.
Excel's Auditing Tool makes it easy to determine how spreadsheet inputs and outputs are related. To illustrate the use of the Auditing Tool, let's begin by determining how our assumed Beginning
Growth Rate is used in our NPV calculations.
Follow along in the next two videos by downloading the spreadsheet goalseekaudit.xlsx.
In the workbook Audittwosheets.xls we have computed in the worksheet Outputs the annual profit from opening a kiosk in a mall. How can we find the input assumptions that were used to compute the
profit?
Flexibility
MAKING THE WORKSHEET FLEXIBLE
We have assumed that the new bakery will be open for 10 years. Clearly the bakery might be open for more or less than 10 years. We now show how to change our spreadsheet formulas so that we can
easily vary the number of years the bakery is open.
Modelers often like to define "scenarios" which consist of a set of values for all inputs. For example, a common 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.
A considerate modeler will annotate his or her spreadsheet with documentation that helps users of the model understand the model's complexities and intricacies. To insert a comment in a cell, simply
move to the cell where you want to put the comment and from the Review Tab select New Comment. Then type the comment within the box that appears. Cells with comments are indicated by a small
red triangle in the cell. Let's show how to put a comment in cell D8 that documents the meaning of cell D8.
By clicking on the red triangles, you can view some other comments we added to the model. Of course, clicking Show All Comments will let you view or hide all comments.
Error Trapping
Before passing your spreadsheet model onto your colleagues, you should build into your model checks that reduce the possibility of errors, or at the least indicate the occurrence of spreadsheet errors.
Reviewing our model, we see the following possibilities of errors:
If price is high enough, we might see the unrealistic occurrence of a negative demand. To remedy this problem, we will modify our year 1 demand formula to ensure that negative year 1 demand
cannot occur.
Clearly the years of high growth must not exceed the number of years of operation. We will use an IF statement to ensure that if this condition is violated, the user is informed of that fact.
Number of years of operation should not be allowed to exceed 20. We will use DATA VALIDATION to ensure that this is the case. Using Data Validation, we can prevent the entry of a number
>20 in cell D16.
You will often encounter complex spreadsheet formulas that are difficult to understand. After selecting any part of a formula and hitting F9, Excel will evaluate or show the value of the selected portion
of the formula. This can often help you better understand a complex formula. Just make sure you hit escape before exiting the formula or you will lose the formula. Selecting Evaluate Formula followed
by Evaluate will allow you to see a step-by-step evaluation of a formula.
Scenarios
WORST, MOST LIKELY, AND BEST CASE 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 values 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 parameters.
We want to set up our spreadsheet so that the user can choose a scenario (Worst, Most Likely, or Best) and then the input parameters automatically change and the user can view the NPV corresponding
to that scenario. We will enter the parameter values for each scenario in the spreadsheet and then use VLOOKUP functions to pick off the input parameters 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 name.
EXERCISE
Modify the created scenarios so that the steady state growth rate is included in each scenario.
Spinners
USING SPINNERS FOR SENSITIVITY ANALYSIS
Please download file Spinners.xlsx. We now showhow easy it is to insert spin buttons (spinners) into a spreadsheet model. Clicking on a spinner enables us to easily change the values of a model input
and see how the model's outputs change. We will create spinners that let us easily change Years of Operation and Beginning Growth rate.
Of course, we see by clicking on our spinners that increasing Years of Operation or Beginning growth rate increases NPV, as expected.
EXERCISE
Insert a spinner that allows the ratio of Steady State growth to Beginning growth to vary from 0 to 0.8 in increments of 0.1.
Model Limitations
MODEL LIMITATIONS
Every model has its limitations. Here are some limitations of our model:
We have assumed a linear demand curve. Often the relation between price and demand is not linear.
The two-stage growth model may not be accurate. To test the validity of the two-stage growth model we could check whether the demand growth for past bakery openings has followed the two-
stage growth model.
Our model for building cost as a function of capacity may not be accurate. Modelers often assume that building a plant with capacity x incurs a cost of a+ bxk, where 0<k<1. This type of model
ensures that the cost of adding additional units of capacity decreases as more units are added.
Finally, none of our parameters are known with certainty. If we are highly uncertain about our model inputs, we should use Monte Carlo Simulation to model the probability distribution of each
input and generate a range of possible NPV's. Then we could make statements such as "I am 80% sure the bakery will have a positive NPV." In Unit 11 we will introduce you to the fascinating
world of Monte Carlo simulation.
EXERCISE
You have been asked to build a model to help Le Napoleon's managers with retirement planning. The inputs to the model should be as follows:
Current age
Present size of retirement account
Required Annual Withdrawal during retirement years (in today's dollars)
Annual Contribution to retirement fund (Decision Variable)
Age of Retirement
Annual Inflation Rate
How many years your retirement savings should last
Annual rate of return on investment account
Our model outcome measure is "Did I have enough money to last through retirement and maintain my desired standard of living?" Set up a spreadsheet model to help Le Napoleon's managers with
their retirement planning.
In this unit we will show you how to use the Excel Solver. The Excel Solver is used to solve optimization problems. An optimization problem requires a decision maker to find the best way to do
something given a set of restrictions or constraints. Here are some examples of optimization problems that you will probably encounter:
In the "Manage" dropdown at the bottom of the screen, select Excel Add-In, then Go. In the dialog box, select the Solver Add-in and click OK. If you now click on the Data tab you should see an icon for
the Solver (denoted by a ? mark) on the right hand side of your screen. This means the Solver is ready to roll!
• Set Objective
• Constraints
If our goal is to find that a production schedule that minimizes the cost of meeting
demand on time then...
Objective: Total Profit from all productsSum of production and holding costs
Constraints: Price of each product must be near competitor prices; say with 10% of highest
and lowest
Each month's
price
ending
charged
inventory
by a competitor.
is non-negative and each month for each resource
used is less than or equal to resources available.
Now let's develop and solve a Solver model that can help Le Napoleon maximize its daily profit. The file Solver.xlsx gives for each product the sales price, minutes of baker time needed, ounces of flour
needed, ounces of sugar needed, and maximum daily demand for each product. We are also given the available quantity of baker time, flour and sugar.
(Napoleons produced)*(Unit profit per Napoleon) + (Chocolate éclairs produced)*(Unit profit per Chocolate éclair) + ...(Tahiti cakes produced)*(Unit profit per Tahiti Cake).
LAUNCHING SOLVER
We are now ready to use the Excel Solver to find the profit-maximizing product mix. To activate the Excel Solver, simply choose Solver from the Analysis section of the Data tab. Recall that Solver is
not part of the default installation of Excel; you must install it as described at the beginning of the Solver unit.
ASSUME NON-NEGATIVE
If we feel that all variable cells in a problem must be non-negative, we should check the Make Unconstrained Variables Non-Negative option. Clearly Le Napoleon cannot bake a negative amount of any
product, so this dialog box must be checked.
(variable cell)*(constant)
is a linear model. If the objective cell and constraints of your Solver model are created by adding together terms of this form, the Simplex LP Method should be checked from the Select A Solving Method
drop-down box. This enables the Solver to use an efficient method (the simplex algorithm) to solve your problem. Solver is guaranteed to find an optimal solution to any linear model containing at most
200 variable cells and 200 constraints. Versions of Solver that can solve larger problems can be purchased from Solver.com. Solver has a much harder time finding an optimal solution to a nonlinear
model. For a discussion of nonlinear solver models we refer the reader to Practical Management Science, 4th edition.
Our Solver model is linear. For example, the objective cell is calculated by adding together terms of the form (units of product made)*(unit profit for a product). Thus the objective cell is created by
adding together terms of the form specified by the bullet above. Therefore we check the Assume Linear Model option. By the way, if you try to solve a linear Solver model and do not check the Assume
Linear model box, the Solver may have a difficult time finding the optimal solution.
RUN SOLVER
We are now ready to find the optimal solution to our Solver model. After filling in the Options dialog box, select OK. This will return you to the main Solver dialog box.
Note that all 1,000 ounces of flour are used, but 12 minutes of baker time and 36 ounces of sugar are unused.
EXERCISES
Le Napoleon has 3 bakeries and 5 retail outlets. Assume the cost of baking a torte at a given bakery and shipping the torte to a given retail outlet is as follows:
Each Bakery can bake up to 500 tortes per day. Each outlet needs 250 tortes delivered per day. What is the cheapest way to get the needed tortes to the retail outlets? Hint: SUMPRODUCT can be used
to multiply component by component two rectangle cell ranges.
Suppose you work for an investment fund and must determine the asset allocation for a client between bonds, US stocks, Emerging Market stocks, real estate, and commodities that incurs the
least risk for a desired level of expected return. Describe the objective, variable cells, and constraints for an appropriate Solver model. Is this model linear?
A drug company 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 material are available. A fractional number of pounds can be produced for any drug. Assume demand for each drug is unlimited. How many pounds of
each drug should be produced to maximize profit?
It is often difficult to work with workbooks containing more than one worksheet. In this Unit we will discuss Excel's 3 dimensional (3D) formula capabilities. 3D formulas often make it easier to combine
data from different worksheets.
Most users of Excel continually add new data (rows) to their spreadsheet or add new formulas (columns) to their spreadsheet; they are then frustrated when their formulas, formatting and/or charts do
not automatically update to include the changes in their worksheet. In this unit we show you how Excel's Table feature can often ensure that your formulas, formatting, and/or charts will automatically
update to reflect changes in your spreadsheet.
Three-Dimensional Formulas
EXAMPLE PROBLEM:
CREATE A WORKSHEET ON WHICH TO CONSOLIDATE FIGURES
The workbook 3D.xlsx contains individual worksheets for the units sold of each Le Napoleon product during the months January through May. Note that in each worksheet the product names are listed
in cells I5:I18 with the sales for each product listed in cells J5:J18. Let's insert a new worksheet in which we can total the sales of each product for the time frame January through May.
EXERCISES
In the file 3D.xlsx determine the total sales of each product during the months February through April.
Excel's Table feature makes it a snap to add new rows of data or formulas to a spreadsheet. The Table feature ensures that, when we add new data or new formulas, our old formulas and graphs will
automatically update to include the new data. Our old formatting will also be automatically extended to our new data.
At any time you can select a range of cells, and by hitting Control + T you will make that range of cells a table.
Note that if we add more data to the bottom of the spreadsheet, the new data will not show up on our graph. Let's solve that problem!
If you are going to use part of a spreadsheet as source data for a pivot table, you should make the data a table. Then when you refresh the data, the pivot table calculations will reflect the new data.
EXERCISES
In the file 3D.xlsx determine the total sales of each product during the months February through April.
Please download file Tablehw.xlsx. Worksheet Lookup of file Tablehw.xlsx contains sales of several products. Enter a formula in cell H12 that will compute sales for any product. The formula
should work if new products are added to the product list.
Create a pie chart to summarize this sales data. The pie chart should update automatically 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 formula that determines the NPV of these cash flows as of April 1, 2009. Assume an
annual discount rate of 10%. Your formula should work if new cash flows are entered into the spreadsheet.
Circular References
A worksheet exhibits a circular reference(s) when the dependence of cells in a spreadsheet exhibits a "looping" relationship. For example, as shown below the value of cell E8 is needed to determine the
value of cell E9, the value of cell E9 is needed to determine the value in cell E10 and the value in cell E10 is needed to determine the value in cell E8.
Thus in this example, the spreadsheet exhibits a form of circular logic in that the value in cell E8 refers back to its own value. Circular references often result when you are building a multiple period
accounting Income Statement (called a pro forma) in which a company is allowed to borrow money. Then the amount borrowed is often computed to make assets and liabilities equal. This creates a
circular reference because Debt affects cash, while cash affects total asset value, and total asset value affects debt.
Please download the file Circulartemp.xlsx. Le Napoleon has earned $2,000,000 in revenues this year and has incurred $1,200,000 in operating costs. Profits are taxed at 40%. Le Napoleon wants to
share their success with the community by giving back 10% of their after tax profits to the Red Cross and Girl Scouts. How much money should they give to charity?
When we check Enable iterative calculation, Excel keeps changing (the technical term is Gauss Seidel Iteration!) the values in cells E8:E10 until all three equations shown above are satisfied.
EXERCISES
Suppose baker John Paul Valjean earns $50,000 in taxable income. The state income tax rate is 8% and the Federal income tax rate is 25%. The Federal tax rate applies to Taxable income less state
income while the state tax rate applies to taxable income less state tax paid. How much will our baker pay in state and federal income taxes?
Monte Carlo simulation allows the user to "play out" or simulate an uncertain situation many thousands (or millions) of times and see the range of outcomes than can be expected to occur. Knowledge of
the range of outcomes can be used to aid the decision-making process under uncertainty.
Primitive Monte Carlo simulation can be done in the native Excel environment, but most practitioners of Monte Carlo simulation use Excel add-ins to perform Monte Carlo simulation. In our course we
will give you a brief introduction to a leading Monte Carlo simulation add-in: @RISK, which is published by Palisade Corporation. Enrollment in this course gives you access to @RISK for a 90-day period,
so you can follow along with our examples and attempt the section exercises.
Although we will focus on @Risk in this chapter, it is not the only available simulation add-in for Excel. A worthy alternative is Crystal Ball, developed by Decisioneering (). Crystal Ball has equivalent
functionality to @Risk. However, we have selected @Risk for usage in this Tutorial.
The one thing that is certain in this world is that the future is uncertain. Businesses and organizations often have to make decisions in the presence of uncertainty. For example,
Each morning Le Napoleon must decide how many Napoleons to bake, knowing that the day's demand is uncertain and that left-over Napoleons have little value.
Suppose you are selling your house. You are hoping for $300,000, but you receive an offer of $285,000. Should you accept the offer? You must make this decision in the presence of uncertainty
about future offers.
A drug company must determine the plant size that must be built long before the drug goes to market. Of course, demand for the drug is uncertain when the plant size decision is made. The drug
company does not even know whether the drug will come to market at all!
We often try to juggle the asset allocation of our retirement portfolio between asset classes (say stocks, bonds, gold, and commodities). Of course the future returns on these asset classes are
uncertain, but we still need to make our asset allocation decisions.
RANDOM VARIABLES
You should recall that in our discussion of the Excel Solver the key to building a model of a real life situation was to identify the relevant objective, variable cells, and constraints. The key to building an
accurate Monte Carlo simulation model of a situation is to determine an appropriate random variable to represent each source of uncertainty in the real life situation. Simply put, a random variable
describes an uncertain quantity by listing the values of the uncertain quantity along with a description of the relative likelihood of all possible values. There are two types of random variables: discrete
and continuous random variables.
Total dots showing when we toss a die — (1, 2, 3, 4, 5, 6). Each possible value occurs with an equal probability of 1/6.
Perhaps the daily demand for Napoleons can be modeled as a discrete random variable with the following values and probabilities.
The number of hits that David Ortiz gets in a single game is a discrete random variable.
then entering the formula =RISKDISCRETE(E8:E11,F8:F11) in a cell would generate values of a random variable which assumes a value of 25 40% of the time, a value of 50 30% of the time, a value of
75 20% of the time, and a value of 100 10% of the time.
We often assume (as an approximation) that a discrete random variable which can assume many values can be modeled as a continuous random variable. For example, even though the number of
Napoleons demanded daily is truly discrete, we might model the demand for Napoleons as a continuous random variable.
A continuous random variable has a zero probability of assuming any particular value. For example, there is a probability 0 that a randomly selected person is exactly 6 feet tall. To see this note
that to be exactly 6 feet tall a person's height would have to be 6.00000000000000000000000000000000000000 (there should really be an infinite number of 0's here!) feet tall, and the probability
that a person's height exactly matches this number is to all intents and purposes zero.
Note the density is uniform or constant everywhere on the interval [50, 200]. The height of the density at each value between 50 and 200 is 1/150 = 0.00666. This makes the total area under the density
function equal to 1. We see, for example, the probability that demand is between 80 and 170 is 60%. We can model a U[a, b] random variable with the @risk function RISKUNIFORM(50,200). Entering
this function in a cell ensures that any value between 50 and 200 is equally likely to be entered in the cell.
Note that our triangular PDF implies, for example, that there is an 87.5% chance that market size is between 45,000 and 65,000. Also a market size near 60,000 is twice as likely as a market size near
50,000 (because the density is twice as large at 60,000 as 40,000). We can model this random variable using @RISK by entering the function RISKTRIANG(40000,60000,70000) in a cell. In such a
cell, for example, a market size near 60,000 would be twice as likely as a market size near 40,000.
The triangular random variable has become popular because it generalizes the common practice of analyzing a business case by creating a best case, worst case, and most likely scenario. The triangular
random variable simply allows for the possibility that any value between the best and worst case has a chance of happening. Now let's show how to use Monte Carlo simulation and the @RISK add-in to
help Le Napoleon decide whether it should introduce a new product.
EXERCISES
For each of these quantities, determine whether it should be modeled by a discrete or continuous random variable:
Le Napoleon is trying to decide whether or not to introduce a new pastry to compete with similar offerings of other companies. Three key quantities associated with this decision are highly uncertain:
Fixed cost of developing the pastry. We will assume that there is a 50% chance that the fixed cost is $10,000; a 30% chance the fixed cost will be $30,000; and a 20% chance the fixed cost will be
$50,000.
The best case for annual market size of the new pastry is 70,000 units; the worst case is 40,000 units, and the most likely case is 60,000 units,
Le Napoleon's market share of the new pastry is equally likely to be anywhere between 20% and 50%.
We see that fixed cost can be modeled as a discrete random variable (using the RISKDISCRETE function), market size can be modeled as a triangular random variable (using RISKTRIANG function),
while market share can be modeled as a uniform random variable (using RISKUNIFORM function). We can express profit and use @RISK to easily create a graph which gives the range of possible
profits that can occur. This will help us determine whether to go ahead with the new pastry. We assume price per pastry is $4 and unit cost is $1.50.
When this icon is red, hitting the F9 key results in random variables recalculating with the probabilities implied by the formula. For example, when this icon is red a RISKDISCRETE function will show
each possible value of the random variable, with the given probabilities.
We should also click on the Automatically Show Graph icon so it is red. Then when we run our simulation, a graph showing the range of possible outputs for any cell in the spreadsheet will automatically
show on the screen.
SETTING UP @RISK
Now we are almost ready to run our first Monte Carlo simulation! We begin by selecting all OUTPUT CELLS for which we want @RISK to collect statistics. In our case this is simply the profit cell. Then
we tell @RISK how many times we want to "play out" the simulation. This is called the number of Iterations. We will simply choose 1,000 Iterations. If we place the cursor in our output cell and start
the simulation, then quickly @RISK will show us a graph showing the range of possible profits associated with the introduction of the new product.
RUNNING @RISK
We are now ready to run our simulation.
Our Monte Carlo simulation indicates that given our assumptions about the uncertainty involved in the development of the new pastry, there is an 87% chance that after one year we will show a profit.
Thus the Monte Carlo simulation would strongly indicate that this new pastry is a go!
EXERCISES
Suppose Le Napoleon plans to bake 200 Napoleons this morning. Today's demand for Napoleons is unknown but we believe that the worst case is a demand of 130 Napoleons; most likely
demand is 180 Napoleons, and best case is a demand of 260 Napoleons. Suppose a Napoleon sells for $4 and costs $2.50 to produce. Finally assume that Napoleons left over at the end of the day
can be sold for $0.50. On average how much profit will Le Napoleon expect to make today? What is the probability that Le Napoleon makes more than $150?
Assume that annual demand for an Eli Lilly drug is equally likely to assume any value between 60,000 and 90,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 $10. Any leftover drugs spoil and are worthless. A cost of $10 per unit (due to customer dissatisfaction) is assessed if we cannot meet demand.
What is the expected annual profit for this drug? What is the probability that Lilly will make more than $300,000 this year from this drug?
Development of a drug requires three phases of research. Phase I is equally likely to take exactly 1 year or 2 years. Phase II has 50% chance of taking 2 years, a 30% chance of taking 4 years, and
a 20% chance of taking 5 years. Phase III has an equal chance of taking 3 or 5 years. Assume that each phase is sure to succeed. On the average, how long will it take to complete development of
the drug? What is the probability that will be completed 8 years from now?
Welcome to the final exam for the Spreadsheet Modeling tutorial. This test will allow you to assess your knowledge of some basic modeling skills.
To advance from one question to the next, select one of the answer choices and click the Submit button. After submitting your answer, you will not be able to change it or return to the question, so make
sure you are satisfied with your selection before you submit each answer.
Some problems ask you for a formula. It is probably easiest to determine the correct formula in Excel and then paste it into the Final Exam answer area. This will avoid syntax errors. For example, if in
Excel you type in the formula =SUMIF(B1:B10,C8,D1:D10) and think that is the correct answer, just select SUMIF(B1:B10,C8,D1:D10) in Excel and copy it. Then paste it into the input answer area within
the question.
Your results will be displayed immediately upon completion of the test. The results screen will display each question with a graphic notation indicating your score: X for incorrect and check mark for
correct.
Click Final Exam in the menu bar to the left to begin. You can also return to your test results at any time (after completing the exam) by clicking Final Exam Introduction and then Final Exam.
Good luck!
Credits
Courseware # 9052
Authors:
Wayne Winston, Professor Emeritus of Operations and Decision Technologies at Indiana University and Visiting Professor at the Bauer College of Business at the University of Houston, developed this
tutorial to provide the user with a comprehensive understanding of Spreadsheet Modeling. For over 15 years the author has taught Excel modeling to thousands of analysts at organizations such as
Broadcom, Intel, Microsoft, GM, Eli Lilly, Cisco, EBay, US Army, US Navy, Deloitte, Booz-Allen Hamilton, GM, Ford, Pfizer, and Verizon. Wayne also consults for the New York Knickerbockers NBA team.
He has won over 45 teaching awards. He is the author of 15 books including Mathletics, Excel 2013 Data Analysis and Business Modeling, and Marketing Analytics.
Much of the tutorial content was also authored by Sarah Sherry, a former senior lecturer in the Operation & Decision Technologies department at Indiana University.
All Microsoft product screen shot(s) reprinted with permission from Microsoft Corporation.
Copyright Harvard Business School Publishing. Copying or posting is an infringement of copyright. [email protected] or 617-783-7860.