0% found this document useful (0 votes)
28 views

Spreadsheet Modeling

Uploaded by

misha bansal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Spreadsheet Modeling

Uploaded by

misha bansal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 157

Spreadsheet Modeling 13/06/24, 11:20 PM

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 1 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 2 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Spreadsheet Modeling Overview

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.

The Excel Environment

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 3 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Opening a Workbook

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


Double-click its icon in Windows Explorer. This will work as long as Windows knows that the file can be opened in Excel.
If Excel is running, hit Ctrl-O, or from File on the Ribbon, select Open and browse for the file. You can use the "Files of type" drop-down box in the lower right-hand corner to view a number of
different file types.

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 Excel Ribbon


THE RIBBON

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.

Take some time to explore the different tabs.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 4 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

MINIMIZING THE RIBBON

The Quick Access Toolbar

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.

CUSTOMIZING THE QUICK ACCESS TOOLBAR

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 5 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

CHANGING THE DEFAULT NUMBER OF 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

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 6 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

MOVING OR COPYING WORKSHEETS TO ANOTHER EXCEL WORKBOOK


You can also move or copy worksheets into another workbook. This is handy if you are working on a team and need to bring people's individual work into a single file.

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.

Moving Around a Worksheet and Workbook

SCROLLBARS

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 7 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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

Ctrl-Home: Selects cell A1


Ctrl-End: Selects the cell at the intersection of the last-used column and last-used row on the worksheet
Page Up: Scrolls up one screen
Page Down: Scrolls down one screen
Alt-Page Up: Scrolls left one screen
Alt-Page Down: Scrolls right one screen
Ctrl-Page Up: Selects the previous worksheet
Ctrl-Page Down: Selects the next worksheet
Ctrl-Tab: Moves to the next open Excel workbook

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

In a later chapter, we will discuss print areas and page setup.

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.

Saving a Workbook File

To save a workbook, hit Ctrl-S, or click the Save icon on the Quick Access Toolbar.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 8 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Save Excel Environment.xlsx as an .xls file.


Save the bakery mon-thurs worksheet as a .csv (comma-separated values) file named bakery1.csv.

Saving Exercise Solution

Working with Data: Basic Techniques

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 and Ranges

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 9 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

CHANGING THE STATISTICS THAT DISPLAY WHEN CELLS ARE SELECTED

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 10 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Ctrl and Shift

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).

SELECTING RANGES IN LARGE BLOCKS OF DATA CONTAINING BLANK CELLS

In cases where there are blanks in the data, it is helpful to work with a split screen, as shown in the next topic.

Splitting the Screen


The Split button on the View tab, in the Window group, can be used to quickly split the screen both horizontally and vertically.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 11 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

VIEWING THE TOP AND BOTTOM OF A LARGE DATASET SIMULTANEOUSLY

SELECTING RANGES OF CELLS

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 12 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

UN-SPLITTING THE SCREEN

Alternatively, if the screen is split, click the Split button on the View tab to un-split it.

Selecting All Cells in a Dataset Using Shortcut Keys

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 13 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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

Selecting All Cells on a Worksheet


SELECTING ALL CELLS ON A WORKSHEET
The Select All button allows you to quickly select all cells on a worksheet.

Selecting Noncontiguous Ranges

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.

Using the Ctrl Key

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 14 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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

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

USING F8 TO SELECT A RANGE


You might like this technique.

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.

USING SHIFT-F8 TO SELECT A SECOND RANGE


Hitting Shift+F8 puts Excel in Add to Selection mode. In other words, you can

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).

Selecting Cells and Named Ranges

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).

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 15 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

With the F5 Key (Go To Dialog Box)


The function key F5 brings up the Go To dialog box, which can be used to select cells and jump to named ranges. Simply hit F5 and choose the desired range name from the list displayed in the Go
to: box, or enter the desired cell address in the Reference: box.

On the bakery mon-thurs worksheet, use the F5 key to go to cell 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.

Selecting Otherwise Difficult to Select Cells with Go To Special

The Go To dialog box can also be used to select cells that would otherwise be fairly difficult to 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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 16 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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

USING THE AUTOFILL HANDLE AND OPTIONS TO FILL PREDEFINED 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.

DEFINING A SERIES ON THE FLY


Like dates, times can be autofilled, with Excel augmenting the value in each cell by one hour. Unlike with dates, however, the Auto Fill Options will not allow you to change the increment to fifteen
minutes or a half-hour.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 17 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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 . . .}.

USING THE FILL SERIES COMMAND


Another way to create a series like {1, 2, 3 . . .} is to use the Fill Series command. This is especially useful if you often find yourself overshooting the mark when you drag with the mouse.

OTHER PREDEFINED SERIES

CREATING A CUSTOM FILL SERIES


In addition, you can define your own custom fill series. For example, Le Napoleon might want to define a series based on a list of specialty pastries, hourly employees' names, or names of restaurants
that procure dessert offerings from the bakery. Once the series is defined, only one element from the series would need to be entered manually; the rest could be autofilled.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 18 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXERCISES

On the bakery mon-thurs worksheet, edit Question_1 to read Question 1. Fill to complete the series through Question 16.

Select the bakery fri-sun worksheet. In column A, below the Respondent

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).

Copying and Moving Cell Entries


COPY/PASTE OPERATIONS

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.

Alternatively, you can use the move pointer:

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 19 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

The Undo Command


THE UNDO COMMAND
Many operations can be undone using either Ctrl-Z or the Undo button on the Quick Access Toolbar:

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.

Increasing Spreadsheet Readability

It is often the case that the person who designs a spreadsheet application is not the end user, or the only user, of the file. Designing for usability by others is 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.

Working with Rows and Columns

INSERTING AND DELETING ROWS AND COLUMNS

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 20 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

INSERTING AND DELETING ROWS AND COLUMNS


The Insert button and Delete button on the Home tab, in the Cells group, can also be used to insert and delete rows.

On the summary worksheet, insert one row above row 1. Enter the text "Average for questions (5)-(11)" in cell A1.

CONTROLLING ROW HEIGHTS AND COLUMN WIDTHS

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 21 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Rows can be hidden in the same manner.

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.

Making Better Use of Screen Space

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.

CENTERING TEXT ACROSS A MULTI-CELL SELECTION


Cell C2, which helps to clarify questions (6)-(11), is long enough that it causes its column to be considerably wider than the others. This could be remedied by merging cells C2:H2. Merging cells can
interfere with the ability to copy formulas and complete certain other operations. Instead, we will center the text in cell C2 across the range C2:H2. Unlike a merge and center operation, this will allow
Excel to continue to treat cells D2:H2 as individual cells.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 22 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Basic Cell Formatting

CHANGE FONT FACE AND SIZE; FONT AND FILL COLORS

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.

BORDERS AND PATTERNS


Borders and patterns can also be set in the Format Cells dialog box. We will apply borders and patterns to the range on the summary worksheet that contains the averages.

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.

Basic Number Formats

THE CURRENCY STYLE AND INCREASE/DECREASE DECIMALS BUTTONS

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 23 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

OTHER CURRENCY FORMATS


In the Format Cells dialog box, there are other pre-programmed ways of displaying currency values and other types of numbers.

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.

OTHER CURRENCY FORMATS


There are many other ways of displaying values (including date and time values, these being stored as numbers). The table below
presents just a few possibilities for formatting the values 123456789 and .123456789.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 24 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

INTERNATIONAL DATE FORMATS


Le Napoleon's bakers are accustomed to looking at dates in European format, in which the day precedes the month. Every once in a while, the pastry kitchen ends up preparing a special order for the
wrong day—a costly error!

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.

CUSTOM DATE FORMATS


Finally, we can create custom date formats by choosing the Custom category and entering the date format desired. We'll format the date 8/1/2008 so that it reads correctly.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 25 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Many other possibilities exist for custom formatting; this is a good option to keep in the back of your mind!

Conditional Formatting

WITH A STATIC THRESHOLD VALUE

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.

WITH DATA BARS


Also on the summary worksheet, we could use data bars to make it easier to compare at a glance the four averages for question (5) "To the nearest dollar, how much was your order?"

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.

WITH PREPROGRAMMED, DYNAMIC DATE RANGES


First, let's format the dates for orders needed this month with a red style, and the dates for those needed next month with a yellow style.

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...

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 26 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

FOR ABOVE-AVERAGE VALUES


Management might want to see at a glance which order totals are above the average. Conditional formatting has a number of preprogrammed options that compare values in individual cells to the entire
range of cells chosen for formatting.

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:

WITH COLOR SCALES


The time of day that an order is needed can determine whether kitchen staff needs to prepare part of the order the previous day, or come in extra-early that day, or perhaps stay late that evening. We
would like to be able to see at a glance what time an order is due, without risking the kind of mistake that can occur by misreading AM for PM or vice versa.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 27 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

WITH ICON SETS


Finally, let's revisit the formatting that we applied to the order totals. In addition to having all above-average order totals shaded (which we have already done), let's say the kitchen wanted to see at a
glance how critical each order is in terms of revenue.

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.

Increasing Readability Solution

MANAGING CONDITIONAL FORMATTING RULES


Color scales, icons, and data bars have default settings that determine what values will be given what formats. You can change these settings, perhaps choosing a different threshold between a red and a
light red icon, or associating the short end of a data bar with a static value rather than whatever happens to be the lowest number in the range of cells (handy if your dataset contains negative values).

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).

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 28 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

MANAGING CONDITIONAL FORMATTING RULES


If you want to go back and configure an existing rule, select the relevant range of cells, and from the Conditional Formatting menu, choose Manage Rules.

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.

Formatting and Other Options with Paste Special


FORMATTING AND OTHER OPTIONS WITH PASTE SPECIAL

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 29 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Setting Up a Worksheet for Printing

PAGE SETUP OPTIONS

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.

SETTING A PRINT AREA


Now click the File button, and choose Print. By default, Excel will send the entire contents of a worksheet to the printer. Since cells J14 and J15 contain the name and phone number of the group that
designed Le Napoleon's questionnaire, Excel will want to print those cells. However, to do this and still use only one page—as we requested when we configured the Page Setup options—will require
shrinking everything to the point that our averages might become difficult to read.

Instead, let's have Excel print only those cells we want by marking a range on the worksheet for printing.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 30 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

MORE PAGE SETUP OPTIONS


Among other things, the Sheet tab in the Page Setup dialog also allows you to control whether a worksheet's gridlines will print, to repeat the contents of a row or column on each sheet (useful for
printing headers — like our respondent's index numbers, or our question numbers — on every page of a multi-page print job), and to print Excel's column headings (A, B, C, etc.) or row labels on each
page of a multi-page print job.

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:

Each employee's weekly paycheck and the total weekly payroll


The cost of producing various types of cakes
The cost of purchasing sugar, butter, and flour from each supplier as well as the total amount we owe each supplier
The annual profit from the sale of Sacher Tortes, using various price and unit cost scenarios

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

COMPUTING THE WEEKLY PAYROLL BY 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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 31 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

The Autocomplete Formula Option

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.

Entering Formulas by Pointing

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 32 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Use pointing to reenter the formula used to compute our total weekly payroll.

Other Ways to Copy Formulas

COPYING A FORMULA DOWN SEVERAL COLUMNS AND ACROSS SEVERAL ROWS


In the sheet Suppliers of the workbook Excel Formulas.xlsx, we are given the per pound cost of purchasing sugar, butter and flour from our 6 suppliers. We are also given the pounds of each commodity
purchased from each supplier.

In the cell range J9:L14, we want to compute the cost of ordering each commodity from each supplier.

Absolute Addressing

COMPUTING COST PER CAKE

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 33 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Using the F4 Key

TO ENTER $ SIGNS IN A CELL ADDRESS

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.

This would certainly give an incorrect answer.

Hierarchy of Mathematical Operations

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

Rollover the hierarchy on the left see how


each equation below is completed in Excel
EXCEL'S HIERARCHY OF EQUATION 1 EQUATION 2
MATHEMATICAL OPERATIONS =(20+7)/10^(3*2)-1 =20+7/10^3*2-1
Parentheses
Exponents
Division
Multiplication
Addition
Subtraction

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 34 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Editing or Correcting Formulas

Showing the Actual Formula in a Cell

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 35 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Excel Formulas Exercise Solutions

Useful Excel Functions

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 36 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 37 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 38 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

IF Statement Exercise Solutions

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.

USING THE LEFT AND FIND FUNCTIONS


Let's now show how to extract the sales of each product to column G. The key is to find the first space and take everything out of column E that is to the left of the first space.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 39 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

USING THE VALUE FUNCTION


There is a problem, however. Looking at column G we see that all entries are left justified. This means that Excel will treat the contents of these cells as text, not as a number. Thankfully, the VALUE
function allows us to painlessly convert text to a number. Simply put between ( ) the text or cell whose contents you converted to a number.

USING THE RIGHT AND LEN FUNCTIONS


Similar to the LEFT function, the RIGHT function (syntax RIGHT(cell, n)) will grab the right-hand-most n characters from a cell. The LEN function (syntax Len(cell)) returns the number of characters
(including spaces) in a cell. In column D of the sheet Names we are given the names of our employees.

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.

USING THE MID FUNCTION


The MID function is used to extract part of a cell's contents that starts in "the middle" of the cell. The syntax of the MID function is MID(cell, s, n). MID(cell, s, n) would start at character s of the given
cell and extract the next n characters. In sheet Middle we will use the MID function and FIND function to extract each employee's middle name to column.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 40 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Text Functions Exercise Solutions

OTHER TEXT OPERATIONS:


USING DATA TEXT TO COLUMNS TO EXTRACT DATA TO MULTIPLE COLUMNS
Often data comes into Excel from a website or database separated by commas, spaces, or other characters. Using Data Text to Columns, it is easy to parse the data to multiple columns of cells.
Worksheet Text to Columns contains each employee's name in cells D7:D14. Our goal is to place each person's first name in column E, middle name in column F and last name in column G.

OTHER TEXT OPERATIONS:


TWO, FOUR, SIX, EIGHT, HOW DO WE CONCATENATE?
In worksheet email, cells G7:G14 contain each employee's last name. We would like to give each employee an email address by appending @Napoleon.com to the employee's last name. This is easily
done using the & sign which is often referred to as the concatenation operator. Any use of an & sign joins what comes before and after the & sign. If you want to insert text enclose the text in ".

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 41 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXERCISES
In sheet addresses combine the street address, state, and zip code into a single cell.

Text Functions Exercise Solutions

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!

EXTRACTING LAST NAMES


As our first illustration of Flash Fill open up the file FlashfillTemplate.xlsx. This file contains a list of La Petit Bakery employees. Let's use Flash Fill to extract each employee's last name to Column E.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 42 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

CREATING EMAIL ADDRESSES


As our final example of Flash Fill let's create a list of email addresses for our employee. Assume a person's email address is the person's last name followed by @bakery.com.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 43 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Basic Date and Time Functions


ALTERING THE DISPLAY FORMAT FOR DATES AND TIMES

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.

EXTRACTING DATE INFORMATION


Le Napoleon has entered in cells E6:E10 the dates certain cash flows were received. They would like to extract the month, day of the week, year, and day of the month into columns F-I, respectively. The
following EXCEL DATE functions will help us accomplish this goal. For a given date:

MONTH(date) returns the date's month.


WEEKDAY(date,2) returns the day of the week for the date, with 1 = Monday, 2 = Tuesday, ...7 = Sunday.
YEAR(date) returns the date's year.
DAY(date) returns the date's day of the month.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 44 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Date and Time Exercise Solutions

EXTRACTING TIME INFORMATION


Le Napoleon has entered in the range F14:F17 the time 4 employees began their work day. They want to extract the hour, minute and second of the start time. The following EXCEL TIME functions will
help us solve our problem:

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 45 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Date and Time Exercise Solutions

CREATING A DATE FROM DISPARATE DAY, MONTH, AND YEAR DATA


The EXCEL DATE function (syntax DATE(year, month, day of month)) allows us to recreate a date if we are given the date's year, month, and day of month.

CREATING A TIME FROM DISPARATE HOUR, MINUTE, AND SECOND DATA


The EXCEL TIME function (syntax (Time(hour, minute, second))) allows us to recreate a time given the hour, minutes after the hour, and seconds for the given time.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 46 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

DISPLAYING THE CURRENT DATE IN A CELL


There is an easy way to display the current date or current date and time in a cell. Entering the function =TODAY() (maybe this used to be Katie Couric's favorite function!) in a cell enters the current
date, while entering the formula =NOW() displays the current date and time in a cell. Observe in cell B3 that entering =TODAY() ensures that the current data is always displayed in cell B3, while
entering =NOW() in B5 ensures that the current date and time are entered in cell B5.

ABOUT DATE AND TIME FORMATS


Finally, we note that if you format a date as a number or choose the General format, Excel returns the number of days that the given date is after January 1, 1900. Excel gives January 1, 1900, a serial
number of 1, January 2 1900, a serial number of 2, etc. If we format a time as a number, Excel returns the fraction of a day after midnight that the given time occurs. To illustrate, look at the range
D5:G10 of the sheet Number.

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.

Please download files Rangetemp.xlsx and Rangehw.xlsx.

USING THE NAME BOX TO CREATE RANGE NAMES


In the sheet Name Box of Rangetemp.xls, we see our January and February sales. We would like to give cell E5 the range name Jan (for January) and cell E6 the name Feb (for February). We can easily
name these cells using the Name Box (located right above the label for Column A).

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 47 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

USING CREATE FROM SELECTION TO CREATE RANGE NAMES


The worksheet Create from selection gives Le Napoleon's sales in some U.S. cities. We would like to name the actual sales amount in column D with the city name from column C. For example, we
would like cell D4 to be named Los Angeles.

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.

USING THE NAME MANAGER TO MANAGE RANGE NAMES


How can we edit, or delete, range names? Simply use the Name Manager.

NAMING COLUMNS OF DATA AND PASTING RANGE NAMES


INTO FORMULAS WITH THE PASTE LIST BOX
We often analyze data in Excel. If you do not name the data, then you must point to the data each time you use it in a formula. If, for example, our data is in Column A and our formula is in Column Z
then each time we want to create a formula we must move back and forth between Columns A and Z. If we name our data, we never need to point to the data again! In worksheet Quarterly Revenue, we
list our revenue in each city for each quarter of the year. We will name each quarter of data and then compute important statistics for each quarter of sales.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 48 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

PASTING A LIST OF NAMES INTO YOUR WORKBOOK


We can also use the Paste Names dialog box to paste a list of all the workbook's range names into your worksheet.

USING APPLY NAMES TO ENSURE THAT RANGE NAMES SHOW UP IN FORMULAS


Hopefully, you are getting to like range names. You will probably return to spreadsheets you have already worked on and create range names. At first glance, you will probably be disappointed because
the range names will not show up in your formulas. To make sure your range names are used in your formulas, you need to select Apply Names from the drop down arrow in the Name Manager portion
of the Formula tab. Please view the workbook Apply Names in Rangetemp.xlsx. This workbook computes the profit earned from our Sacher Torte. Our formula in cell E7 for profit currently reads as =
(E4-E5)*E3-E6. Using range names we would like to express this formula as =(price-unit_cost)*units_sold-fixed_cost.

EXERCISES

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 49 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Please download file Rangehw.xlsx.

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.

Range Names Exercise Solutions

Lookup Functions

INTRODUCTION

Please download file Lookupstemp.xlsx. Consider the following three problems:


Problem 1: Our unit cost per éclair to a customer depends on the number of éclairs they order as shown in worksheet Vlookup true. Write a formula to determine the unit cost of éclairs for the clients
listed in this worksheet.

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.

VLOOKUP, AND THE TRUE (NULL) ARGUMENT


A VLOOKUP (V stands for vertical) tries to "match" a number or text string in the first column of a range of cells (called the table range). Then we move to a desired column and return the number in
the desired column that is in the same row as the "match." If the first column of the table range is numbers in ascending order, then we use the syntax VLOOKUP(lookup value, table range, column
index).

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.

VLOOKUP, AND THE FALSE ARGUMENT


When the first column of the table range is not numbers in ascending order, then we should use the following syntax for the vlookup function: vlookup(lookup value, table range, column index,
false). The insertion of false ensures that the lookup function will look for an exact match to the lookup value in the first column of the table range. If such an exact match exists, then we pick off the
entry in the column index column of the row in the table range where the lookup value is matched. If there is no match, then the Excel error message #N/A, which means that there is no answer or no
available match, will appear.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 50 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

VLOOKUP Exercise Solutions

Other Lookup & Reference Functions


INTRODUCTION

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 51 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 52 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXERCISES
Write a formula that returns Vanilla éclair sales during April.

Index and Match Exercise Solutions

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.

USING MATCH TO INFORM INDEX


What we want to do now is to write a formula which will return, for any combination of product and month, the sales of the product during the given month. For example, if we enter Pear Charlotte in
cell A18 and February in cell B18, we would like to have a formula that returns the February sales of Pear Charlotte. Our strategy will be to find the row for the product and the column for the month
using the MATCH function. Then we can use the INDEX function to return the actual product sales during the given month.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 53 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Index and Match Exercise Solutions

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.

AN EXAMPLE OF ERROR TRAPPING


Please download the file Errortraptemp.xlsx. This worksheet shows the price for each product as well as the quantity ordered of each product. We want to determine the average total cost of each
ordered product. Once we use a VLOOKUP formula to determine the unit cost for each product, cell G14 would determine the average cost of the orders. The problem is that we have typed in Napoleon
in cell D12 instead of the actual product name Napoleon (piece) so a VLOOKUP formula will yield an error. Suppose we want to ensure that any VLOOKUP which returns an error will have a _ show up
instead of an error message. To accomplish this goal we simply copy from F9 to F10:F13 the formula =IFERROR(VLOOKUP(D9,lookup,2,FALSE),"_"). Note we have also copied the formula
=IFERROR(E9*F9,"_") to G10:G13 to ensure that no error messages show up in column G.

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.

Error Trapping Exercise Solutions

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,

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 54 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

ROUNDUP(3.2,0) returns 4 and ROUNDUP(PI(), 2) returns 3.15.


ROUNDDOWN(number, n) rounds the number down (toward 0) using n significant digits. Using n = 0 results in the number being rounded down to the nearest integer. For example,
ROUNDDOWN(3.2,0) returns 3 while ROUNDOWN(PI(), 2) returns 3.14.
ROUND(number, n) rounds the number to n significant digits. If there is a tie on which number to round to, Excel rounds to the highest number. For example, ROUND(3.5,0) yields 4. Also
ROUND(3.4,0) returns 3 and ROUND(3.6,0) returns 4.
INT(number) rounds the number down to the nearest integer. For example, INT(3.4) returns 3 and INT(-4.7) returns -5.
For positive numbers there is no difference between the ROUNDDOWN and INT function. For example, INT(4.8) = ROUNDDOWN(4.8,0) = 4. For negative numbers, however, the
ROUNDDOWN and INT functions may yield different results. For example, INT(-4.3) = -5 but ROUNDDOWN(-4.3,0) = -4.

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.

ROUNDDOWN AND INT


Now let's suppose when we pay a bill and are 1 full month late (1 month = 30 days) we pay a 5% penalty. If we are 2 full months late, we pay a 10% penalty, and if we are 3 or more months late, we pay a
15% penalty. Given the number of days we are late, we want to write a formula that returns our percentage penalty. Essentially, we need to take DAYSLATE/30 and round it down to the largest integer
<=DAYSLATE/30. Then we can use a VLOOKUP formula to return our percentage penalty. We will show how either the INT function or ROUNDDOWN function can be used to solve this problem.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 55 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Rounding Functions Exercise Solutions

The SUMPRODUCT Function

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 56 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Determine (with a single formula) the total number of cakes produced.


Determine (with a single formula) the total revenue generated by the produced cakes.
Determine (with a single formula) the total cost of buying sugar, butter, and flour from our 6 suppliers.

SUMPRODUCT Exercise Solutions

Modeling Uncertainty in Excel

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 57 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

THE RAND FUNCTION


If you type =RAND() in any cell, you will see a number between 0 and 1.

THE RAND FUNCTION (CONT.)


Suppose Le Napoleon believes there is a 30% chance that demand for Sacher Tortes today will be for 3 tortes, a 50% chance demand for Sacher Tortes will be for 4 tortes, and there is a 20% chance
that today's demand will be for 5 Sacher Tortes. We can use the =RAND() function to generate a random demand for Sacher tortes. Please download the file Randtortestemp.xlsx. The basic idea is to
ensure that if our RAND() value is <.3 we assign a demand of 3 tortes, if our random number is between .3 and .8, then we assign a demand for 4 tortes, and if our random number is >=.8 we assign a
demand for 5 tortes. Then 30% of the time this method generates a demand for 3 tortes; .8 - .3 = 50% of the time we generate a demand for 4 tortes, and 1 - .8= 20% of the time we generate a demand
for 5 tortes.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 58 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Modeling Uncertainty Exercise Solutions

THE RANDBETWEEN FUNCTION


Another useful Excel function for modeling uncertainty is the RANDBETWEEN function. IF a and b are integers and you enter =RANDBETWEEN(a,b) in a cell, then Excel is equally likely to return
any integer between a and b inclusive.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 59 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Modeling Uncertainty Exercise Solutions

Excel Financial Functions


INTRODUCTION

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.

THE TIME VALUE OF MONEY AND NPV


The question is which machine is a better buy. A naíve decision maker might say that Machine 1 is better because the total value of the revenues less costs is $1000, while for Machine 2 this sum is
$760. This reasoning ignores the important concept of the time value of money. It is better to receive $1 now than in the future. Similarly, it is better to pay out $1 in the future than pay out $1 now.
The proper way to evaluate projects which involve cash flows occurring at different times requires us to assign a discount rate (usually between 10% and 20% per year) that incorporates the time
value of money. A discount rate of 10% means $1 received now is equivalent to receiving $1.10 a year from now. Dividing both sides of this relationship by 1.10 we find that $1/1.10 now is equivalent to
$1 received one year from now. Similar logic shows that $1 received 2 years from now is worth the same as receiving $1/1.12 now and in general receiving $1 n years from now is the same as receiving
1/1.1n dollars now, The Net Present Value (or NPV) of a sequence of cash flows simply converts all cash flows to today's dollars by multiplying cash flows received at time n by a factor
1/(1+discount rate)n which puts the cash flows into today's dollars.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 60 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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?

Excel Financial Functions Exercise Solutions

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

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 61 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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?

Excel Financial Functions Exercise Solutions

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

CONDITION 1: PMT WITH END-OF-MONTH PAYMENTS

CONDITION 2: PMT WITH BEGINNING-OF-MONTH PAYMENTS

PMT WITH AN ENDING $30,000 PAYMENT


Finally, let's compute our monthly payment for end-of-month payments when we make an ending payment of $30,000.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 62 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXERCISES
What is the monthly payment (assuming end-of-month payments) on a 30-year $300,000 loan at an annual rate of 8%?

Excel Financial Functions Exercise Solutions

OTHER USEFUL FINANCIAL FUNCTIONS


PV function: computes the value of an annuity.
FV function: computes the future accumulation when a constant sum of money is deposited each period.
RATE function: computes the effective rate given number of payments, size of each payment, and amount borrowed.
NPER function: computes the number of periods required to pay back a loan given the rate, size of payments, and amount borrowed.
IPMT, PPMT, CUMPRINC and CUMIPMT: these functions help us calculate an amortization schedule which determines the breakdown each period between principal and interest.

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

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 63 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

What is the annual depreciation we can charge on a $4000 machine with a salvage value of $500 and a 5-year useful life?

Excel Financial Functions Exercise Solutions

COUNT, COUNTA, and COUNTBLANK Functions

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.

Rollover the function to


see what
cells each functions
COUNT COUNTA COUNTBLANK
counts

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 64 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Count Exercise Solutions

Excel Statistical Functions

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.

SOME BASIC STATISTICS


Please download the file Statisticalfunctionstemp.xlsx. This worksheet contains the amount spent by Le Napoleon's first 14 customers of the day. Let's use Excel's statistical functions to determine

The most money spent by a customer.


The least money spent by a customer.
The 3rd largest amount of money spent by a customer.
The 4th largest amount of money spent by a customer.
How each customer's spending ranks among the 14 customers.
The variance and standard deviation of the amount spent by the 14 customers.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 65 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Excel Statistical Functions Exercise Solutions

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

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 66 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

How many transactions took place in the South?


How many transactions were for exactly 84 units?
How many transactions generated at least $200 of revenue?

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?

Conditional Counts Exercise Solutions

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 67 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXERCISES
How many transactions involved at least 50 units and were completed by Charlene in November for Napoleons?

Conditional Counts Exercise Solutions

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.

Rollover the function to see what it does COST OF


Countif
Sumif ( , ) =$2
Countifs
Sumifs ( , , ,">2")

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 68 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Conditional Sums Exercise Solutions

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 69 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

SINGLE-COLUMN DUPLICATES
Let's begin by obtaining a unique list of products.

EXERCISES

Find a list of salespeople.

Duplicates Exercise Solutions

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!

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 70 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXERCISES
Find each unique combination of Product, Salesperson, and month.

Duplicates Exercise Solutions

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.

SORTING DATA BY VALUE


Please download file Sorttemp.xlsx. Our data is the familiar sales database. Each row shows the product, salesperson, month location, units sold, and revenue for a transaction. As our first example of
sorting, let's sort our sales data so products are listed alphabetically and within each product the transactions are listed in descending order of revenue.

EXERCISES

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 71 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Sort the data so that for each location we see sales of each product listed in descending order of units.

To view solution, download the spreadsheet Sorttempanswers.xlsx.

SORTING DATA BY COLOR


Next let's show how to sort on color. We have highlighted some rows of our data in yellow and other rows in green. Can we sort the data so that the green cells are on top followed by the yellow cells?

EXERCISES

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 72 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Sort the data so that the yellow cells are followed by the green cells.

To view solution, download the spreadsheet Sorttempanswers.xlsx.

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:

All transactions involving tart sales in the east or Midwest


All tart transactions in east or Midwest that involved at least 100 units
All yellow cells

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 73 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Filtering Data Exercise Solutions

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.

STEP 1: SORT THE DATA APPROPIATELY


Let's suppose we want a breakdown of how each Location's sales breakdown by Salesperson. Please download file Subtotalstemp.xlsx. Our file is sorted first by Location and then by Salesperson.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 74 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

STEP 2: ACTIVATE THE SUBTOTALS FEATURE


Next we will activate the Subtotals feature and tell Excel to total Units and Dollars for each salesperson within each region.

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.

USING THE OUTLINE/EXPANDER BUTTONS


Recall that when you create subtotals, the higher the number in the outline, the less aggregated the data.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 75 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Subtotals Exercise Solution 1

Subtotals Exercise Solution 2

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:

Obtain a breakdown of total sales of each product during each month.


For each product, obtain a breakdown of the percentage of sales during each month.
Obtain a listing of our top 10 customers.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 76 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

BASIC PIVOT TABLES ELEMENTS


You create a Pivot Table by placing your cursor within your data in the Data worksheet (the first row of each column needs a heading or label). From the Insert tab, select Tables and then choose Pivot
Table. Then we "drag" the desired columns of our choice to one of the following portions of the table:

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.

CREATE A PIVOT TABLE


First, let's create a pivot table that shows the total dollar sales volume of each product during each month. All we need to do is drag Dollars to the Values section of the table, Month to the Row labels,
and Product to the Column labels.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 77 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

CHANGE THE VALUE FIELD FUNCTION


Perhaps we want to not summarize our data by total revenue, but by average revenue per transaction.

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.

ADDING PERCENTAGE CALCULATIONS


Now let's suppose we want to calculate the percentage of sales for each product that occur during each month. We can do this by using the Value Field Settings dialog box.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 78 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

SLICERS AND FILTERS


A PivotTable can quickly become cluttered when you try and “slice and dice” on many attributes. For example, suppose you want to breakdown sales in the Customers worksheet of the file
Pivottable.xlsx based on Customer, Month and Product. Beginning with Excel 2010 a Slicer can be used to easily slice and dice your data on various attributes. We illustrate the use of Slicers by creating
a Slicer that allows you to filter calculations based on any subset of customers.

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.

(Please refer to pivottabletemp.xlsx for this video.)

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 79 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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 Tables Exercise Solutions

Timeline Exercise Solutions

Pivot Charts

INTRODUCTION TO PIVOT CHARTS

Perhaps you noticed the PivotChart button on the PivotTable Tools Analyze tab:

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 80 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

CREATE A PIVOTTABLE WITH CORRESPONDING PIVOT CHART

CONFIGURE THE PIVOTTABLE AND PIVOTCHART


One difference you will notice when you select the PivotChart option is that when the PivotChart is the active object, the Column Labels and Row Labels areas of the pivot table are now called Legend
Fields and Axis Fields, respectively.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 81 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

MOVING AND EDITING THE PIVOTCHART


Once you have a PivotChart, you can move it and edit it as you would any chart. We will work with charts in the next chapter. For now, we will move the chart out of the way so that we can see the
PivotTable underneath it fully.

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.

DISPLAYING ONLY CERTAIN DATA


The Pivot Table and Pivot Chart are linked; changing the filter on one changes the corresponding filter on the other. Thus, if we want to view sales for January, February, and March for our three éclair
flavors, we can use either the drop-down lists in the Pivot Table or the drop-down lists in the Pivot Chart Filter Pane. We'll use the Pivot Chart Filter Pane.

EXERCISES

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 82 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Pivot Exercise Solutions

ADDING A PIVOTCHART TO AN EXISTING PIVOTTABLE


To add a Pivot Chart to an existing Pivot Table, select the Pivot Table. On the Analyze tab, click the PivotChart button:

Choose the desired chart type, and a Pivot Chart will appear, linked to the existing Pivot Table.

EXERCISES

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 83 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Return to one of the Pivot Tables that you created in exercises (1)-(4) and add a Pivot Chart.

Conditional Formatting: The Formula Option


INTRODUCTION

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.

SIMPLE COMPARISON, PART 1


Please download file Formulasformattemp.xlsx. In the sheet quarterly sales, we see quarterly revenues for Le Napoleon. We would like to highlight in green the quarters in which sales increased and
highlight in red the quarters during which sales decreased. We now show how to format quarters in which sales increased in green.

SIMPLE COMPARISON, PART 2


Next we will show how to ensure that all quarters in which sales decrease are colored red.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 84 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

COMPARISON USING A FUNCTION


Next let's look at worksheet product and region. This worksheet contains the sales of Flans, Tarts, éclairs and Napoleons by region. We would like to highlight in yellow for each product the region with
the largest sales. To do this we need to select the cell range E12:H15, and after selecting the Formula option from conditional formatting, enter a formula that will test whether E12 is the largest number
in its column. We could enter =E12=MAX(E12:E15). This formula will be true if and only if E12 contains the largest sales for Flans. Note, however, if we copy this formula down to cell E13 the formula
becomes = E13=max(E13:E16). Of course, we want this formula to be =E13=max(E12:E15) so we need to $ sign the 12 and 15 in our original formula. We do not dollar sign the E because
when we copy across to say F12 we want the formula to be =F12=max(F12:F15).

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 85 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Conditional Formatting Exercise Solutions

SHOWING ALL CONDITIONAL FORMATS IN A WORKSHEET


When you receive a worksheet from someone else, you might want to show all conditional formats in the worksheet. This can be done by pressing the F5 key (for the Go To dialog box), and then clicking
Special.

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

CREATING A CHART FROM CONTIGUOUS DATA

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 86 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

CREATE THE CHART


To create a chart, first select the relevant data, including necessary clarifying text, and choose a chart type from the Insert tab. The data needed here is on the city quarterly revenues worksheet in the
Charts_creating.xlsx file that you should have downloaded.

HOW EXCEL CREATES THE CHART

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.)

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 87 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

CREATING A CHART FROM CONTIGUOUS DATA


Using the data on the product line worksheet, we would like to create a bar chart that summarizes revenues for our single-serving
items (éclairs and napoleons). The pair of screenshots below shows the dataset (with the source data for the chart shaded) and the
chart that we would like to create from it.

CREATE THE CHART


As you might imagine, in creating a chart from noncontiguous data, we will need to make use of the Ctrl key (or other means of selecting noncontiguous cells). While you can select cells any way you like if
your goal is just to format them, the way in which you select the cells for a chart is important. The video demonstrates what can happen if we aren't careful, as well as how to create the chart that we want.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 88 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

CHANGING AN EXISTING CHARTS TYPE


There are times when you might get halfway through customizing a chart before you realize that a different chart type would support
your argument better. In cases like these, you don't have to start over—you can change a chart's type after the fact.

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.

CHANGE THE CHART TYPE


Changing a chart's type can be done by right-clicking the chart and choosing Change Chart Type from the pop-up menu, or by selecting the chart and clicking the Change Chart Type button on the Design
tab. (This tab is available only when the chart is selected.)

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 89 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXERCISES
Change the chart from the exercise on Page 4 so that it resembles the one shown below.

MORE TROUBLE WITH DATA SECTION


Recall the first chart that we created, the line chart with Quarter 1 - Quarter 4 revenues for Boston, New York, and Baltimore. We'll now create a second line chart on the city quarterly revenues worksheet
using all of the cities in the Midwest region.

For the chart's source data, it 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.

CREATE THE CHART


First, we will try creating the chart using the selection described on the previous tab.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 90 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

As it turns out, we need to include A1 so that the selected ranges have equal widths.

TRY AGAIN, PAYING ATTENTION TO THE WIDTH OF THE RANGES USED


This time, we will take care to select ranges of equal width. This will take care of the problem—but another problem will crop up.

Why does Excel now place the quarters in the legend? Recall that 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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 91 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

USE SWITCH ROW/COLUMN TO CONTROL WHICH SERIES IS PLOTTED ON X AXIS


To move the cities into the legend and the quarters onto the axis, use the Switch Row/Column button on the Design tab.

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

ADDING DATA LABELS AFTER THE FACT


If you've created a chart and started to customize it only to find that you forgot to include labels in your selection, you can add those
labels after the fact.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 92 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

ADD DATA LABELS TO AN EXISTING CHART


We now want to replace the x-axis labels and legend entries with the quarter designations and city names.

Resizing and Moving Charts


RESIZING A 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.

MOVING A CHART ON A WORKSHEET


Still on the product line worksheet, we will move the bar chart to fit under the data.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 93 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

MOVING A CHART TO A DIFFERENT WORKSHEET


If we instead wanted the chart on a different sheet, that's easy to do, too.

You can also select the chart and use the 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.)

Resizing and Moving Exercise Solutions

Basic Formatting of Charts


ADDING AND REMOVING CHART ELEMENTS

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 bar chart on the Sheet4 worksheet


The Boston-New York-Baltimore line chart on the city revenue charts worksheet
The pie chart on the product categories worksheet

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 94 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

The pages that follow show the before and after versions of these three charts and explanations of the changes made.

THE BAR CHART


Our bar chart could be made more appealing by (1) adding a chart title, (2) removing the legend, (3) adding a title to clarify the x-axis,
and (4) removing the vertical gridlines.

MAKE THE CHANGES TO THE BAR CHART

THE LINE CHART


Our Boston-New York-Baltimore line chart (in the city revenue charts worksheet) could be made more appealing by adding a chart
title and adding a title to clarify the y-axis. For the y-axis, we will choose a rotated title to save space and still provide readability.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 95 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

MAKE THE CHANGES TO THE LINE CHART

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 96 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Basic Formatting Exercise Solutions

THE PIE CHART


Looking at our pie chart in the worksheet "product categories," it is clear that tortes are our most important category when it comes to
special orders, but without data labels, it isn't clear whether the data used for the chart represent tens, hundreds, or even thousands
of orders.

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.

MAKE THE CHANGES TO THE PIE CHART

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 97 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Formatting Axes and Data Series

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.)

MAKE THE CHANGES TO THE LINE CHART

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 98 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

FORMATTING DATA SERIES


Refer back to the bar chart on the Sheet4 worksheet (or to the screenshots below), representing March revenues for napoleons and
éclairs, our single-serving products.

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).

MAKE THE CHANGES TO THE BAR CHART

FORMATTING OTHER CHART ELEMENTS


Finally, we'll explore a few other basic formatting options, using the Boston-New York-Baltimore chart on the city revenue charts
worksheet. We'll change the format of the title and y-axis values, and we'll add a border to the legend and a texture to the chart area,
title area, and plot area. Finally, we'll copy and paste the chart and apply one of the preset chart styles.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 99 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

MAKE THE CHANGES TO THE LINE CHART

Pretty much everything on a chart can be formatted—and in a large number of ways!

ADDING A SECONDARY AXIS


You might want to use a secondary axis when charting multiple data series that cannot be compared to each other directly - units sold and revenue is one example. Follow along with the
Secondaryaxistemp.xlsx Excel file.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 100 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Formatting Axes and Data Series Exercise Solutions

ADDING DATA LABELS FROM CELLS


Beginning with Excel 2013, you can add data labels to a chart from a cell range. For this example, please download the file Celllabelstemp.xlsx. You will chart daily sales of Tortes and Napoleons in each city
and add a label for each city.

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.

Follow along with the video using the file sparklines.xlsx.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 101 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Customizing Charts

CHANGING A CHARTS SOURCE DATA

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.

CHANGE THE PIE CHART'S SOURCE DATA

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 102 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXPLODING SEGMENTS OF A PIE CHART


We can't help but notice that while we sold a lot of tortes as special orders, that category isn't doing so well in the bakery. This is
something we'd like to note; after all, these are high-profit items, and they keep longer when compared to fresh fruit tarts, for example.
Selling more of these would certainly help the business. We'll first rotate the pie to call attention to our torte sales, and then pull out
("explode") the torte segment for greater effect.

EXPLODE THE "TORTES" SEGMENT

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 103 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

ADD A TEXT BOX TO A CHART


It might also be useful to annotate the chart, to point out our observation regarding torte sales. To do this, we'll add a text box to our chart.

EXERCISES
Using the data on the product categories worksheet, create a chart that resembles the one shown below.

Customizing Charts Exercise Solutions

INSERTING AN IMAGE INTO A CHART


The last modification we'll make is to add appeal to the chart by means of an image. We'll use a picture of cakes and tarts as a background, in the chart area. We'll also make any formatting changes that the
chart requires, such as adding fill colors, changing font color for visibility, and so on.

When we're finished, our chart will be quite appealing.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 104 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

INSERT THE IMAGE

STORE A CUSTOM CHART AS A CHART TEMPLATE


Now that we have our pie chart just the way we want it, we can save it as a template so that we can easily make other pie charts that follow the same format.

When you save a chart as a template, it is actually stored as a new chart type.

CREATE A NEW CHART USING THE CUSTOM CHART TEMPLATE


One last exercise. We'll test our template by using it to make another chart. To illustrate that the template is not tied to the source data of the chart used to make it, we'll create a pie chart using the template
and a different dataset, on the product line worksheet.

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.

Importing Data into Excel

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

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 105 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

data from a word file be converted into Excel?


Le Napoleon wants to know average family income in various locations. This will aid Le Napoleon in determining where they should build a new bakery. They have found average family income by
state on the Internet. How can they import this data into Excel?

From a Text or Word File

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.

Using Web Queries to Import Data from the Web

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 106 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Knicks Exercise Solution

The Art of Spreadsheet Modeling

WHAT IS A SPREADSHEET MODEL?

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 107 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

SITUATIONS WHERE A SPREADSHEET MODEL MAY BE USEFUL


Here are some examples of situations for which a spreadsheet model might be useful:

Should Le Napoleon open a mall kiosk to sell its products?


What price should Le Napoleon charge for a pastry?
What percentage of revenues should Le Napoleon spend on advertising?
How will Le Napoleon's level of cash on hand fluctuate during a typical month?
How many bakers does Le Napoleon need to hire each year to be able to keep up with projected demand for its products?
What is the value of a typical Le Napoleon customer?
How many flan cakes should Le Napoleon plan on baking each day?
How much should Le Napoleon's manager save for retirement?

Model Building Blocks


OUTPUTS, INPUTS, DECISION VARIABLES, AND CALCULATIONS

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 108 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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!

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 109 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 110 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Model Terminology

PRESCRIPTIVE AND DESCRIPTIVE MODELS

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.

DETERMINISTIC AND STOCHASTIC MODELS


A model in which all inputs and outputs are known with certainty is known as a deterministic model. For example, if we assume we know the unit cost of producing a Napoleon and know with certainty
for any price the demand for Napoleons, it is a simple matter to develop a deterministic model that can be used to find the profit maximizing price for Napoleons. Of course, there is no way we can know
with certainty the demand for Napoleons. Therefore, we could choose to model the demand for Napoleons as an uncertain quantity. This would result in a stochastic model. We will learn about
stochastic models in Unit 11 when we discuss Monte Carlo Simulation.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 111 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

The Spreadsheet Model Building Process

The following steps will often help us build a model:


STEP 1: What do we want to use the model to accomplish?
STEP 2: To accomplish our goal, what output quantities must be computed?
STEP 3: What inputs and decision variables need to be determined in order to compute the needed outputs?
STEP 4: Identify the key logical relationships between our inputs, decision variables, and outputs. In essence, this requires us to determine the calculations or formulas that enable the model
user to turn the inputs and decision variables into output values.
STEP 5: Set up a spreadsheet that uses the logical relationships to relate inputs, decision variables, and outputs.
STEP 6: If the model is prescriptive, use the model to make the key decisions.
STEP 7: Identify the model's limitations. For example, are there any key factors that our model does not consider?

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.

Rules to Guide Intelligent Modeling

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 112 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

SPREADSHEET LAYOUT AND MODEL BUILDING BLOCKS


When setting up a spreadsheet model, spreadsheet inputs and decision variables should never be hard-coded in formulas; inputs and decision variables should always be entered in
their own cells. If an input or decision variable is hard-coded into a formula, then a user of the model cannot easily change the input and see the effects of an input change on model outputs. If a
model input is entered in its own clearly labeled cell, then the user of a model can easily change an input value or decision variable and see how model outputs change. In a multiple worksheet model,
inputs should be placed in a single worksheet. Decision variables can be placed near inputs or given their own worksheet, if possible. In a single worksheet model inputs and decision variables should be
placed in a single area. A common layout structure is to place model inputs and decision variables on the top of a worksheet, followed by worksheet calculations. The model outputs may then be placed
below the calculations or to the right of the model inputs and decision variables.

COLOR CODING THE BUILDING BLOCKS


A spreadsheet model is easier to follow if we use different colors to denote each type of building block. We will use the following color-coding convention:

Yellow for Inputs


Blue for Decision Variables
Orange for Calculations
Gray for Outputs

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.

USE INFLUENCE CHARTS TO HELP UNDERSTAND MODEL RELATIONSHIPS


If you have trouble determining how your spreadsheet inputs and decision variables can be used to calculate model outputs, you can use influence charts to develop an understanding of a model's key
formulas and relationships. For example, we will see that in developing a model of the new bakery decision, we can use an influence chart to determine what quantities must be computed for us to
calculate profit during each year the bakery is operated.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 113 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

USE RANGE NAMES TO MAKE FORUMULAS EASIER TO UNDERSTAND


As we saw in the chapter "Useful Excel Functions," range names can make it much easier to understand spreadsheet formulas. For example, if cell A50 contains a product's price and cell B100 contains
demand for a product, we could determine product revenue with the formula =A50*B100. Using range names, this formula would look something like price*demand, which is much easier to
understand.

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.

USE COMMENTS AND/OR TEXT BOXES TO CLARIFY MODEL LOGIC


Without documentation, a model user may not understand how a complex formula works. You can place comments or annotations in cells to help the user better understand complex formulas. You can
also use text boxes to document formulas. Text boxes do not reside within the same cell as a formula, but you can use an arrow to point from the text box to the cell that is being explained in the text
box.

USE THE COPY COMMAND TO EFFICIENTLY CREATE FORMULAS


With proper use of the copy command, you can enter a formula in a single cell and copy the formula down 1,000,000 rows or across 16,000 columns! This sure beats typing in thousands of formulas.
When copying formulas, make sure your use of absolute and relative addressing (the $ signs discussed in an earlier chapter) is correct.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 114 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

TEST YOUR MODEL FOR SENSE AND SENSIBILITY


Any assumptions we make about model inputs are bound to be in error. For example, if we assume sales at a new bakery will grow 10% per year, they may very well grow 5% a year or even 20% a year.
For this reason, a modeler should always do a sensitivity analysis to determine how sensitive model outputs are to changes in important model inputs. We will learn how to use Excel's data tables and
spinners features to facilitate sensitivity analysis. A data table enables us to easily create a table that shows how multiple inputs vary with a change in a single input or how a single output varies with
changes in two inputs.

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.

DETERMINE CHANGE IN INPUTS NEEDED TO CHANGE THE FINAL DECISION


Suppose our model recommends that Le Napoleon should build the bakery. Basically, this means that if our input assumptions are correct, then the bakery should be built. For our key inputs we can ask
the following question: how much would a key input have to change in value in order for our final decision to change? For example, we may currently be assuming annual sales growth of 15%. For this
value, our model says go ahead with the bakery. We might ask how bad an annual growth rate could be before opening the bakery would be a poor decision. If we found, for example, that if annual
growth is -30% or better we should still build the bakery, we would feel pretty good about going ahead with the bakery. Using Excel's Goal Seek feature, we can easily determine the value of each input
that would make the project NPV = 0. This helps us determine how sensitive our final decision is to changes in each input.

ERROR TRAP YOUR FORMULAS


Often users of a model will enter input values that are unreasonable and cause the spreadsheet formulas to yield error messages or unreasonable results. The considerate modeler has an obligation to set
up the model so users will be informed when they have made an input error. For example, suppose we model Revenue and Units sold as model inputs and we need to calculate price with the formula
=revenue/units_sold. If Units_sold = 0 we will receive an error message.(#DIV/0.) As explained in the "Useful Excel Functions" chapter, we can use IFERROR (or often an IF statement) to inform the
model user of his or her input error. For example, computing price with the formula =IFERROR(Revenue/Units_Sold,"Units sold must be >0") would inform the user of an error if the user enters a
value of units sold<=0. Excel's Data Validation feature (to be covered later in this chapter) can also be used to reduce the frequency of input errors.

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.

USE THE F9 KEY OR EVALUATE FORMULA OPTION TO


UNDERSTAND AND/OR DEBUG COMPLEX FORMULAS
Now, no matter how good you are at Excel, you will often receive spreadsheet models that contain complex formulas that you do not understand. We will see that by highlighting part of a formula and
hitting F9, you can see the value returned by any part of a complex formula. This often helps you better understand how the formula works. You can also use the Evaluate Formulas option from the
Formulas Tab to help you step through a complex formula. If you use Evaluate Formulas and repeatedly choose Evaluate, you will see how Excel evaluates the formula.

SET UP A MODEL TO BE FLEXIBLE


Models need to be flexible so that they can easily incorporate changes. For example, if a model requires sales revenues for products sold by a company, then we should set up the model so products can
be added or subtracted from the list of products. In our bakery model we do not know the number of years for which the bakery will operate, so we should set up the model to easily enable us to vary the
number of years of operation.

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.

USE 3-DIMENSIONAL (3D) FORMULAS IN MULTI-SHEET MODELS


It is not easy to do calculations on a model involving multiple worksheets. If you set up your worksheets in a consistent fashion, however, you can use 3D formulas to perform many calculations of
interest. For example, if each worksheet contains quarterly sales of all your company's products, it is a good idea to always put the sales of a product during a given quarter in the same cell. Then you can
easily use 3D formulas to easily total the sales of each product over all the quarters. 3D formulas are covered in a future chapter.

NOTE THE MODEL'S SHORTCOMINGS AND LIMITATIONS


It is important to understand a model's limitations. For example, in modeling whether or not we should open a new bakery, many inputs such as annual sales growth rate are not known with much

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 115 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

UNDO IS YOUR FRIEND!


We all make mistakes. When you make a mistake select Undo (Control + Z) ASAP, to undo it!

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.

Let's use the model-building process to help get us started.

STEPS 1-2 OF THE MODEL-BUILDING PROCESS


STEP 1: What do we want to use the model to accomplish?

We want to determine whether or not Le Napoleon should open the new bakery.

STEP 2: To accomplish our goal, what output quantities must be computed?

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 116 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

STEP 3: DETERMINING THE DECISION VARIABLES


STEP 3: What inputs and decision variables need to be determined in order to compute the needed outputs?

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.

THE BUILDING BLOCKS OF AN INFLUENCE CHART


Recall that Step 4 of the model-building process is to identify the key logical relationships between inputs, decision variables, and outputs. We will use influence charts to help us identify the model
inputs as well as how the inputs and decision variables can be used to calculate the bakery's NPV.

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 hexagon is used to represent the model output.

An oval is used to represent other outputs.

A triangle is used to represent an input value that is known with certainty.

A rectangle is used to represent a decision variable.

A double circle is used to represent an input that is stochastic or not known with certainty.

USING ARROWS TO LINK INFLUENCE CHART BUILDING BLOCKS


Arrows are used to represent the relationships between various quantities. For example, the following diagram would indicate that the computation of profit requires knowledge of revenue and Total
Cost.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 117 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

WHAT DETERMINES THE BAKERY'S NPV?


Please download the file Influencechart.xlsx.

We will now use an Influence Chart to determine the quantities needed to compute our model output (bakery NPV).

MODELING BAKERY BUILDING COST AND DISCOUNT RATE


We will assume an annual discount rate for profits of 15%. This means that $1 of profit earned a year from now is equivalent to $1/1.15 earned now. In modeling bakery building costs (call it BBC) as a
function of the annual capacity x of the bakery (call it x = number of pastries that can be baked per year), it is tempting to assume BBC=kx. Usually, however, the cost of building is made up of a fixed
cost plus a per-unit cost. We will follow this route and assume BBC = 400,000+3x. That is, there is a fixed cost of $400,000 incurred in building a bakery and a cost of $3 per unit of pastry capacity. If
you believe that there is a diminishing cost of adding each unit of capacity you might try a model of the form BBC=Fixed cost + kxb , where 0< b< 1. This will ensure that each additional unit of capacity
will incur a smaller cost.

DEVELOPING AN INFLUENCE CHART FOR ANNUAL BAKERY PROFITS


We now need to figure out how to compute annual bakery profits. Let's use an influence chart to help us determine how to compute annual bakery profits.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 118 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

USING AN INFLUENCE CHART TO IDENTIFY INTERTEMPORAL RELATIONSHIPS


We need to realize that Year t + 1 demand and Year t + 1 unit cost are related to the values of these quantities during the prior year. The following influence charts shed light on the nature of these
relationships.

CALCULATING EACH YEAR'S DEMAND


We know that each year's price is a decision variable. To simplify our model we will assume Le Napoleon assigns a Year 1 price and thereafter price grows by the same percentage (5%) each year. Initially
we will assume a Year 1 price of $3.00. For simplicity, we will assume each year's demand is a linear demand curve of the form Year 1 demand = a - bp. This is probably unrealistic because if price is
sufficiently large this equation predicts negative demand. Despite this fact, many analysts utilize a linear demand curve. Many analysts assume demand = ap-b. This is called the power or constant
elasticity demand curve.

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.

MODELING UNIT COST OF PRODUCING A PASTRY


We will simply assume a given unit cost for the first year of sales ($1.50 during year 2013). Then we assume that each year unit cost grows at the same rate (assumed to be 6%). We note that costs
usually are assumed to grow at a faster rate than prices, and our choice of input parameters reflects this view of the world.

MODELING THE TIMING OF THE CASH FLOWS


We will assume that all construction costs are paid on 1/1/2012. Sales are assumed to begin on 1/1/2013. At what date should we book all profits for a given year, say 2013? Since profits are earned
throughout the year, it seems reasonable to "book" our profits for any year at the year's midpoint. Therefore we will assume the bakery's profits for any year are all received on June 30 of that year. Then
we will use the XNPV function (see Chapter 5) to compute the NPV of the profits received by the bakery.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 119 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

STEP 4: IDENTIFYING THE MODEL'S KEY RELATIONSHIPS


From our influence charts we can identify the following key relationships:

Year t Profit = Year t Revenue - Year t Total Cost


Year t Revenue = (Year t units sold)*(Year t Price)
Year t Units Sold = Minimum (Capacity, Year t Demand)
Year t + 1 Demand = (Year t Demand)*(Year t + 1 Demand Growth rate)
Year t + 1 Unit Cost = (Year t Unit cost)*(Year t + 1 Unit Cost 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?

Set up the Spreadsheet Model

ENTERING INPUTS AND DECISION VARIABLES

Please download the file Copy of Data Table.xlsx.


To begin the set up of our spreadsheet model, we will enter our estimates for input parameters and decision variables.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 120 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

ENTERING THE SPREADSHEET FORMULAS


By making judicious use of range names and copying, we may easily enter the spreadsheet assumptions into our spreadsheet. We will hide the columns for years 2019-2021, so we can see both the first
and last years of our model.

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.

SETTING UP A ONE-WAY DATA TABLE FOR NPV VS. PRICE


Let's suppose that Le Napoleon is considering a pastry price between $3 and $8 during 2013.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 121 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

CONSTRUCTING THE ONE WAY DATA TABLE

INTERPRETING THE DATA TABLE OUTPUT


Our table shows that a maximum NPV of $2,577,883 is attained by charging a price of $4.50. We used the Highlight Cells conditional formatting option to highlight in red the largest NPV value. This is
useful because if we change other inputs or decision variables, then the red formatting will still indicate the NPV maximizing price.

EDITING A DATA TABLE


You cannot delete or edit a portion of a data table. Try and delete the contents of any cell in the data table and you will find you cannot delete the contents of the cell. If you select the table range and
right-click and select Paste Special and then choose Values, you lose the data table structure but you can delete the contents of the cell(s) or edit their contents.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 122 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

DATA TABLES AND SPREADSHEET CALCULATION OPTIONS


Some of you who have tried to duplicate our work may have been disappointed to find that all the computed quantities in the data were the same. If this is the case, simply hit F9 (the recalculate key)
and you will see the correct output values computed. The method in which Excel fills up a data table depends on the calculation mode you choose. By selecting Calculation Options from the Formulas
tab, you may choose from one of the following calculation options: Automatic, Automatic Except for Tables, and Manual. We now give a brief explanation of each of these calculation options.

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.

Data Tables Exercise Solutions

Two-Way Data Tables

INTRODUCING TWO-WAY DATA TABLES

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.

ENTERING INPUT VALUES AND OUTPUT FORMULA

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 123 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

CONSTRUCTING THE TWO-WAY DATA TABLE


To finish constructing the two-way data table, we select the table range (the range containing the values of inputs, the output formula, and the cells where we will compute NPV values for each
combination of inputs). Then we select the row and column input cells for the data table and we are done!

USING THE TWO-WAY DATA TABLE TO TEST FOR SENSIBILITY


Earlier in the course, we described using the Conditional formatting Formula option to highlight in yellow for each unit cost the NPV maximizing price. We see that as the unit cost increases to $2.00 or
higher, the NPV maximizing price jumps from $4.50 to $5.00. Common sense tells us that cost increases are passed on to customers, so our model passes this test of sensibility. Each row of the data
table shows that as costs increase, NPV decreases. Again that is a sensible result.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 124 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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).

Two-Way Data Tables Exercise Solutions

Goal Seek

USING GOAL SEEK TO TEST FOR SENSIBILITY

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 125 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

THE GOAL SEEK DIALOG BOX


We bring up Goal Seek by selecting What If Analysis from the Data Tab and then choosing Goal Seek. The Goal Seek Dialog box will occur and we will need to fill in the following inputs:

Set Cell: The 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).

GOAL SEEK IN ACTION

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 126 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

EXERCISE
For the file kioskexample.xlsx determine the level of annual demand needed for the kiosk to earn $100,000.

Goal Seek Exercise Solutions

Auditing

USING THE AUDITING TOOL TO BETTER UNDERSTAND A MODEL'S LOGIC

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.

USING THE TRACE DEPENDENTS AUDITING COMMAND

USING THE TRACE PRECEDENTS AUDITING COMMAND


Suppose that we receive a spreadsheet and we are not sure what inputs or decision variables are needed to complete a calculation. By selecting Trace Precedents, we can find all inputs and decision
variables that are needed to complete a calculation. To illustrate the use of Trace Precedents, let's determine what inputs are needed to compute our 2014 Revenue.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 127 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

AUDITING MULTI-SHEET MODELS


When we receive a multi-sheet workbook, we might cringe in fear because it is difficult to determine how things fit together. The Auditing Tool can often be used to decode the logic used in a multi-sheet
workbook. Please download the file Audittwosheets.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.

Please download the file Copy_of_flexible.xlsx.

MAKING NUMBER OF YEARS OF OPERATION A MODEL INPUT


We will now modify our model so that we can vary the number of years of operation for the bakery up to 20 years. The 20th year of operation would be 2032 so we selected the cell range M17:N18 and
copied this range to the range O17:X18. This adds the numbers 11, 12, 20 to row 17 and adds to row 18 the midpoints of each year through the last possible year of operation 2032. Next we will move to
the cell containing our NPV calculation B29 and change the formula to ensure that all profits through 2032 (if any) will be picked up in our NPV calculation.

CUTTING OFF PROFITS AFTER BAKERY CLOSES!


We now enter in cell D16 the number of years the bakery will operate. Using Create from Selection, we named this cell Years_of_Operation. Clever use of IF statements will ensure that no profit is
earned when the bakery is not being operated. Basically we will enter in rows 20-25 of Column a formula that enters the phrase No operation after the bakery ceases operations. Then in row 27 we will
ensure profit is $0 after the bakery ceases operation.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 128 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Comments and Text Boxes

ANNOTATING THE WORKSHEET WITH COMMENTS AND/OR TEXT BOXES

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.

REMARKS ABOUT COMMENTS


The following tips will help you manage your comments:

Selecting Edit Comment lets you edit a comment.


Selecting Delete Comment lets you delete a comment.
Selecting Show/Hide Comment allows you to toggle between showing and hiding a comment.
Selecting Show All Comments allows you to toggle between showing all comments and hiding all comments.
To control the printing of comments, select the Page Layout tab and click on the small arrow beneath Print titles. The Page Setup dialog box will appear. From the Sheet tab, clicking on
Comments allows you to choose one of the following options:

1. Print comments as they appear on the worksheet.


2. Print all comments at the bottom of the sheet.
3. Print the worksheet so no comments print.

USING A TEXT BOX TO DOCUMENT A MODEL


After inserting a rectangle shape in a spreadsheet, we may type in the "text box" some text to document a cell and use an arrow to point to the cell.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 129 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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

ERROR TRAPPING YOUR FORMULAS

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.

PREVENTING NEGATIVE YEAR 1 DEMAND


In cell E21 we will modify our formula for year 1 demand to ensure that negative demand cannot occur.

ENSURING YEARS OF HIGH GROWTH + 1 <= YEARS OF OPERATION


In cell D8 we enter years of high growth. In cell B8 we will enter a formula that will warn the user if Years of High Growth > Years of Operation.

USING DATA VALIDATION TO ENSURE YEARS OF OPERATION CANNOT EXCEED 20


We will now use Excel's Data Validation feature, to ensure that the user can only enter in cell D16 a value for years of operation between 5 and 20. To use Excel's Data Validation feature select the range
of cells for which you want to create a validation criteria. Then simply specify the criteria. For example, cell D16 must contain a whole number between 5 and 20. As long as the entered value meets the
validation criteria, things are fine. If the entered value does not satisfy the validation criteria, the user will be greeted by an error message.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 130 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Using F9 and Evaluate Formula Feature

USING F9 AND EVALUATE FORMULA FEATURE TO BETTER UNDERSTAND COMPLEX FORMULAS

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

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 131 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

neat Excel feature — the Data Validation drop down box — to allow the user to enter the scenario name.

ENTERING THE SCENARIOS INTO THE SPREADSHEET


To begin, we type the scenario names and input parameter values in the cell range H8:N11. Note we used word wrap so the headings for each input wrap around the cell. Then we recopied the NPV
calculation to cell D2 so the NPV can be easily viewed with the input parameters. We named the range H9:N11 Lookup to facilitate the entry of our formulas.

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.

MAKING THE DEVELOPER TAB VISIBLE


Before inserting spinners in our worksheet, you will need to configure Excel so you can see the Developer tab on the ribbon.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 132 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

BRINGING UP THE FORM CONTROLS TOOLBAR


Next, we need to bring up the list of Form Controls, from which we can select a spinner.

DRAGGING SPINNERS TO THE WORKSHEET


Let's suppose that we want to create a spinner that allows us to vary in cell D16 years of operation between 5 and 20 years. Let's also create a spinner that allows us to easily vary the Beginning growth
rate in cell D9 between 0% and 50%. To begin, we will select the spinner control and drag a spinner to cell E16.

ACTIVATING SPINNER FOR YEARS OF OPERATION


Next we will "activate" the spinner so it controls cell D16. Let's assume that we want to vary Years of Operation between 5 and 20, in increments of 1 year.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 133 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

ADDING A SPINNER TO CHANGE BEGINNING GROWTH RATE


You might think that if "you have seen one spinner you have seen them all." Linking a spinner to cell D9, however, is a little tricky. Let's suppose that our beginning growth rate in demand (which is
entered in cell D9) should be allowed to vary between 0% and 50% in 1% increments. What makes this tricky is that the minimum increment on a spinner is 1, not .01. To work around this problem, we
link the spinner to cell F9 and in cell D9 enter the formula =F9/100. Now we can set the spinner in E9 so that cell F9 varies from 0-50 in increments of one. This will cause cell D9 to vary between
0 and 50 in increments of .01.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 134 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Model Limitations Exercise Solutions

Using Excel Solver


SOLVER

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:

What product prices maximize a company's profit?


What production schedule minimizes the cost of meeting demand on time?
What is the cheapest way to ship Budweiser beer from the place of manufacture to the local liquor stores?
What asset allocation for retirement (between bonds, US stocks, Emerging Market stocks, real estate, and commodities) incurs the least risk for a desired level of expected return?

Please download file Solver.xlsx.

Solving Optimization Problems

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 135 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

INSTALLING THE SOLVER ADD-IN


To begin, we must install the Excel Solver. Click on the File tab in the upper left-hand portion of the Ribbon. Then choose Excel options and choose Add-Ins.

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!

THE SOLVER DIALOG BOX


A Solver model has three parts, specified in the Solver dialog box.

Rollover items below


for more information:

• Set Objective

• By Changing Variable Cells

• Constraints

EXAMPLES OF IDENTIFYING PARTS OF SOLVER MODELS


Let's try to identify the three parts of the relevant Solver model for some of our previous examples.

Rollover items below for more information:

If our goal is to determine prices that maximize profit then...

If our goal is to find that a production schedule that minimizes the cost of meeting
demand on time then...

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 136 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

Objective: Total Profit from all productsSum of production and holding costs

Variable Cells: Price of each product.Each month's production.

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.

Developing a Solver Model


INTRODUCING THE PROBLEM

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.

IDENTIFYING THE THREE PARTS OF THE SOLVER MODEL


Le Napoleon's goal is to determine the quantity to produce of each product that will maximize its daily profit. Let's now identify the three parts of this Solver model.

Objective: Maximize daily profit.


Variable Cells: How many of each product must be produced? A fractional number of a product is not acceptable.
Constraints: Do not make more of a product than customers are willing to buy. Also, we cannot use more baker time, flour, or sugar than what we have available. We will also need to tell
Solver that the number of units made of each product is non-negative.

UNDERSTANDING THE CONCEPT OF FEASIBLE SOLUTION(S)


Any set of values for our variable cells that meets the problem's constraints is called a feasible solution. Solver finds a set of feasible variable cell values that optimize the objective; that is, no set of
variable cell values that meets the constraints can find a better objective value. For our Solver model, Solver will find an optimal objective value of $831.20. This means that no set of variable cell values
that satisfy the constraints can yield a profit larger than $831.20. There may be more than one set of variable cells obtaining the optimal profit of $831.20, but we cannot tell after running Solver
whether or not the set of variable cells attaining the optimal objective value is unique.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 137 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

SETTING UP THE PROBLEM:


VARIABLE CELLS AND OUTPUTS AS A FUNCTION OF VARIABLE CELLS
What must we track in our spreadsheet to set up our Solver model?

We must track profit as a function of our variable cells.


We must track profit because profit is our objective.
We must track the baker time used, sugar used, and flour used as a function of our variable cells in order to see if our constraints on available baker time and flour and sugar availability are
satisfied.

SETTING UP THE PROBLEM: THE OBJECTIVE


Next we will compute the objective value corresponding to our variable cell values. Our profit may be computed as

(Napoleons produced)*(Unit profit per Napoleon) + (Chocolate éclairs produced)*(Unit profit per Chocolate éclair) + ...(Tahiti cakes produced)*(Unit profit per Tahiti Cake).

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 138 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

SETTING UP THE PROBLEM: FORMULAS TO BE REFERENCED IN CONSTRAINTS


In cells E3:G3 we have entered the amount of baker time (in minutes) and flour and sugar (in ounces) that are available. For example, we have 5 workers working 480 minutes per day, so we have 2400
minutes of baker's time available. Next we will compute our usage of baker time, flour and sugar. Again, we will use Excel's wonderful SUMPRODUCT function.

Configuring Solver to Solve the Problem

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.

FILLING IN THE SOLVER DIALOG BOX: OBJECTIVE


We are now ready to enter the target cell, changing cells and constraints for our model.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 139 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

FILLING IN THE SOLVER DIALOG BOX: VARIABLE CELLS


Next, we will enter our range of changing cells (B5:B18).

FILLING IN THE SOLVER DIALOG BOX: DEMAND CONSTRAINTS


Next, we will enter our constraints in the Solver window.

FILLING IN THE SOLVER DIALOG: RESOURCE CONSTRAINTS


Next, let's ensure that we do not use more resources than we have available.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 140 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

FILLING IN THE SOLVER DIALOG BOX: INTEGER CONSTRAINT


Next, we need to ensure that the number of units produced of each product is an integer. After selecting the range of cells that we desire to be integer, we simply select INT to ensure that Solver will only
consider integer values of these variable cells.

CONFIGURING SOLVER OPTIONS:


ASSUME NON-NEGATIVE AND ASSUME LINEAR MODEL
Before telling Solver to look for an optimal solution to our model, we need to look at two settings. First, uncheck the "Make Unconstrained Variables Non-Negative" check box. Then, from the Select
Solving Method dropdown, select Simplex LP.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 141 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

ASSUME LINEAR MODEL


In a Solver model the objective cell and variable cells are created by adding together terms of the following form

(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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 142 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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?

Solver Exercise Solutions

Three-Dimensional Formulas, the Table Feature and Circular References

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 143 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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

WHAT IS A THREE-DIMENSIONAL FORMULA?

Please download the workbook 3D.xlsx.


In this section we will begin by learning how to create three-dimensional formulas. Three-dimensional formulas let you easily combine data from multiple worksheets. For example, we will show how to
combine Le Napoleon's monthly sales (listed in individual worksheets) in a consolidated worksheet which gives total sales for each product.

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.

ENTER PRODUCT NAMES


Next, we will enter the product names in cells I5:I18 of the consolidated worksheet.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 144 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

USE A THREE-DIMENSIONAL FORMULA TO SUM ACROSS WORKSHEETS


Next we will use a three-dimensional formula to add up the five monthly sales values for each product. Our formula for chocolate éclairs, for example, will look like =SUM(Jan:May!J6). This will tell
Excel to add up cell J6 for all worksheets in the workbook between the Jan and May worksheets (inclusive).

EXERCISES

In the file 3D.xlsx determine the total sales of each product during the months February through April.

Three-Dimensional Formula Exercise Solutions

Using the Excel Table Feature


THE TABLE FEATURE

Please download the file Table.xlsx.


In this section we will discuss Excel's Table feature. Most of the time when we start developing a spreadsheet, we enter data with each row representing data. For example, we might enter sales of each
product in a different row. Then we usually add new data to the bottom of the spreadsheet and perhaps add formulas to the right of our data to analyze the data. Usually we have to scramble and
manually change our formulas or graphs to include the new data. We may also choose to extend the formatting used for the original data to the new data.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 145 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

CREATE A TABLE FROM A DATASET


To illustrate the use of the table feature, consider the worksheet data which gives the revenue from each of Le Napoleon's products. Let's make this data a table and create a formula that adds up total
revenue.

ADD A NEW ROW OF DATA TO THE TABLE


Now, let's add a new row of data to the table and show that our total revenue automatically updates to include the new data.

ADD A NEW COLUMN TO THE TABLE


Now, let's see what happens to a table when we add a formula to the table. In column H of sheet new formula we will use the rank function to determine the ranking of each product's sales.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 146 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

IMPLICATIONS FOR CHARTING


In worksheet Original graph we graph monthly sales at Le Napoleon. With this setup, adding new data will not cause the new data to be included in the graph. Then in worksheet Graph new Data we
will show how to graph the data so that new data will automatically be included in the graph.

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!

CREATE A CHART BASED ON A TABLE


Associating a table with our data before we create the graph ensures that new data added to the bottom of the spreadsheet will automatically be included in the graph.

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 147 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Excel Table Feature Exercise Solutions

Circular References

WHAT IS A CIRCULAR REFERENCE?

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.

RESOLVING CIRCULAR REFERENCES


It is easy to have Excel resolve circular references. Simply click File, then Options, and choose Formulas. Then simply check Enable Iterative Calculation and your circular references will be
automatically resolved! This setting will be saved when you save the workbook. Let's now look at a simple example of how circular references can be useful in solving business problems.

AN EXAMPLE OF CIRCULAR REFERENCES

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 148 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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?

HOW DID EXCEL RESOLVE THE CIRCULAR REFERENCES?


When we set up our spreadsheet we created the following relationships:

(Cell E8 value) = .1*(Cell E10 value)

(Cell E9 value) = Revenue - Costs - (Cell E8 value)

(Cell E10 Value) = .4*(Cell E9 value).

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?

Circular Reference Exercise Solution

Monte Carlo Simulation

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 149 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

Uncertainty and Monte Carlo Simulation


UNCERTAINTY IN BUSINESS

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: The Key to Monte Carlo Simulation

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 150 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

DISCRETE RANDOM VARIABLES


For our purposes, a random variable is discrete if the random variable assumes an easily listed set of values. Here are some examples of discrete random variables. The probability of each value of a
discrete random variable must be non-negative, and the sum of the probabilities of all possible values must equal 1.

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.

MODELING A DISCRETE RANDOM VARIABLE IN @RISK


With @RISK we can use the RISKDISCRETE function to model a discrete random variable. For example, if our spreadsheet is set up as follows,

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.

CONTINUOUS RANDOM VARIABLES


A random variable is continuous if it can assume all possible values on some line interval. For example, a company's market share is a continuous random variable because market share can assume any
value between 0 and 1. Some other examples of continuous random variables are

Annual sales growth


A randomly selected person's height
A randomly selected person's weight
Price of a product
Fixed cost of developing a product
Price of a gallon of gasoline in a year
Value of Euro (in dollars) in a year

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

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 151 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

MODELING A CONTINUOUS RANDOM VARIABLE


So how can we model a continuous random variable? We model a continuous random variable by defining a probability density function (pdf) for the random variable. A pdf is simply a non-
negative function whose value for a given number describes the relative likelihood of the random variable assuming a value near x. The area under a pdf between x and y is the probability that the
random variable assumes a value between x and y. The total area under a pdf must equal 1. In our development we will use two simple continuous random variables: the Uniform and Triangular
random variable.

CONTINUOUS RANDOM VARIABLES: THE UNIFORM DISTRIBUTION


A Uniform random variable (written U[a, b]) is simply a random variable that is equally likely to assume any value between a and b. For example, if the daily demand for Napoleons is equally likely to be
anywhere between 50 and 200 Napoleons, then our density for the demand for Napoleons would look as follows:

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.

CONTINUOUS RANDOM VARIABLES: THE TRIANGULAR DISTRIBUTION


In most situations, all values of a continuous random variable are not equally likely, and we must use a random variable other than the Uniform random variable to model an uncertain quantity. Due to
its simplicity, the triangular random variable is by far the most used random variable in Monte Carlo modeling. To illustrate the use of the triangular random variable, let's suppose we want to model the
market size for a new pastry. All we do is estimate the lowest possible market size (say 40,000 units per year), the most likely market size (say 60,000 units per year), and estimate the largest possible
market size (say 70,000). Then we create a PDF for market size simply by constructing a triangle starting at the lowest market size of 40,000. The height of the density increases along a straight line
until we hit the most likely value of 60,000 units. Now we make the triangle slope down until it hits the x-axis at 70,000 units. The maximum height of the triangle is scaled so the total area under the
PDF is 1. (See graphic.)

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

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 152 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

For each of these quantities, determine whether it should be modeled by a discrete or continuous random variable:

3-Month Treasury bill rate in 6 months


Half-gallons of milk sold by a supermarket
Number of hearts in a bridge hand
Number of competitors a company has in a given market
Unit cost of producing a product

Using @RISK to Simulate a New Product Introduction

INTRODUCING THE PROBLEM

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.

SOME BASIC @RISK SETTINGS:


RANDOM/STATIC AND AUTOMATICALLY SHOW GRAPH
To begin, we launch @Risk by either clicking on the @Risk icon on the desktop, or searching for @Risk in the Windows program search box (or in the list of installed programs, under Palisade Decision
Tools) and selecting the @Risk program. An @Risk tab will be added to the Ribbon. Begin by clicking the @Risk tab. You will then see a variety of icons. First we click on the Random/Static icon until it
is red.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 153 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

REPRESENTING THE UNCERTAINTY VALUES


Please download the file Simnewproduct.xlsx. Note we named the cells D5:D13 with the names listed in C5:C13.

COMPLETING THE SPREADSHEET MODEL


We will now model units sold, revenue, variable cost, and profit at end of year (revenue - variable cost - fixed cost). We will round off the units sold so a fractional number of units cannot be sold.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 154 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

INTERPRETING THE RESULTS


We find that on average we make $25,560. If we move the left-hand slider to 0, we can find the probability of losing money to be only 13%.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 155 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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?

Monte Carlo Exercise Solution 1

Monte Carlo Exercise Solution 2

Monte Carlo Exercise Solution 3

Final Exam Introduction

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 156 of 157


Spreadsheet Modeling 13/06/24, 11:20 PM

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.

https://eproduct.hbsp.harvard.edu/eproduct/product/spreadsheet_2013_v2/content/index.html Page 157 of 157

You might also like