0% found this document useful (0 votes)
104 views156 pages

Tips &amp Tricks For Excel-Based Financial Modeling A Must For Engineers &amp

Tips & Tricks for Excel-Based Financial Modeling A Must for Engineers &

Uploaded by

chayanitak
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)
104 views156 pages

Tips &amp Tricks For Excel-Based Financial Modeling A Must For Engineers &amp

Tips & Tricks for Excel-Based Financial Modeling A Must for Engineers &

Uploaded by

chayanitak
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/ 156

d Finance and Financial

MIAN

Management Collection
ysts, John A. Doukas, Editor

ncepts
Excel™
TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING, VOLUME II

utilize
ire the
on it. It
e art of
Tips & Tricks
macros, for Excel-Based
Financial Modeling
y used,
nctions
is not
o show
tomate
A Must for Engineers &
se who
project/
Financial Analysts
e in the
Volume II
panies
working
g and
rojects.
for the
rojects,
plants,
project
vanced
M. A. Mian
ourses
subject
thor of
hanical
mineral

48-6
Tips & Tricks for
Excel-Based Financial
Modeling
Tips & Tricks for
Excel-Based Financial
Modeling
A Must for Engineers &
Financial Analysts

Volume II

M. A. Mian, PE
Tips & Tricks for Excel-Based Financial Modeling: A Must for Engineers &
Financial Analysts, Volume II

Copyright © Business Expert Press, LLC, 2017.

All rights reserved. No part of this publication may be reproduced,


stored in a retrieval system, or transmitted in any form or by any
means—electronic, mechanical, photocopy, recording, or any other
except for brief quotations, not to exceed 400 words, without the prior
permission of the publisher.

First published in 2017 by


Business Expert Press, LLC
222 East 46th Street, New York, NY 10017
www.businessexpertpress.com

ISBN-13: 978-1-63157-948-6 (paperback)


ISBN-13: 978-1-63157-949-3 (e-book)

Business Expert Press Finance and Financial Management Collection

Collection ISSN: 2331-0049 (print)


Collection ISSN: 2331-0057 (electronic)

Cover and interior design by Exeter Premedia Services Private Ltd.,


Chennai, India

First edition: 2017

10 9 8 7 6 5 4 3 2 1

Printed in the United States of America.


Abstract
The purpose of this work is to show some advanced concepts related to
Excel based financial modeling. Microsoft ExcelTM is a very powerful tool
and most of the time we do not utilize its full potential. Although not
very difficult to use but it needs practice and continuously striving to
use the full potential of Excel. Of course, any advanced concepts require
the basic knowledge which most of us have and then build on it. It is
only by hands-on experimentation that one learns the art of constructing
an efficient worksheet. It is hoped that the examples herein will aid the
reader to develop his or her own worksheets using advanced concepts.
The biggest advantage of Excel is that it is not a black box, especially
if you have built the model yourself rather than working with somebody
else’s model. The basic requirement for most financial modeling is to keep
them simple so anyone can look at it can easily figure out how most of the
calculations are performed.
The two volumes of this book cover dynamic charting, macros, goal
seek, solver, the routine Excel functions commonly used, the lesser known
Excel functions, the Excel’s financial functions, and so on. The introduc-
tion of macros in these books is not exhaustive but the purpose of what
is presented is to show you the power of Excel, and it can be utilized to
automate most repetitive calculations at a click of a button.
For those who use Excel on a daily basis in financial modeling and
project/investment evaluations, this book is a must. It contains a wealth
of practical examples, tips, new techniques all designed to help quickly
exploit and master Excel to its full advantage and therefore use spread-
sheets more effectively in your jobs.

Keywords
advance Excel, Excel based financial modeling, financial modeling, invest-
ment evaluation, investment evaluation modeling, Microsoft ExcelTM,
project economics
Contents
Preface ..................................................................................................ix

Chapter 1 Creating Dropdown Lists ..................................................1


Chapter 2 Using Excel’s Data Tab ....................................................29
Chapter 3 Presenting Information Using Charts ..............................77
Chapter 4 Automating Worksheets ................................................113

About the Author ................................................................................135


Index .................................................................................................137
Preface
In this Volume 2 of the book, we continue with other important use of
Excel in Financial Modeling. Six chapters were presented in Volume 1,
followed by four more chapters in this volume. Both volumes comple-
ment each other.
As mentioned in Volume 1, this book is an outcome of teaching
“Project Economics, Risk and Decision Analysis” course to more than
800 participants since 2006. The course is computer based where prob-
lems are solved using Excel. It is observed during these courses that a
majority of the participants really struggle with the correct and efficient
use of Excel in solving problems.
The book is about utilizing the full potential of Microsoft ExcelTM in
financial modeling and other technical fields. Simple, intuitive, step-by-
step instructions reinforce theoretical intuition while teaching mechanics
of the model building process. The author uses his 35 years of experience
in writing this book and therefore it introduces the most practical and
direct approach to mastering the Excel-based financial modeling.
The book teaches students and professionals how to build, analyze,
interpret, and present financial models in a step-by-step fashion at their
own pace. A case study format is used to make sure the recipients can
comprehend the real life modeling challenges. The book bridges the gap
between academics and the real world to equip recipients with the practi-
cal financial skill set that they will need on the job.
The book starts with introducing the basic financial and other rou-
tinely usable functions of Excel, how to correctly use these functions,
what are the limitations of these functions, how to overcome these lim-
itations, and so on. The book then grills into how to incorporate these
functions into the context of a complete economics or financial model.
Finally, it provides opportunity to help users interpret the outcome of the
models.
The book will not only help in exploring the most advanced features
of Excel, it will also help you in understanding the financial analysis con-
cepts, project economics models, fiscal regimes in the oil and gas industry,
x PREFACE

crafting the most dynamic fiscal models, dynamic charting, sensitivity


analysis, building waterfall charts, building multivariable cross plots, and
spreadsheet automation through macros and VBA.
Who is the audience for this book and why they should not be with-
out it?

1. Financial analysts.
2. Engineers involved in budgeting, AFE preparation and project eco-
nomics (engineering economics).
3. Personnel involved in preparation of corporate business plan.
4. New business development personnel.
5. Professionals related to investment, equity research, credit, project,
mergers and acquisition, and corporate finance.
6. Students pursuing financial and engineering education (undergradu-
ate and graduate) at the university level.
7. The in-depth knowledge of Excel will greatly enhance their efficiency
and out of the box thinking.

It is also emphasized in the classroom that it is always helpful to draw


a time diagram to be able to visualize where the cash outflows and inflows
are taking place. The most common mistake in project economics is when
economists fail to properly identify the timing of the cash flows. Although
it may look trivial, shifting a cash-flow by one period can make significant
difference in decision making.
Besides this book, specific to financial modeling, there are many,
many other sources available to learn from. They are all good references,
but they provide generic use of Excel, that is, not specific to financial
modeling. It takes time to understand these generic applications and then
try to incorporate them in the financial modeling. I have concentrated on
the use of some of the ones I frequently visit or consult with.

1. I frequently use Excel Forum (www.excelforum.com) when I am


stuck. I have always received prompt and valuable suggestions from
the members of Excel Forum.
2. From time to time I log into Chandoo’s blog (http://chandoo.org/
wp) to capture new ideas.
PREFACE xi

3. The Peltier Tech Blog (http://peltiertech.com) is another useful


blog with good tips and tricks from time to time.
4. My Online Training Hub by Mynda Treacy (www.MyOnlineTrain-
ingHub.com)
5. I have also subscribed to the Excel Demy’s (www.ExcelDemy.com)
periodic e-mails with useful tips and tricks.

However, a majority of the sites give generic examples, and some of


them may not be even applicable to specific financial modeling situa-
tions. The thing that is different with this book is that it is specific to
financial modeling and bridges the gap between the generic and specific
techniques.
The concepts presented in this book are accompanied by Excel spread-
sheets or worksheets so that the users can reinforce their understanding
by looking at how these are developed. These spreadsheets are available
in a Dropbox at the following link. For any questions, corrections, and
suggestions, please feel free to contact the author at mianma@OGKnowl-
edgeShare.com or [email protected].
All the figures and tables in this book are available at the following
link on Dropbox.
https://www.dropbox.com/sh/k3m504hyibuy1gq/AACE4-
msYC2JYd8WyaP_K534a?dl=0
CHAPTER 1

Creating Dropdown Lists


In this chapter, we will show how to develop dropdown lists or menus
to control data entry and user choices available in the model. Dropdown
lists can greatly facilitate data entry by limiting user entries and forcing
users to choose a value from a controlled list. The data validation dialog
box in the Excel’s Data tab is used to construct dropdown lists of various
types and complexities.

Creating Simple Dropdown List


It is very helpful in financial models to be able to pick option from a
dropdown menu of various options available in the model. For example,
I have a worksheet that has products’ pricing scenarios under (a) Low
Case, (b) Base Case, and (c) High Case. If I have a dropdown menu of
these three pricing options in the model, I will be able to assess the impact
of these three pricing scenarios on the economics of the project easily.
Creating a dropdown menu requires the following steps.

1. Enter the names of the three scenarios in Cells A3, A4, and A5 as
shown in Figure 1.1a.

Figure 1.1 Stages of creating a dropdown menu in Excel


2 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

2. We would like to select the option in Cell A1. Upon selection of


the desired option in Cell A1, VLOOKUP, INDEX, and MATCH
functions are then used to read the respective pricing scenario from
the products’ pricing worksheet.
3. Place the cursor in Cell A1.
4. Click on the Data tab of Excel’s Ribbon.
5. Click on Data Validation icon. The Data Validation dialog box
appears as shown in Figure 1.2.

Figure 1.2 Data Validation dialog box

6. Select List in the Validation criteria Allow dropdown.


7. Select the Source, which is the list of options in Cells A3 to A5.
8. Tick the Ignore blank and In-cell dropdown in the dialog box.
9. Click OK—a dropdown arrow will appear in Cell A1. The arrow will
show only when the cell is active (cursor is in the cell).
10. Click on the dropdown arrow to select the option. The dropdown
list as shown in Figure 1.1b appears. The final option selection “Base
Case” in Cell A1 is shown in Figure 1.1c.
11. The dropdown can be easily cleared by placing the cursor in Cell A1
Data Validation Clear All OK.
CREATING DROPDOWN LISTS 3

Note: Normally the list of options in Cells A3 to A5 will be some-


where way below the main body of the model or even better somewhere
to the right of the entire model. Therefore, the list will not be visible.
Another way to achieve the same objective is to actually enter the list in
the Source of the Data Validation dialog box as shown in Figure 1.3. Place
the cursor in the cell where you want to enter a dropdown menu. Click on
Data Validation List Enter the list in the Source OK. This will
produce the same dropdown down menu as shown in Figure 1.1.

Figure 1.3 Data Validation dialog box with a list in the Source

Creating Dependent Dropdown List


In financial modeling, many times we will have variables that will be
dependent upon other variables. One typical example is crude oil and
products’ export. We have a worksheet (called “Pricing”) in the financial
model. This worksheet has multiple scenarios of products’ pricing. We can
run economics by selecting a pricing scenario from dropdown menus and
then using the VLOOKUP or HLOOKUP to read the corresponding
price for each year in the main body of the model. This will be shown later
in the book. The “Pricing” worksheet contains the following scenarios.
4 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

1. Low Case Scenario


a. Crude Oil
i. Arab Extra Light
ii. Arab Light
iii. Arab Medium
iv. Arab Heavy
b. Condensate
i. Khuff Condensate
ii. Other Condensate
c. Export Products
i. Propane
ii. Butane
iii. Pentanes Plus

The same will apply to the Base Case Scenario and the High Case
Scenario. The crude oil is exported to Far East (FE), Europe (EU), Asia,
or the United State of America (USA). The price for each destination will
be different because of the transportation and supply and demand for a
particular product in the region.
Here we will show how to set up dropdown menus to enable us to
select a particular pricing scenario from the pricing worksheet.
Figure 1.4 shows various pricing options or scenarios available in the
“Pricing” worksheet. These will be located somewhere away from the
main body of the model, either to the right or at the bottom. In this list,
the product types in Columns B, C, and D are dependent on the Prod-
ucts in Column A. This means that if I pick Crude_Oil, I should be able
to select what quality of crude oil. Column E has the pricing scenarios.
The Low Case has (a) four pricing for the crude oil, (b) two prices for

Figure 1.4 Various pricing options or scenarios of the “Pricing”


worksheet
CREATING DROPDOWN LISTS 5

condensate, and (c) four prices for the export products. The same are
repeated for Base Case and High Case scenarios.
Now we start selecting the options available to us. First, we select
the scenario (Low Case, Base Case, or High Case) in Cell B1. These are
common to all the product categories so they can be treated in the same
way as shown in the preceding section. Follow the following steps to get
a dropdown menu for the scenarios.

1. Click on the Data tab in the Ribbon.


2. Click on the Data Validation icon, the Data Validation dialog box, as
shown in Figure 1.2, appears.
3. Select List in the Validation criteria dropdown.
4. Select the Source, which is the list of scenarios in Cells E26
to E29.
5. Tick the Ignore blank and In-cell dropdown in the dialog box.
6. Click OK—a dropdown arrow will appear in Cell B1. The arrow will
show only when the cell is active (cursor is in the cell).
7. Click on the dropdown arrow to select the option. The Base Case
option is selected as shown in Figure 1.5.

Figure 1.5 Selecting the Base Case pricing scenario from the scenario
dropdown menu

Next step is to select the product type in Cell B2. Follow the following
steps to get a dropdown menu for the product type. For this, we need to
define Range Names.

1. Click on Formula tab in the Ribbon.


2. Click on Define Name icon.
6 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

3. The New Name dialog box, as shown in Figure 1.6 appears.


4. The Name is normally preselected by Excel but it can be manually
entered if it is different than what you want to use.
5. In the Refers to: highlight Cells A26 to A29.
6. Click OK.

Figure 1.6 Dialog box to define Range Name for ProductCategory

Repeat the previous steps (1 to 6) to define Range Names for Crude


Oil, Condensate, and Export Products. When you are done, you should
have the following four Range Names as shown in Figure 1.7. You can
see Figure 1.7 by clicking on Formulas Name Manager in the Ribbon.

1. ProductCategory
2. CrudeOil
3. Condensate
4. ExportProducts

The following steps are now used to create dependent dropdown


menus. The first dropdown menu for the Product Category is created in
Cell B2.

1. Click on the Data tab in the Ribbon.


CREATING DROPDOWN LISTS 7

Figure 1.7 The defined Range Names in the Name Manager dialog box

2. Click on the Data Validation icon, the Data Validation dialog box, as
shown in Figure 1.8, appears.
3. Select List in the Validation criteria Allow dropdown.

Figure 1.8 Data Validation dialog box for the dropdown menu of
Product Category in Cell B2
8 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

4. In the Source, enter ProductCategory Click OK. The source


name should be exactly as in the defined names. Figure 1.9 shows the
dropdown menu for Product Category.

Figure 1.9 Dropdown menu for the Product Category

Now we add the third dropdown menu in Cell B3, the outcome of
this is dependent on what is selected in Cell B2. This requires the use of
Excel’s INDIRECT function. Follow the following steps:

1. Click on the Data tab in the Ribbon


2. Click on the Data Validation icon, the Data Validation dialog box, as
shown in Figure 1.8, appears.
3. Select List in the Validation criteria Allow dropdown.
4. In the Source, enter INDIRECT(B2) Click OK. The Data
Validation dialog box is shown in Figure 1.10. The resulting drop-
down menu is shown in Figure 1.11.

Note: The items to appear in the first dropdown list must be one-
word entries, for example, Crude_Oil or CrudeOil and so on. In the next
section, we will deal with multiword entries. In addition, the names of the
dependent lists must be exactly the same as the matching entry in main
list. For example, the dependent list to be displayed when “Crude_Oil” is
selected from the first dropdown list should be named CrudeOil. It is also
recommended that the list in the dropdown menus is either in alphabeti-
cal order for easy reference or in some other logical order. Also remember
that characters such as the hyphen (-), ampersand (&), and so on, are not
accepted in Range Names.
CREATING DROPDOWN LISTS 9

Figure 1.10 The Data Validation dialog box = INDIRECT function


in the Source

Figure 1.11 Selecting the Crude Oil from the Product Type dropdown
menu

We have now developed three dropdown menus (a) two independent


dropdown menus and (b) one dependent dropdown menu. The indepen-
dent menus are in Cells B1 and B2 while the dependent menu is in Cell
B3 (which is dependent upon the selection in Cell B2).
A third dropdown menu may be added that is dependent upon the
selection in Cells B2 and B3. Figure 1.4 shows that the products could
be exported to difference regions. The destinations for the CrudeOil and
10 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Condensate products could be EU, FE, or USA and the ExportProducts


are only exported to Asia.
The dropdown menu in Cell B4 is built in the same way as we have
done in Cell B3. Just remember the Note above, which is essential for the
correct work of your cascading dropdown menus.
In Cell B4, we need to specify the export destination for the product
because the price of the product depends upon the destination. The
following additional name ranges are defined as shown in Figure 1.12.

1. CrudeOilArabExtraLight
2. CrudeOilArabLight
3. CrudeOilArabMedium
4. CrudeOilArabHeavy
5. CondensateCondensate
6. CondensateKhuffCondensate
7. ExportProductsPropane
8. ExportProductsButane
9. ExportProductsPentanes

Figure 1.12 Define New Names for CrudeOilArabExtraLight (Crude


Oil and Arab Extra Light)
CREATING DROPDOWN LISTS 11

Repeat this step for all the other combinations. The final Name
Manager is shown in Figure 1.13.

Figure 1.13 Name Manager for the dropdown menus in Cells B2,
B3, and B4

Now we are ready to create the third dropdown menu in Cell B4. This
menu is dependent upon the selections in Cells B2 and B3. A new for-
mula is required for this step. If you notice, we have combined the items
in Cells B2 and B3 to create the name range. In the Data Validation,
they have to be split again by applying Excel’s INDIRECT and SUBSTI-
TUTE formula. This will split the name (concatenates) into two names
and remove the spaces from the names. For example, in Cell B4, the data
validation formula would be:

INDIRECT(SUBSTITUTE(B2&B3,” “,””))

where Cells B2 and B3 contain the first and second dropdowns, respec-
tively. The Data Validation dialog box with this formula is shown in
Figure 1.14. The completed dropdown menus are as shown in Figure 1.15.
12 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 1.14 Data Validation dialog box for creating the dependent
dropdown in Cell B4; the dropdown in Cell B4 is dependent upon the
combined selections in Cells B2 and B3

Figure 1.15 The Completed dropdown menu

Using FORM and ActiveX Controls


These two Excel functions are given under the DEVELOPER tab
on the Excel Ribbon. The functions under the DEVELOPER tab
are (a) Code—code developing tools such as VBA editor and macro
recording, (b) Add-Ins—to activate the Excel’s standard Add-In tools,
(c) Controls—creating Form or ActiveX Controls such as action buttons,
checkboxes, dropdown lists, combo boxes, and so on, (d) XML—using
XML commands, and (e) Modify. The functions that we will discuss in
this section are the Form or ActiveX Controls.
CREATING DROPDOWN LISTS 13

The DEVELOPER tab should always be visible on the ribbon. Some-


times it may not be visible if Excel is not configured to display it. In this
case it can be easily added to the ribbon by following the steps below
(most recent versions of Excel).

1. Click on the FILE tab.


2. Click on OPTIONS.
3. When the Excel Options dialog box (as shown in Figure 1.16)
appears, click on the Customize Ribbon option on the left.

Figure 1.16 The Excel Options dialog box

4. Click on the Developer checkbox under the list of Main Tabs on the
right as shown in Figure 1.17.
5. Click on the OK button. This will add the Developer tab to the
Ribbon.

The FORM Controls are used to (a) easily reference and interact with
cell data without using VBA code, (b) add controls to chart sheets, and
(c) attach an existing macro to a control so a macro is executed when a
user clicks on the control.
14 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 1.17 Excel Options and Customized Ribbon dialog box

In the Data Validation, we created dropdown lists which actually


added value or text of the dropdown list in the cell with the dropdown
list. The Form Controls instead return numerical value for the current
position of the selected item in the control. If we have Low, Base, and
High in the List Box, these are represented by numerical values 1, 2 and
3, respectively. So when Low is selected Excel will enter 1 in the cell with
the Control Box. This numeric value can then be used in conjunction
with other functions such as INDEX to perform different tasks.
The main advantage of using the Combo Box or List Box is that the
dropdown arrow is always visible in the cell. On the other hand, the drop-
down arrow in the dropdown list created by using the Data Validation is
visible only when the cursor is placed in the cell with the dropdown list.
The Form and ActiveX Controls are shown under the INSERT func-
tion of the DEVELOPER tab as shown in Figure 1.18. The following com-
mon steps are used to insert Form or ActiveX Controls in the worksheet.

1. Click on the desired button on the Forms toolbar, the mouse pointer
will turn into a plus sign.
CREATING DROPDOWN LISTS 15

Figure 1.18 The Form Controls dialog box under the INSERT tab of
the Developer tab

2. Click the worksheet location where you want the upper-left corner
of Form Control or ActiveX button to appear.
3. Drag the list box to where you want the lower-right corner of the list
box to be. If the button has to be in only one cell then just cover the
grid lines of the cell.
4. Right click on the button Click on Format Control. The Format
Control dialog box will appear where the desired formatting can be
done. The Format Control dialog box can also be accessed by click-
ing on Properties

The FORM Controls have the following 12 controls available.

1. Button (Form Control)—Runs a macro that performs an action


when a user clicks it. A button is also referred to as a push button.
a. Click the Developer tab, click Insert in the Controls group.
b. Click on the Button icon, the mouse pointer will turn into a plus
sign. Keep the left click pressed.
c. Place the plus sign in the upper-left corner of the cell in which
you want the Button to appear, and then drag the cross to where
16 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

you want the lower-right corner of the Button to be. Release the
left click, an Assign Macro dialog box will appear as shown in
Figure 1.19. Assign the macro now or click OK, the macro can
also be assigned later. In this example, the Button is shown in
Cells A1:B2 as shown in Figure 1.20.

Figure 1.19 The Assign Macro dialog box for the Button in
Figure 1.20

Figure 1.20 The Button (Form Control) created in Steps 1a to 1c

d. Format the Button—Right click on the Button Click on Format


Control in the dropdown menu to format the Button as desired.
e. Assign Macro—Right click on the Button Click on Assign
Macro in the dropdown menu Enter the macro name in the
Assign Macro dialog box.
CREATING DROPDOWN LISTS 17

2. Combo Box (Form Control)—Combines a Text Box with a list box


to create a dropdown List Box. A combo box is more compact than
a list box but requires the user to click the down arrow to display the
list of items. It works in the same way as the dropdown list created
using the Data validation shown in Figure 1.1.
a. Click the Developer tab, click Insert in the Controls group.
b. Click on the Combo Box icon, the mouse pointer will turn into
a plus sign. Keep the left click pressed.
c. Place the plus sign in the upper-left corner of the cells in which
you want the Combo Box to appear, and then drag the cross to
where you want the lower-right corner of the Combo Box to be.
Release the left click, a Format Control dialog box will appear as
shown in Figure 1.21. Click on the Control tab and assign the
Input range A7:A9. In this example, the Button is shown in Cells
A1:B2 as shown in Figure 1.22.
d. The Input range A7:A9 in Figure 1.21 picks the list of options
available. The cell link links Cell A1, so whatever option is
selected its sequence number in the list will be entered in Cell A1.
The number of option can be specified in the dropdown lines.
Cell B5 is linked to Cell A1, which shows the sequence number
corresponding to the options list.

Figure 1.21 The Format Control dialog box for the Combo Box
18 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 1.22 The Combo Box developed in Figure 1.21

e. Format the Combo Box—Right click on the created Combo


Box. Click on Size, protection or properties to format the Combo
Box as desired. The 3-D shading Check Box is optional. It adds a
3D look to the dropdown or combo box.
3. Check Box (Form Control)—Turns on or off a value that indi-
cates an opposite and unambiguous choice. More than one Check
Box can be selected in a worksheet or a group (Group Form Con-
trol). A Check Box with a tick is considered turned on (selected or
checked) and returns TRUE, an empty Check Box (without tick) is
considered turned off (cleared or unchecked) and returns FALSE.
A mixed means combination of Checked (on) and Unchecked (off)
states represent multiple selections in a worksheet or a group.
a. Click the Developer tab, click Insert in the Controls group.
b. Click on the Combo Box icon, the mouse pointer will turn into
a plus sign. Keep the left click pressed.
c. Place the plus in the upper-left corner of Cell A1 in which you
want the Check Box to appear, and then drag the plus sign to
where you want the lower-right corner of the Check Box to be.
Release the left click.
CREATING DROPDOWN LISTS 19

d. Right click on the Check Box created. Format Control dialog box
will appear as shown in Figure 1.23. Click on the Control tab
and assign the cell link to $B$1.

Figure 1.23 The Form Control dialog box for Check Box

e. If more than one Check Box has to be created then copy the
Check Box just created and paste it in the other desired cells.
f. Once the Check Boxes are copied to the other cells, change the
cell link for each by repeating Step 3d.
g. Change Text—The title or reference of the Check Box can be
changed using: Right click on the Check Box Click on Edit
Text in the dropdown list.
h. The Check Boxes created are shown in Figure 1.24 with the result
in Cells B1:B4.
Figure 1.25 shows an example of how the Check Box option
can be used. In this example, we have revenue from three countries
and we need to look at the total and average revenue per country or
20 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 1.24 Check Boxes inserted in worksheet

Figure 1.25 Example showing the use of Check Boxes

selected countries. The selection of the countries is done using the


Check Boxes. The rest of the steps to create Check Boxes are the
same as presented in the preceding pages. Following are the addi-
tional steps required.
1. Select blank cells anywhere in the worksheet (they do not need
to be visible to the user). Cells E4:G7 are selected in Figure 1.25.
2. Enter the name of the countries (associated with the Check Boxes
created) in Cells E5:E7
3. Link Cells F5:F7 to the Check Boxes for Singapore (Cell A1),
United Kingdom (Cell B1), and Bahrain (Cell C1), respectively.
4. Enter formula IF(F5 TRUE,”Singapore”,”-”) in Cell G5. The
formula return the country name if the Check Box is ticked and
“-” if not ticked. Repeat the same formula in Cells G6 and G7.
5. Enter formula DSUM(A4:C10,”Revenue, M$”,G4:G7) in
Cell B2 to calculate the sum of the revenues for the countries
identified by the ticks in the Check Boxes.
a. DSUM(database, field, criteria)
CREATING DROPDOWN LISTS 21

6. Enter formula DAVERAGE(A4:C10,”Revenue, M$”,G4:G7)


to calculate the average revenue for the countries identified by the
ticks in the Check Boxes.
7. Note: It is important to note the following else the formulas will
give error.
a. The database (Cells A4:C10) must include the Column head-
ings (Cell A4:C4).
b. The field specified in the DSUM formula must be the same
as in Cell C4.
c. The criteria in DSUM must include the column headings
(Cell E4:G4).
d. The heading in Cell G4 must be the same as the heading in
Cell A4.
The Check Box can also be used interactively to select data to
be plotted in a graph. An example is given in Chapter 3 of this
volume.
4. Spin Button (Form Control)—Spin button (Form Control) is used
to increase or decrease a value, such as a number increment, time, or
date. To increase the value, click the up arrow; to decrease the value,
click the down arrow. Typically, a user can also type a text value
directly into an associated cell or text box.
a. The Spin Button in inserted in a desired cell in the same way as
shown in the previous Form Controls.
b. Right click on the Spin Button created—The Form Object dia-
log box, as shown in Figure 1.26, appears. Specify the ranges of
data to capture. The limits in Figure 1.26 are for a certain project
CAPEX. By changing this CAPEX, we can assess the profitability
of the project at various CAPEX.
c. Link the cell link to Cell A2. This is where the selected CAPEX
will be input.
d. The CAPEX in Cell A2 can be changed by clicking on the up or
down arrows, the change will be within the specified limits and
increments.
e. The final Spin Button is shown in Figure 1.27.
f. The Spin Button can be placed in the same cell where the result will
appear.
22 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 1.26 The Spin Button (Form Control) Format Object dialog
box

Figure 1.27 Example of the Spin Button (Form Control)

5. List Box (Form Control)—Displays a list of one or more items of


text from which a user can choose. Use a List Box for displaying large
numbers of choices that vary in number or content. There are three
types of list boxes:
a. A single-selection List Box enables only one choice. In this case,
a list box resembles a group of Option Buttons, except that a list
box can handle a large number of items more efficiently.
b. A multiple-selection List Box enables either one choice or contig-
uous (adjacent) choices.
c. An extended-selection List Box enables one choice, contiguous
choices, and noncontiguous (or disjointed) choices.
CREATING DROPDOWN LISTS 23

d. The List Box returns sequence reference (1, 2, 3 . . . . n) to the


selection in a linked cell.
e. The following steps are followed to build a single-selection
List Box.
i. The List Box in inserted in a desired cell in the same way as
shown in the previous Form Controls.
ii. Right click on the List Box created—the Form Control dia-
log box, as shown in Figure 1.28, appears. Specify the ranges
of data to capture, that is, Cells C1:C4. The data could be
entered in any blank cells anywhere in the worksheet as
shown in Figure 1.29.

Figure 1.28 Format Control dialog box for the List Box (Form
Control)

iii. Link the cell link to Cell B1 as shown in Figure 1.29. Cell B1
will show the sequence number of the selected option from
the List Box.
iv. By reducing the height of the List Box to cover Cells A1:A2
only will show three items out of the list in Cells C1:C4. The
up and down arrows will then become live to scroll the list
up and down.
24 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 1.29 Illustration of the List Box (Form Control) function

6. Option Button (Form Control)—An Option Button, also referred


to as Radio Button, allows a single choice within a limited set of
mutually exclusive choices. The Option Button is usually contained
in a group box or a frame (to be presented in the next section). An
Option Button can have one of two states: selected (turned on),
cleared (turned off). The advantage with Option Button is that at
any one time only one option can be selected.
a. The following steps are followed to use Option Buttons.
i. The Option Button in inserted in a desired cell in the same
way as shown in the previous Form Controls.
ii. Insert one Option Button in one cell and then Copy and
Paste it to the other desired cells depending on the number of
options under consideration.
iii. Right click on the first Option Button—the Format Control
dialog box, as shown in Figure 1.30 appears.

Figure 1.30 Format Control dialog box for the Option Button
CREATING DROPDOWN LISTS 25

iv. Link the cell link to Cell B1 as shown in Figure 1.31. Cell B1
will show the sequence number of the selected option from
the Option Button.

Figure 1.31 Illustration of the Option Button (Forma Control)


function

7. Group Box (Form Control)—If we are using more than one set of
Options Buttons or Check Box or some of the other Form Controls,
they will not work properly if they are not grouped separately in
different categories. Figure 1.32 shows one set of Option Buttons
for the product type and another set for the corresponding pricing
scenario. However, the worksheet does not differentiate between the
two unique sets. We can overcome this problem by enclosing each
unique set under a Group Box as shown in Figure 1.33. Once the
two sets are grouped then the cell link should be assigned to each
group.

Figure 1.32 Option Buttons for product type and pricing scenario

8. Label (Form Control)—Label (Form Control) identifies the pur-


pose of a cell or text box, or displays descriptive text (such as titles,
captions, pictures) or brief instructions.
26 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 1.33 Illustration of the Grouped Option Buttons

9. Scroll Bar (Form Control)—The Scroll Bar (Form Control) scrolls


through a range of user-specified values when the up and down
arrows are clicked (in vertical Scroll Bar) and left and right arrows
(in horizontal Scroll Bar) or drag the scroll box. In addition, you can
move through a page (a preset interval) of values by clicking the area
between the scroll box and either of the scroll arrows. Typically, a
user can also type a text value directly into an associated cell or text
box. The following steps are followed in inserting a Scroll Bar in a
worksheet.
a. Use the same steps as used for the previous Form Controls to
place a Scroll Bar in a cell or cells (depending on the width of a
cell or height of a cell).
b. Right click on the Scroll Bar inserted in a cell in Step 9a. The
Format Object dialog box appears as shown in Figure 1.34. Enter
the required values (Current, Minimum, Maximum, Increment
Change, and Page Change). Link the cell link to a cell where the
output from the Scroll Bar can be seen.
c. Click OK.
d. The Scroll Bar is shown in Figure 1.35. Every time you click on
the left or right arrow, the number in Cell B1 will change by 10
(upward if right arrow is clicked or downward if left arrow is
clicked).
CREATING DROPDOWN LISTS 27

Figure 1.34 Format Object dialog box for the Scroll Bar Form Control

Figure 1.35 Illustration of the Scroll Bar Form Control

The ActiveX Controls


The ActiveX controls basically do the same functions as the Form Con-
trols discussed in the preceding pages. The design requirements for the
ActiveX Controls are more flexible. They also have a much better ties to
VBA in terms of programming and have a number of events that can be
accessed through programming.
CHAPTER 2

Using Excel’s Data Tab


The Excel’s Data tab is shown in Figure 2.1. We have already covered
the Filter and Sort options in Volume 1. Some functions of the Data
Validation option were also covered in Volume 1. In this chapter, we will
cover the following:

1. The Data Validation function.


2. The Flash Fill function.
3. The Remove Duplicates function.
4. The Group and Ungroup functions.
5. The Subtotal function.
6. The Consolidate function.
7. The What-If Analysis function—This is a very important and widely
used function. We use this option in almost every financial analysis. This
function includes the following three additional very useful options.
a. The Scenario Manager option.
b. The Goal Seek option.
c. The Data Table option.
8. The Data Analysis function.
9. The Solver function.

Figure 2.1 Excel’s Data tab

The Data Validation Function


Part of this feature (creating dropdown list) is already covered in Chapter 5
of Volume 1. In this section, we will cover some of the other useful aspects
of this function. This option has three additional functions as shown below.
30 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

1. Data validation
2. Circle invalid data
3. Clear validation circles

In addition to using the Data Validation for creating the dropdown


list, we can also use this function to achieve other objectives. The List
option shown in Figure 2.2 is already used in creating the dropdown list.
The other functions show the validation criteria, that is, to restrict the
type of data entry as (a) Whole number, (b) Decimal, (c) Date format,
(d) Time format, (e) Length of text, and (f ) Custom input.

Figure 2.2 The Data Validation dialog box

The Input Message (Figure 2.3) in the Data Validation dialog box
prompts the user to a user-specified message explaining the kind of
data allowed in a cell. Figure 2.3 shows formatting of Cell A1 to accept
only text of minimum length 5 and maximum length 10. To create this
restriction, select Cell A1 Data Validation Allow Text Length
Minimum 5 Maximum 10 OK.
Now create an input message, which will show up when cursor is
placed in Cell A1. The message will not be shown if the cursor is placed in
any other cell. The error message should be clear and meaningful so that
anyone entering data into this cell knows what the message means. Enter
USING EXCEL’S DATA TAB 31

OK. The message is shown in Figure 2.3. Figure 2.4 shows the message
when cursor is placed in Cell A1.

Figure 2.3 Formatting Cell A1 to accept only text (no numbers or


values)

Figure 2.4 Formatting Cell A1 to accept only text (no numbers or


values)

Now create a message that will appear when incorrect data is entered.
Select the cell that need a rule and enter the Error Alert as shown in
Figure 2.5. Now try to enter any value (not text) in Cell A1. We tried
to enter 1 in Cell A1. As soon as 1 is entered in the cell the error mes-
sage, as shown in Figure 2.6, appears alerting the user to take corrective
action. Click on Retry or Cancel to correct the entry. In this example, we
specified the text length between 5 and 10. The Settings dialog box has
a dropdown list allowing the user to enter other specifications such exact
text length and so on.
32 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.5 Data Validation—Error Alert dialog box

Figure 2.6 Data Validation—Error Alert dialog box

To remove the restriction, just place the cursor in Cell A1 Data


Validation Clear All OK.
If you have not specified Stop in the Error Alert Style and you have
specified only Warning or Information then it will not stop you from
entering the data. However, you can enter Data Validation Circle
Invalid Data. Now when incorrect format of data is entered, it will put a
circle around the cell as shown in Figure 2.7. The circles can be cleared by
clicking on Data Validation Clear Validation Circles.

The Flash Fill Function


We discussed the Auto Fill feature of Excel in Chapter 5 of Volume 1.
Instead of entering data manually on a worksheet, you can use the Auto
USING EXCEL’S DATA TAB 33

Figure 2.7 Circle invalid data

Fill feature to fill cells with data that follows a pattern or that is based on
data in other cells. In the latest versions of Excel another feature is added
which is called Flash Fill. The Flash Fill option of Excel helps in filling out
data based on an example. This feature starts working when it recognizes
a pattern in your data. The feature works best when there is some consis-
tency in the data you are going to enter.
You have to make sure that the Fill Flash is on. This is done by Click
File Options Advanced Automatically Flash Fill OK. The
activated Flash Fill is as shown in Figure 2.8.

Figure 2.8 Activating the Flash Fill feature of Excel


34 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

If Flash Fill is activated as described above and shown in Figure 2.8


but it does not start automatically when you type data that matches a pat-
tern then start it manually by Clicking Data Flash Fill, or by pressing
Ctrl E. Figure 2.9a shows first and last name in Column A. We want
to split these names into two columns (a) first name in Column B and
(b) last name in Column C.
The first name of the name in Cell A2 is manually entered (a) George
in in Cell B2 and (b) the last name Yeung in Cell C2 as shown in
Figure 2.9a. Now place the cursor in Cell B3 and click on Data Flash
Fill or press CTRL E. The Cells B3 to B6 will be filled with the first names
from Column A. Now place the cursor in Cell C3 and press CTRL E to
enter the last names from Column A into Cells C3 to C6. in the result is
shown in Figure 2.9b. Column A and then extract the first and last names
from the first e-mail in Column B and Column C, respectively. The basic
requirement for Flash Fill to work is there must be a pattern in whatever
you have in the column.

(a) (b)
Figure 2.9 (a) Using Excel’s Flash Fill function (b) After use of
Flash Fill

The Remove Duplicates Functions


This feature of Excel becomes very handy when you are working with
extremely large dataset, which either has duplicate entries or you just
want to make sure that there are no duplicate entries in the data. To clean
the dataset manually could be very challenging and may not be accurate.
Duplicate values can pop up in your dataset for several reasons
(a) data received from another source and you want to make sure that all
entries are unique or (b) you have entered data in a rush and did not pay
attention to entering duplicate values. After entering data or receiving
USING EXCEL’S DATA TAB 35

data from another source, it is prudent to check for the duplicate data
error. You can specify columns or rows in which to remove the duplicates
or the duplicates can be removed from the entire dataset. The only con-
cern in automatically removing the duplicates, without actually seeing the
removed data, is that it does not allow you to do any analysis before the
duplicates are removed.
Figure 2.10 shows certain data and we can clearly see the dupli-
cate entries since it is a small list. We want to remove the duplicates
automatically.

Figure 2.10 Dataset with duplicate entries

Highlight Cells A2:D10 and click on Data Remove Duplicates.


The Remove Duplicate dialog box, as shown in Figure 2.11 appears. Here
you can select one or more columns that may contain duplicates or select
the entire dataset (all columns). The Remove Duplicate initially shows
selection of all the columns. If you agree with this selection then just enter
OK. Otherwise, remove the tick marks from the Column headings that
you do not want to include in duplicate data removal. After clicking on
OK, a message as shown in Figure 2.12 appears which gives a summary
of the action, that is, in this case, the message is: 3 duplicate values found
and removed; 6 unique values remain. The final dataset is as shown in
Figure 2.13.
36 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.11 The Remove Duplicates dialog box of Data feature

Figure 2.12 Summary result of the removed data

Figure 2.13 Dataset of Figure 2.10 after the duplicate data removed

Besides using the Excel’s Remove Duplicates feature, you can also
clean the dataset by using (a) conditional formatting (highlighting the
cells that may have duplicates) applicable for small datasets, (b) pivot
table, (c) sorting the data, or (d) using advanced filters.

The Group and Ungroup Functions


Some models may have hundreds of rows and columns and all these rows
and columns have detailed calculations that the analyst may not want
USING EXCEL’S DATA TAB 37

to see in routine analysis. The worksheet may look cluttered if all these
rows and columns are shown in the worksheet. For example, I have five
product streams with corresponding five product prices and five reve-
nue calculations. At the bottom of the revenue calculations, I have Gross
Revenue. In routine analysis, the only data that is worth seeing is the
Gross Revenue. Therefore, I can group and hide all the rows that perform
detailed calculations to arrive at the Gross Revenue.
Similarly, you may have several rows with monthly sales figures and
one row with the sum of all these sales figures. This could become clut-
tered if you are dealing with sales over several years, that is, 12 months/
year times 5 years will be 60 rows of sales data. We can group and hide
these 60 rows of data and only show the total for 7 years or year-by-year.
Note that at any time the analyst wants to look into the details, the data
could be temporarily ungrouped.
Figure 2.14 shows revenues for six products and the Gross Revenue of
all the six product streams. We need to only see the Gross Revenue so we
can group (hide) the revenue of the individual products.

Figure 2.14 Revenue for six product streams before grouping

Highlight Cells A2:G7 in Figure 2.14. Click on Data Group


Rows OK. The Group gives option to group by rows or columns,
select the desired one. Figure 2.15a shows the resulting Excel table. By
clicking on the negative sign (–), the rows are collapsed and just the
Gross Revenue row is visible as shown in Figure 2.15b. The table can be
expanded any time by clicking on the positive ( ) sign and see the reve-
nue of the individual product streams. Alternatively, clicking on “1” will
group Rows 2 to 7 and clicking on “2” will expand the table.
38 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.15a The grouped revenue table

Figure 2.15b The grouped revenue table showing only the Gross
Revenue

The SUBTOTAL Function


Some complex financial models may become overwhelming and become
difficult to read. As shown in the previous section, we can group data
allowing us to hide and show different parts of the worksheet. The SUB-
TOTAL command can be used to summarize different groups of data
and create an outline for the worksheet. The data is summarized through
using common functions such as SUM, AVERAGE, and COUNT. The
SUBTOTAL option could help to calculate the cost of office supplies
by type from a large inventory order. It will create a hierarchy of groups,
known as an outline, to help organize your worksheet.
The SUBTOTAL divides a worksheet into different levels and allows
the user to switch between these levels. The levels allow the user to quickly
control how much information is displayed. Each level is identified by a
level button (a square with the level number in it). A total of eight levels
can be created.
The following syntax is used for this function:
SUBTOTAL(function_num, ref1, [ref2], . . . .)
The SUBTOTAL function syntax has the following arguments:
USING EXCEL’S DATA TAB 39

1. Function_num—These are numbers 1 to 11 or 101 to 111, which


specify the function to use for the subtotal. The 1 to 11 numbers
include manually hidden rows and 101 to 111 excludes these. Filtered
out cells are always excluded. Table 2.1 shows the function_num.

Table 2.1 Function_num for the SUBTOTAL function


Function_num Function_num
includes hidden excludes hidden
values value Function
1 101 AVERAGE
2 102 COUNT
3 103 COUNTA
4 104 MAX
5 105 MIN
6 106 PRODUCT
7 107 STDEV
8 108 STDEVP
9 109 SUM
10 110 VAR
11 111 VARP

2. Ref1—The first named range or reference for which you want the
subtotal.
3. Ref2—Optional named ranges or references 2 to 254 for which you
want the subtotal.

Follow these steps to add subtotals to the data in Figure 2.16:

1. Highlight Cells A1 to E13.


2. Click on Data SUBTOTAL OK.
3. By Clicking on Data SUBTOTAL, the SUBTOTAL argument
dialog box appears as shown in Figure 2.17. The dialog box has
already analyzed the data and filled out the required fields. However,
any of the selections in the dialog box may be changed if desired. The
selections in the dialog box are:
40 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.16 Data used for the SUBTOTAL function

Figure 2.17 The SUBTOTAL dialog box


USING EXCEL’S DATA TAB 41

a. At each change in—Add a subtotal at each change in training


sponsor, that is, make a subtotal for the fees received from each
sponsor. Excel will automatically add a row at the end of each
training sponsor. It is necessary that the data is sorted into logical
or group form before the SUBTOTAL function can be used.
b. Use function—The SUM function is picked by Excel. If this
function is not required then a desired function can be picked
from the “Use Function” dropdown list. The dropdown list will
show the list given in Table 2.1.
c. Add subtotals to—Which column to find the subtotals for, this is
specified by a tick mark in front of the course fees column.
d. Replace current subtotals—This is standard, that is, to replace
any existing subtotals.
e. Summary below data—Means to enter the subtotal at the end of
each group. If this option is not clicked then the subtotals will be
entered at the beginning of each group.
f. Clicking on OK will add the SUBTOTAL functions as shown
in Figure 2.18. The =SUBTOTAL(9,E2:E5) is added to Cell E6,
=SUBTOTAL(9,E7:E10) is entered in Cell E11 and =SUBTO-

Figure 2.18 Figure 2.16 after the SUBTOTAL functions are inserted
42 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

TAL(9,E12:E15) to Cell E16. The =SUBTOTAL(E2:E15) in


Cell E17 to give the grand total of the three subtotals. Note that
the SUBTOTALS in Cells E6, E11, and E16 are not added to
the grand total although the grand total covers the range E2:E15,
that is, =SUBTOTAL(9,E2:E15) in Cell E15 is automatically
entered by the SUBTOTAL function. Some formatting will be
required to make the table clear.

Once the table is ready then you can select the details you want to see.
Clicking on Button 1 shows only the Grand Total, clicking on Button 2
will show the Subtotals and Grand Total as shown in Figure 2.19, and
clicking on Button 3 will show the entire table. Similarly, clicking on any
of the negative (–) signs in Figure 2.18 can be used to show the desired
details.

Figure 2.19 Collapsed table showing only the subtotals and grand total

The SUBTOTAL formatting can be easily removed by highlighting


the table Click on Data SUBTOTAL Remove All.
Figure 2.20 shows another example, the difference in this example is
that the “At Each Change in” is not continuous.

1. Highlight Cells A1:E10.


2. Click on Data SUBTOTAL, a warning message as shown in
Figure 2.21 appears, just click on OK to get the SUBTOTAL dialog
box.
3. Click OK, the SUBTOTAL functions will be added as shown in
Figure 2.22.
USING EXCEL’S DATA TAB 43

Figure 2.20 Another example of using SUBTOTAL

Figure 2.21 Warning message when using the SUBTOTAL function

Figure 2.22 Adding SUBTOTALS to data in Figure 2.20

4. The references in the SUBTOTAL function in Cells E3 and E7 are


not correct. Just edit Cells E3 and E7 and copy each to Cells C3 and
C7, respectively.
5. Hide or delete Rows 2 and 6, these are redundant now.
44 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

6. The final edited version is shown in Figure 2.23. Clicking on


Button 2 will hide the headings in Rows 2 and 6.

Figure 2.23 Final result of using the SUBTOTAL function on


Figure 2.20

The CONSOLIDATE Function


Many times we need to consolidate or summarize data and results from
multiple worksheets, that is, consolidating cash flows of various projects
or investments, consolidating revenue statements from multiple profit
centers, and so on. Excel provides several ways to do this, one of these is
using Excel’s CONSOLIDATE function under the Data tab.
The methods included in Excel are (a) consolidating by position,
(b) consolidating by category, (c) by formula, (d) using copy and paste
special, or (e) by using Excel’s Pivot Table feature.
Figure 2.24 shows cash flows of two projects that need to be consoli-
dated and profitability of the consolidated cash flow calculated.

Consolidate According to Position

The following steps are followed to consolidate the cash flows of Projects
1 and 2 together.

1. Remove blank columns and rows. Each column or row is labeled


with similar information.
USING EXCEL’S DATA TAB 45

Figure 2.24 Cash flow of two projects (Project 1 and Project 2)

2. Go to a new worksheet where you want to consolidate the cash flow


of these two projects. Name this worksheet “Consolidation.”
3. Place the cursor in Cell A1.
4. Click on Data CONSOLIDATE.
5. The CONSOLIDATE dialog box appears as shown in Figure 2.25.

Figure 2.25 The CONSOLIDATE dialog box


46 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

a. Function—Select Sum, the dropdown list includes several other


functions such as Average, Count, Max, Min, StdDev, Product,
and so on.
b. Reference—Select the cells in the worksheets to be consolidated,
you can add many worksheets by clicking on Add and entering
the cells in the worksheets to be consolidated. You can link it to a
worksheet in the same workbook or a worksheet in another work-
book. Cells from worksheets in other workbook can be added by
browsing the workbook.
c. Choose the Create Links to Source Data box if you want to
update source data automatically. Leave the box unchecked
if you prefer to update consolidation data manually. If this
option is ticked then anytime you change any data in the orig-
inal worksheets, the consolidated worksheet is automatically
updated.
d. The completed CONSOLIDATE dialog box is shown in
Figure 2.26.
6. Click on OK.

Figure 2.26 Completed CONSOLIDATE dialog box showing


reference to the cash flows in Figure 2.24
USING EXCEL’S DATA TAB 47

7. Enter NPV and IRR functions in Cells B6 and B7, respectively.


8. The consolidated worksheet is shown in Figure 2.27.

Figure 2.27 Consolidated worksheet showing the sum of two projects’


cash flow

Consolidation into Existing Template

Lot of times there may be an existing template in which the user would
like to consolidate the data of the worksheets. Such a template is shown
in Figure 2.28.

Figure 2.28 Existing template for data consolidation

The CONSOLIDATE dialog box for this option is shown in


Figure 2.29. As soon as the consolidated cash flow is generated, the NPV
and IRR will be calculated. Note the difference in the “Reference” and
“Use labels in” Figures 2.26 (Cell References are A1:F4) and 2.29 (Cell
References are B1:F4). The “Use labels in” is left blank.
48 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.29 Completed CONSOLIDATE dialog box for existing


template in Figure 2.28

Consolidation Using Formula

The following steps are followed to use formulas for consolidating


worksheets.

1. Place cursor in Cell B1 in the template shown in Figure 2.28.


2. Link Cell B1 of the Consolidation worksheet to the Cell B1 of
Project 1 Cell B1 of Project 2.
3. Copy Cell B1 vertically down to Cell B3.
4. Copy Cells B1:B3 to Cells F1 to F3.
5. The consolidated worksheet is shown in Figure 2.30.

Figure 2.30 Consolidating worksheets using formulas


USING EXCEL’S DATA TAB 49

You can also enter the formula =SUM(‘Project 1:Project2’!B1) in Cell


B1 of the template. Copy the formula down to Cell B3 and to the right to
Cells F1:F3. To enter the formula, click the AutoSum toolbar icon in the
Formula tab, then click the Project 1 tab, then click the B1 cell, hold the
Shift key down and click the Project 2 tab, release the Shift key and press
Enter. The formula is now entered in Cell B1, it should be now copied
down to B3 and to the right Cells F1:F3.
This formula is good and very useful but it has limitation that you
need to be aware of. The placing of the worksheets shall be fixed. If the
Project 1 worksheet is moved after Project 2 worksheet then the calcula-
tions will be incorrect.
The advantage of this formula is that if more worksheets are added in
between Project 1 and Project 2 (Project 1, Project 3, Project 4,…Project n),
Cells B1 from all the worksheets will be added.

Use of Goal Seek Function


Excel’s Goal Seek feature is very useful in obtaining a desired goal by
changing a variable leading to that goal. It is an iterative solution to a
problem and a variety of problems can be solved using this function.
The following three sensitivity features are included under the What-If
Analysis tab.

1. Scenario Manager
2. Goal Seek
3. Data Table

A Goal Seek dialog box, shown in Figure 2.31, appears when clicking
on the Goal Seek function under the What-If Analysis tab.

Figure 2.31 The Goal Seek dialog box


50 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

The Set cell refers to the cell which contains the formula to perform
the desired calculation. To value is the answer to be obtained from the
formula cell. By changing cell has one of the variables of the formula in
the formula cell.
A typical problem that we can solve using the Goal Seek is to find
out how much money we can afford to borrow from a bank based on (a)
annual interest rate of 5 percent, (b) monthly payments over a payback
period of 10 years, and (c) maximum monthly payment of $2,000. The
data entry is shown in Figure 2.32. Cells B1 to B4 are inputs and Cell B5
has PMT(B4/B3,B2*B3, B1) formula to calculate the monthly pay-
ment. The objective here is to change the loan amount in Cell B1 until
we arrive at a monthly payment of $2,000 in Cell B5.

Figure 2.32 Loan payment problem solve using Goal Seek

Place the cursor in Cell B5 and click on Data What-If Analysis


Goal Seek Set cell: B5 To value: 2000 By changing cell: $B$1
OK as shown in the Goal Seek dialog box in Figure 2.31. As shown in
Cell B1 of Figure 2.32, we can afford to borrow $188,563 based on the
variables used.
After completing the iterations, Goal Seek shows a Goal Seek Status
as shown in Figure 2.33. The Goal Seek Status tells us if it has found a
solution and shows that the current value and the target value are now the
same. If Goal Seek fails to match the target with the built-in iterations,
the Step and Pause buttons in the dialog box become active. We can have
Excel perform further iterations to try to narrow down or eliminate the
gap between the target and current value.
If we are happy with the iterations and the result, click on OK on the
Goal Seek Status dialog box to close the dialog box. If you want to show
the original value, click on Cancel on the Goal Seek Status dialog box.
USING EXCEL’S DATA TAB 51

Figure 2.33 The Goal Seek Status dialog box

Another use of Goal Seek is to determine the breakeven price of pro-


ducing or manufacturing a unit of product. The breakeven price will be
the price of the product which will generate a rate of return (IRR) equal
to the corporate discount rate (minimum desired rate of return of the cor-
poration or investor) and net present value (NPV) of zero at the corporate
discount rate.
Figure 2.34 shows a brief cash flow showing units sold, price per unit,
operating cost, and capital expenditure. Gross revenue = units sold times
the price per unit and net cash flow is the sum of the gross revenue, oper-
ating expenditure, and capital expenditure. The price is entered in Cell
B3 and Cells C3 to F3 are all linked to Cell B3. So when the price in Cell
B3 changes, the prices in Cells C3:F3 will also change. In this case con-
stant price is assumed but price growth or inflation can also be factored
in. Similarly, taxation and other variables can be incorporated as per the
actual situation.

Figure 2.34 Cash flow for the calculation of breakeven price using
Goal Seek
52 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

The objective here is to find the gas price that will make the NPV
equal to zero (NPV=0). Place cursor in Cell B9 Data What-If
Analysis Goal Seek.
The Goal Seek dialog box appears as shown in Figure 2.35. Enter To
value: zero (0) and By changing cell: $B$3 and enter OK and OK again
on the Goal Seek Status dialog box. The price in Row 3 changes to $10.89
and the NPV =0.

Figure 2.35 Goal Seek dialog box for the problem in Figure 2.34

The Data Table Function


The Data Table is another Excel function under the Data and What-If
Analysis tabs. This function can also be used for sensitivity analysis on a
single variable or two variables at a time (two-dimensional sensitivity anal-
yses). Note that this function is not the same as the Table button under
the Insert tab.
We can use the Data Table function on Figure 2.32 to calculate the
monthly loan payment, principal payment, and interest payment at var-
ious interest rates. In Figure 2.34, we can use the Data Table function
to calculate the sensitivity of CAPEX (Capital Expenditure) on NPV
or the combined effect of CAPEX and OPEX (operating expenditure)
on NPV.
The following steps are followed in performing single variable sensi-
tivity analysis using the Data Table function.

1. Enter the CAPEX to be varied in Cells C9:E9 (data table range). As


many variable CAPEX can be entered as desired.
USING EXCEL’S DATA TAB 53

2. Highlight Cells B9:E10 as shown in Figure 2.36.

Figure 2.36 Using the Data Table function on the cash flow in
Figure 2.34

3. Click on Data What-If Analysis Data Table.


4. In the resulting Data Table dialog box (Figure 2.37); enter the input
cell, B6, in the Row input cell (because the CAPEX values are in a
row, versus a column). If the CAPEX values were in a column then
B6 will be entered in the Column input cell vs. a Row. This is the
input value Excel will change for each CAPEX in the data table.
5. Click on OK in the dialog box.

Figure 2.37 The Data Table dialog box with Row input cell for
Figure 2.36

6. The NPVs will be listed in Cells C10:E10 as shown in Figure 2.38.


These values will be automatically updated when any variable is
changed (downward or upward) in the cash flow. The Data Table
function will enter {=TABLE(B6,)} array in Cells C10:E10.
54 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.38 Sensitivity of NPV to changes in CAPEX using the


DATA TABLE function

Now let us repeat the sensitivity but this time using two variables
(OPEX and CAPEX) simultaneously. The following steps are followed
in performing dual variable sensitivity analysis using the DATA TABLE
function.

1. Enter the variable CAPEX in Cells C9:E9


2. Enter the variable OPEX (Operating Expenditure) in Cells B10:B14
3. Highlight Cells B9:E14
4. Click on Data What-If Analysis Data Table
5. Enter B6 in the Row input cell in the Data Table dialog box (shown
in Figure 2.39) since the CAPEX are in a Row.

Figure 2.39 Data Table dialog box for two-variable sensitivity

6. Enter C5 in the Column input cell in the Data Table dialog box
(shown in Figure 2.39) since the variable OPEX are in a Column.
Note: when using a string of the same variable, make sure that each
variable in the string is connected to the first variable (the Cell that
USING EXCEL’S DATA TAB 55

will be specified in the Data Table dialog box) in the string. It could
be just by = sign or some other formula/relationship such as showing
increasing or decreasing trend as applicable. In this example we equate
Cell D5=Cell C5, Cell E5=Cell D5, Cell F5=Cell E5 and so on.
7. Click on OK in the dialog box
8. The NPVs are generated in Cells C10:E14 as shown in Figure 2.40.
It can be seen that Cell D12 gives the same NPV as in Cell B9
because it is at the same OPEX ( $300) and CAPEX ($2,500), that
is, intersection of $2,500 and $300 in Cells B9:E14.

Figure 2.40 Using the Data Table function with sensitivity on two
variables

The Scenario Manager Function


The Excel’s Scenario Manager function on the Data tab and What-If Anal-
ysis dropdown list is used to generate scenarios such as low (worst) case
scenario, base (most likely) case scenario, and high (best) case scenario.
The following steps are followed in using the Scenario Manager func-
tion of Excel. We will use the cash flow in Figure 2.34 to show the use of
this function.

1. The first step in modeling the scenarios is to identify the cells in


the model whose values can vary in each scenario. These Cells are
selected and referred to as the Changing Cells in the worksheet.
56 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Note: As mentioned in the preceding pages, if the variables are a


string of variables such as the units sold, price per unit, OPEX, and
may be CAPEX (if it spreads beyond one year) then there should be
a relationship or link between each of these variables. For example, if
the units sold in Cell C2 is changed then the corresponding values in
Cells D2:F2 should change as well. If these values are not linked then
only the selected cell will change and the others will stay the same.
2. Click on Data What-If Analysis Scenario Manager. A blank
Scenario Manager dialog box appears as shown in Figure 2.41.

Figure 2.41 The Scenario Manager dialog box

3. Click on Add in the Scenario Manager dialog box and fill it out as
applicable:
a. Scenario name: Low Case.
b. Changing Cells: C2, C5, and B6. These Cells are referring to
(a) the units sold, (b) OPEX, and (c) CAPEX, respectively.
c. Comment: Optional, any description can be added for reference
in the future.
USING EXCEL’S DATA TAB 57

d. The completed Scenario Manager dialog box is shown in


Figure 2.42.

Figure 2.42 The Scenario Manager dialog box

4. Click on OK.
5. The Scenario Values dialog box, as shown in Figure 2.43, appears. In
the Low Case scenario we assume that the units sold will be reduced
by 10 percent, OPEX will increase by 10 percent, and CAPEX will
increase by 10 percent. So 90, 330, and 2,750 are added for the
Changing Cells C2, C5, and B6, respectively.

Figure 2.43 The Scenario Values dialog box for the Low Case scenario
58 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

6. Click on OK—This completes the Low (worst) Case scenario.


7. Repeat Steps 3 to 6 to add the Base Case and High (Best) Case sce-
narios. The scenario values for the Base Case are the same as in the
original cash flow. In the High Case, the units sold are increased by
10 percent to 110, OPEX is reduced by 10 percent to 270, and the
CAPEX is reduced by 10 percent to 2,250. The Scenario Values for
the Base Case and High Case are shown in Figures 2.44 and 2.45,
respectively. In the last scenario, click on OK instead of the Add in
the Scenario Values dialog box.

Figure 2.44 The Scenario Values dialog box for the Base Case scenario

Figure 2.45 The Scenario Values dialog box for the High Case scenario

8. The Scenario Manager dialog box appears again, this time displaying
the names of all three scenarios—Low Case, Base Case, and High
Case—in its Scenarios list box. The Scenario Manager dialog box,
incorporating the three scenarios, is shown in Figure 2.46. The result
(NPV in this case) for each scenario can be instantly observed by
clicking on the scenario in the Scenario Manager dialog box and
click on Show.
a. The Low Case will show NPV of $439.
USING EXCEL’S DATA TAB 59

Figure 2.46 The Scenario Manager dialog box showing description of


the three scenarios and the Changing cells

b. The Base Case will show the same NPV as before, that is, $1,185.
c. The High Case will show NPC of $1,931.
9. The scenarios can be updated anytime by highlighting the scenario
in the Scenario Manager dialog box and click on Edit.
10. Excel will generate a summary by clicking on the Summary in the
Scenario Manager dialog box.
a. Click on Summary in the Scenario Manager Scenario Sum-
mary dialog box (as shown in Figure 2.47) appears.
b. Tick the desired Report Type, that is, Summary or Scenario Pivot
Table Report in the Scenario Summary dialog box.
c. Link the Result Cells to the NPV in Cell B9.
11. Click OK.
12. A new worksheet, called Scenario Summary, is automatically cre-
ated as shown in Figure 2.49. This worksheet shows a table with the
assumptions of the Changing cells and the NPVs for the Low, Base,
60 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

and High Case scenarios. The actual worksheet with the Scenario
Manager settings is given in Figure 2.48 (Chapter 2 Workbook in
the folder).

Figure 2.47 The Scenario Summary dialog box

Figure 2.48 Cash flow used to illustrate Scenario Manager

Figure 2.49 The Scenario Summary worksheet created by the


Scenario Manager
USING EXCEL’S DATA TAB 61

After adding the various scenarios for a table in your spreadsheet,


remember to save the workbook after closing the Scenario Manager
Dialog box. This way, you will have access to the various scenarios
each time you open the workbook in Excel simply by opening the Sce-
nario Manager, selecting the scenario name, and clicking the Show
button.

The Solver Option


Solver is a Microsoft Excel add-in program used for What-If analysis.
Solver will solve the problems we solved using Goal Seek. Goal Seek finds
only a single unknown variable but Solver can perform iterations on mul-
tiple unknown variables. In addition, Solver also handles constraints and
finds optimal solution (maximum or minimum) based on an objective
function subject to various constrains. Solver works with a group of cells,
called decision variables or simply variable cells that are used in comput-
ing the formulas in the objective and constraint cells. Solver adjusts the
values in the decision variable cells to satisfy the limits on constraint cells
and produce the result you want for the objective cell.
Put simply, you can use Solver to determine the maximum or min-
imum value of one cell by changing other cells. For example, you can
change the amount of your projected advertising budget and see the effect
on your projected profit amount, optimize portfolio of investment sub-
ject to various budget and operational constraints, and solve many other
forms of technical problems.
There are numerous problems in the area of finance where various
optimization techniques can be applied. These problems often involve
attempting to maximize the return on investment while meeting certain
cash-flow requirements and risk constraints. Alternatively, we may wish
to minimize the risk on an investment while maintaining a certain return.
We will go over few problems with varied complexity and show you how
to use Excel’s Solver tool to solve these problems. It is believed that all the
bonds are relatively safe investments. You will see Solver under the Data
tab as shown in Figure 2.50. If this option is not visible then it needs
to be attached. The procedure for adding Solver is given in Chapter 1
(Figure 1.16).
62 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.50 The Solver function under the Data tab of the Excel
Ribbon

Four different problems are solved here using Excel to show the vari-
ety of problems Solver can solve.

Optimizing Investment Portfolio

An investor has $750,000 to invest in bonds. He is looking at the bonds


given in Table 2.2. Financial analysts recommend the following.

1. Maximum investment in each company should be limited to


25 percent of the total investment, that is, $187,500.
2. At least half the funds should be invested in long-term bonds, that is,
maturing in 10 or more years, that is, $375,000.
3. No more than 35 percent of the funds available should be invested
in the bonds with 3 and 4 rating, that is, $262,500.

Table 2.2 Bond investments under consideration


Rating
1—excellent
2—very good
Annual Maturity 3—good
Company yield years 4—fair
X1 4.65% 11 1
X2 6.50% 10 3
X3 7.00% 6 4
X4 4.75% 10 1
X5 6.35% 7 3
X6 8.00% 13 2

Based on this information, determine how to allocate the funds to


maximize return.
USING EXCEL’S DATA TAB 63

The objective function in this case is to maximize the following objec-


tive function

4.65%*X1 6.50%*X2 7.00%*X3 4.75%*X4 6.3558X5


8.00%*X6

While honoring the following constraints

X1 X2 X3 X4 X5 X6 750,000

X1 to X6 <= 25% of the 750,000, so X1 to X6 < 187,500

At least 50 percent of the funds ($375,000) should be invested in longer


maturity bond

X1 X2 X4 X6 > $375,000

No more than 35 percent of the funds ($262,500) should be invested in


the bonds with 3 and 4 rating.

X2 X3 X5 < $262,500

Since none of the variables in the model can assume a value of less than
zero, the following non-negativity constraint shall be met.

X1, X2, X3, X4, X5 & X6 >= 0

Figure 2.51 shows how this problem is setup in Excel to be ready for
the Solver. The first step in using Solver is to setup the model.
The objective function is entered in Cell B8 as SUMPRO-
DUCT(B2:B7,$H2:$H7). The H2:H7 are absolute so they will not
change if we copy this function to other cells.
Copy Cells B8 to E8 and G8

Formula for Cell E8 SUMPRODUCT(E2:E7,$H2:$H7)


64 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.51 Setting up the problem before the Solver can be used

Formula for Cell G8 SUMPRODUCT(G2:G7,$H2:$H7)

In Cells E2 to E7 we identify the long-term bonds by 1 and the bonds


with maturity less than 10 by zero (0). Note that the use of 1 and 0 is to
compute the sums of the selected decision variables is a very useful model-
ing technique that makes it easy for the user to change the variables being
included in the sums. Enter = IF(D2>=10,1,0) in Cell E2 and copy it to
E7. Similarly, enter = IF(F2>2,1,0) in Cell G2 and copy it to G7.
The = SUM(H2:H7) is entered in Cell H8 to make sure that the sum
of the selected investments does not exceed the available funds. Note that
Cells H2 to H7 are blank, Solver will fill these cells once Solver is run.
The next step is to specify the objectives and constraints to the Solver.
Click on Data Solver. The Solver parameters dialog box appears as
shown in Figure 2.52.
The following steps are used to complete the Solver Parameters dialog
box.

1. Set Objective: This is where the objective function is entered. Our


objective is to maximize our return on the $750,000 investment.
Enter B8 in the Set Objective.
2. To: Tick the Max, Min, or Value of. Since this is an investment max-
imization problem we tick the Max. If we use Solver as a Goal Seek
then we enter Value of.
3. By Changing Variable Cells: Here we enter Cells H2:H7 since iter-
ations will be performed on these to arrive at the optimum selection
of investments.
USING EXCEL’S DATA TAB 65

Figure 2.52 The Solver Parameters dialog box for the problem in
Figure 2.51

4. Subject to the Constraints: If there are any constraints these are


entered here. Click on add each time to add a new constraint. This
problem has five constraints.
a. E8 >= E9: The 50 percent constraint on the selection of longer
life investments.
b. G8 <= G9: The 35 percent constraint on investing in the 3 and
4 rating bonds.
c. H2:H7 <= C2:C7: The 25 percent constraint on investment in
each bond.
d. H2:H7>=0: The non-negativity constraint. This is to make sure
that Solver will not pick negative investment.
e. H8=H9: The total investment must not exceed the available
funds of $750,000.
66 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

5. Select a Solving Method: Since this is a linear programming (LP)


method, we select the Simplex LP method from the dropdown list.
Simplex is a method used for solving LP problems. The other two
methods are (a) GRG Nonlinear and (b) Evolutionary. The Simplex
LP and the GRG Nonlinear options are commonly used.
6. Options: We normally go with the default options.
7. Click on Solve.
8. The problem is solved as shown in Figure 2.53.

Figure 2.53 Final solution of the problem in Figure 2.51 after Solver
is applied

9. The SOLVER Results dialog box (as shown in Figure 2.54) appears
showing that solver found a solution and all constraints are satisfied.
Sometimes it will show that a solution is not found or one or more
constrains are not satisfied. In this way you may click OK and click
on Solve again. If you are not satisfied with the result, you may
cancel the run so that the numbers existing in your worksheet will
not change.
10. Click OK—The process is complete.

Fitting a Hyperbolic Curve to Actual Data

Decline curve analysis is routinely used by petroleum engineers to fore-


cast oil and gas production from oil and gas field. There are typically
three types of declines (a) exponential decline, (b) hyperbolic decline, and
(c) harmonic decline. Production from oil and gas reservoirs normally fit
one of these declines.
USING EXCEL’S DATA TAB 67

Figure 2.54 Solver Results dialog box

The following equations represent these declines.

q = qi (1 + bDi t )
−1/b
(1)
qi b
Gp = ⎡q 1−b − q1−b ⎤⎦ (2)
(1 − b ) Di ⎣ i
where
qi Initial rate, the rate at which the well initially starts producing
Di The initial rate at which the production declines (%)
b The hyperbolic exponent which controls the shape of the curve
b 0 : Exponential decline
b > 0 < 1 : Hyperbolic decline, but it could be more than 1
b 1 : Harmonic decline
t Elapsed time (days or months)
q Production rate at time t
Gp Cumulative production during period of time (days, months, or
years)
The problem is setup as shown in Figure 2.55. The following steps are
used to construct the worksheet.

1. Enter actual monthly gas production in Cells B7:B36. Thirty-six


months of actual production is available, reported in million stan-
dard cubic per month (MMSCF/month).
68 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 2.55 Worksheet setup for hyperbolic decline curve analysis


using Solver

2. Enter any arbitrary, but reasonable, numbers in Cells B1:B3.


Normally the qi should be close to the actual production in first
month, b and Di could be any fractions less than 1.0.
3. Cell C6 Cell B1.
4. Cell C7 B$1*(1 B$2*B$3*A7)^( 1/B$2) Equation (1), copy
Cell C7 to C36.
USING EXCEL’S DATA TAB 69

5. Cell D7 B$1^B$2/((1 B$2)*B$3)*(C$6^(1 B$2) C7^(1 B$2))


Equation (2), copy Cell D7 to D36.
6. Cell E7 D7 SUM(E$6:E6) To get production during the
month by subtracting the production during the previous months
from the cumulative production up to the end of current month.
Copy Cell E7 to E36.
7. Cell F7 (B7 E7)^2 This is a new Excel function to give sum of
square errors.
The Sum of Square Error (SSE) is the [(Actual Production)—
(Predicted Production)]2. Copy Cell F7 to F36.
8. Cell B4 =SUM(F7:F36) To sum all the SSE in Cells F7:F36.
9. Cell F1 =SUM(B7:B36) Sum of actual production.
10. Cell F2 =SUM(E7:E36) Sum of the predicted/matched produc-
tion in Cells E7:36.

The worksheet is now ready to use Solver. Click on Data Solver.


In the Solver Parameters Dialog box (Figure 2.56):

Figure 2.56 Solver Parameters dialog box for the problem in


Figure 2.55
70 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

1. Enter B4 in the Set Objective The objective is to minimize the SSE


2. Enter Cells B1:B3 in By Changing Variable Cells These are cells
on which Solver will perform iterations in order to minimize SSE.
3. Select the GRG Nonlinear in the Select a Solving Method.
4. Click on Solve OK.
5. The Solver Results dialog box (as shown in Figure 2.54) appears
showing that solver found a solution and all constraints are satisfied.
Sometimes it will show that a solution is not found or one or more
constrains are not satisfied. In this way you may click OK and click on
Solve again. If you are not satisfied with the result, you may cancel the
run so that the number existing in your worksheet will not change.
6. The final result is shown in Figure 2.57 with qi = 64,666, b = 1.819
and Di = 0.302. The predicted production forecast is in perfect
match (within 0.02%) with the actual production.

Figure 2.57 Final result of the production history match of Figure 2.55
USING EXCEL’S DATA TAB 71

Figure 2.58 Graphical presentation of the actual and matched


production in Figure 2.57

7. The Cell E36 can now be extended into the future to give the future
production forecast of this well. Normally, the production is fore-
casted until the q = economic limit.
8. Figure 2.58 graphically shows the actual production and the matched
production forecast.

Multiperiod Investment Optimization

In this problem we have five projects. The implementation of the projects


varies from 3 to 4 years. The annual CAPEX requirement, annual budget
constraints and NPV at IRR=10% are given in Table 2.3. The objective is
to select those projects that will meet the annual budget constraint while
maximizing the NPV.
The following steps are followed to setup the model shown in
Figure 2.59:

1. Enter the information of Table 2.3 in Excel.


2. Enter =SUM(B2:B5) in Cell B6 and copy this to Cell H6.
3. Enter the NPV of each project in Cell B8:F8.
4. Enter zeros in Cell B7:F7 These are the cells where the projects will
be selected. We use the same terminology as in the previous example,
that is, 1 for the projects selected and 0 for the projects not selected.
These will be selected by SOLVER while optimizing the NPV.
72 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Table 2.3 Multiperiod investment optimization


Project Project Project Project Project
A B C D E Budget
Year 1 1,249 1,527 417 1,089 1,982 5,000
Year 2 1,473 2,772 828 2,306 2,388 6,000
Year 3 488 1,603 156 4,452 2,020 7,000
Year 4 137 1,376 7,000
NPV at 10% 500 2,374 1,200 6,482 5,806

Figure 2.59 Multiperiod investment optimization using Solver

5. Enter =SUM(B2:F2) in Cell G2 and copy to Cell G5.


6. Manually enter the constraints in Cells H2:H5.
7. Enter =SUMPRODUCT(B$7:F$7,B2:F2) in Cell I2 and copy it to I6.
8. Enter =SUMPRODUCT(B7:F7,B8:F8) in Cell G8.
9. Solver Parameters.
a. Set Objective: G8 Objective is to maximize NPV in this cell.
b. To: Tick Max.
c. By Changing Variable Cells: B7:F7.
d. Subject to the Constraints:
i. B7:F7 = Binary This is to make sure that only a whole
project is selected because a partial project cannot be imple-
mented, that is, either select the project or not.
ii. I2:I5 <=H2:H5 This is to make sure that the each year’s
budget does not exceed the constraint for each year.
e. Select a Solving Method: Simplex LP.
f. Click on Solve.
g. Click on OK.
USING EXCEL’S DATA TAB 73

The optimized project selections are shown in Figure 2.59. Projects C,


D, and E are selected which satisfy all the constraints while maximizing
NPV. There may be sometimes a situation that the implement of one
project is dependent on one of the other projects, that is, there is project
dependency. Let us assume that there is dependency between Project A
and E. Add this constraint as B7=F7. Now Solver selects Projects B, C,
and D instead of Projects C, D, and E in the previous case.

Investment Optimization Under Total Budget Constraint

In the last section Solver was used to optimize multiperiod investment


optimization. In this section we will use Solver to optimize portfolio of
investments under total budget constraint. Figure 2.60 shows cash flows
of five projects. The NPV and Profitability Index (PI) are calculated for all
the investments. All investments are profitable and it will cost $3,989 but
due to budget limitation of $2,800 we cannot implement all the projects.
We have to select the projects, to be implemented, in such a way that we
will be within our budget constraint and at the same time maximize our
NPV (the total worth).
We will use the PI instead of the NPV because PI reflects the initial
size of the investment and it provides per dollar of investment. The PI
of 1.36 means that we return our initial investment and make $0.36 per
every invested dollar in present value terms. Our desired rate of return for
the projects is 8 percent.
The model is setup as shown in Figure 2.61. The following steps are
followed:

1. Enter all the CAPEX (Capital Expenditure) in Cells B2:B5.


2. Enter the PIs calculated in Figure 2.60 in Cells C2:C5.
3. Calculate $/CAPEX in Cell D2 by entering NPV(8%,
C13:E13)*(C2 1). The formula converts the CAPEX into Present
Value and then multiplies it by the return per dollar, which is PI—1.
Copy Cell D2 to Cell D5.
4. Leave Cells E2;E5 blank, this where the projects will be selected by
entering 1 if project is selected and 0 if project is to be rejected.
5. Enter =E2*B2 in Cell F2 and copy it to Cell F5. These cells will
calculate the CAPEX of the selected project.
74

Figure 2.60 Cash flows of five nonmutually exclusive projects


TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING
USING EXCEL’S DATA TAB 75

Figure 2.61 Selecting portfolio of investments under budget constrain

6. Enter =E2*M14 in Cell G2. This picks the NPV of the selected
project from Figure 2.60.
a. Cell E3 =E3*M19
b. Cell E4 =E4*M24
c. Cell E5 =E5*M29
7. Enter the budget constraint of $2,800 in Cell B6.
8. Enter =SUMPRODUCT(D2:D5,E2:E5) in Cell E6.
9. Enter =SUM(F2:F5) in Cell F6 and copy it to G6.
10. Click on Data Solver.
a. Set Objective: E6
b. To: Tick Max
c. By Changing Variable Cells: E2:E5
d. Subject to the Constraints:
i. E2:E5 = Binary To make sure that we get only 1 or 0 and
no fractions.
ii. F6 <= B6 This is the budget constraint to make sure that
the CAPEX of the selected investments in Cell F6 is not more
than the budget constraint in Cell B6.
c. Select a Solving Method: GRG Nonlinear.
d. Click on Solve.

The solution is given in Figure 2.61. Projects A, C, and D are selected


with a total CAPEX of $2,639 and total NPV of $705. Using NPV will
select Projects A, B, and D to give total NPV of $831 but these projects
will require $3,222 which is higher than the budget of $2,800. Similarly,
76 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

selecting Projects B, C, and D will utilize more of the available funds of


$2,789 versus $2,639 but the NPV will be reduced to $571.75 versus the
$701.
So the optimum portfolio of projects under the budget constraint of
$2,800 is Projects A, C, and D.
CHAPTER 3

Presenting Information
Using Charts
Visual presentation of our work is extremely important. As per the pop-
ular saying “picture is worth a thousand words,” that is, we can condense
lot of useful information in clear and meaningful charts to convey our
message. Remember that management does not have time to go over
your worksheets with hundreds of rows and hundreds of columns and
spread over probably 20 worksheets. Management is normally interested
to see the bottom-line results that they can use for decision making. This
objective can be very easily achieved in pictorial presentation (charts and
to-the-point bullet points in our presentations).
Most Excel users are very familiar with the basic charting of data. Here
we will go over some advanced concepts to enable us develop dynamic
charts, that is, dynamic titles (chart and axis), dynamic legends, dynamic
data capturing (if more data is added to the same chart), and so on. We
will also go through some features of using charts for forecasting future
scenarios while using historical data.

Guidelines
Consistent formatting of charts is very important to improve the overall
esthetic of the presentation. I always develop one chart template and then
keep on using this template throughout the presentation or document.
This gives more balanced look to the presentations or documents. Once
you have a template then all you have to do is change the (a) data source
and (b) change chart type. In addition, if you develop dynamic charts
then the changes will be minimal. Given below are some basic guidelines
to follow when building charts.
78 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

1. Tidiness—Create a graph with only those elements that convey use-


ful information and omit unnecessary or redundant features.
2. Background—Keep the background clear, that is, without color.
3. Gridlines—Some people do not recommend gridlines. Gridlines are
important to help the viewer easily reconcile the elements in the
graph with the values on the axis. The recommendation is to use
gridlines but select light grey color and try to keep distance between
the gridlines so they are not cluttered.
4. Marker and line colors—Use clear and easily distinguishable colors
for the markers and lines. Use same colors for the markers and the
corresponding lines.
5. Legends—It is recommended to place the legend at the bottom of
the chart or at the top of the chart. Legends can be placed inside
the chart as long as it does not cover the information. Do not insert
legend if only one data series is plotted.
6. Plot area—Excel, by default, does not cover all four sides of the plot
area, that is, the right side and the top side are left blank. It is rec-
ommended to show lines on all four sides to make the chart more
defined.
7. Sort data—If you are preparing a chart to show ranking of variables,
it is important to sort the data. If the chart has to show higher to
lower ranking (as shown in Figure 3.1) then sort the data in ascend-
ing order. If the chart has to show lower to higher ranking then sort

Figure 3.1 Horizontal bar chart showing projects’ ranking by NPV


PRESENTING INFORMATION USING CHARTS 79

the data in descending order. Figure 3.2 shows the same graph as
in Figure 3.1 but the Net Present Value (NPV) is not in any order
(decreasing or increasing). The projects on the Y-Axis are Project 4 to
Project 1 instead of Project 1 to Project 4.

Figure 3.2 Horizontal bar chart showing projects’ NPV in Figure 3.1

8. For sequential data, such as monthly revenue or cost per year, order-
ing data chronologically makes more sense, that is, starting from Jan-
uary and ending in December.
9. Chart title—Use a descriptive and self-explanatory title for the chart.
The title makes it easier for the viewer to know what the chart is
about.
10. Axis titles—If the axis titles don’t fit horizontally in a certain type of
chart then try another type of chart. It is not recommended to have
the axis titles vertical or at an angle. This can make data interpreta-
tion laborious and vulnerable to misinterpretation.
11. Thousands separator—If you have data greater than 999, use the
number format with thousands separator. This is also recommended
for the rest of the worksheets. If your data in the table is with thou-
sands separator, the chart will automatically pick that format.
12. Dynamic titles—Make your chart with dynamic axis titles, dynamic
chart title, and dynamic legends. In this way when any headings in
the chart change, the chart is automatically updated. For example,
we are plotting projects versus their respective NPV at 10 percent
discount rate. Therefore, the X-Axis shows that but if the discount
80 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

rate in the worksheet changes then the graph will change but the
axis title will not change if it is not linked to the discount rate in the
worksheet. We will later show how to do this.
13. Covered area—Try to cover at least 75 percent of the chart area
14. Primary and secondary axis—The gridlines for the primary axis and
secondary should overlap to make it easy for the viewer to reconcile
the information with the axis values.

Bubble Chart
Bubble charts are used to show correlation between three variables, that
is, X, Y, and Z. We have four projects, each project has a certain capital
expenditure requirement and generates a certain NPV. We can show this
information in two different ways. The data is given in Table 3.1.

Table 3.1 Projects with associated CAPEX and NPV


Projects CAPEX, $ NPV at 10%, $
Project 1 600 250

Project 2 950 150

Project 3 1,200 450

Project 4 1,500 200

Figure 3.3 shows a bar chart of NPV versus CAPEX. The project
names are added manually. The same data can be plotted in a bubble

Figure 3.3 Bar chart showing relationship between CAPEX and NPV
PRESENTING INFORMATION USING CHARTS 81

chart where project name, CAPEX, and NPV are collectively displayed
as shown in Figure 3.4. This bubble chart is more descriptive and clearly
shows the relationship between the projects, CAPEX, and NPV.

Figure 3.4 Bubble chart showing relationship among CAPEX, NPV,


and projects. The bubbles show relative size of the NPV for each
project versus the respective CAPEX

Dynamic Charting
Dynamic charting means that whenever you change data range (delete or
add more data), axis titles, chart title, legends, and so on, the charts are
automatically updated. Creating dynamic charts requires advanced skills
beyond the ordinary charting skills. It requires the source data to be a
dynamic range. There are basically two methods available that I use most
of the time, that is, the table method and the formula method.
The data ranges for Figure 3.3 are shown in Figure 3.5. In ordinary
situation we will drag the range down number of cells required to accom-
modate additional data as shown in Figure 3.6. Now when we enter data
in Cells A6:C6, the chart in Figure 3.3 will be updated with the new
range of data. The new data range and the resulting chart are shown in
Figures 3.7 and 3.8, respectively.
We can do the same exercise by using Excel’s table function. The first
step is to create the table. This can be done with the existing data as shown
in Table 3.1 and Figure 3.5. The following steps will be used.
82 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 3.5 The data range used in the bar chart in Figure 3.3

Figure 3.6 Manually extending the range of data to be plotted for the
chart in Figure 3.5

Figure 3.7 Adding Project 5 to the chart in Figure 3.3


PRESENTING INFORMATION USING CHARTS 83

Figure 3.8 Figure 3.3 updated with additional project

1. Select the data range in Cells A1:C6.


2. Click the Insert tab in the Ribbon.
3. In the Tables group, click on Table. The Create Table dialog, as
shown in Figure 3.9 will appear with the data range highlighted.
This data range can be changed as required. If the selected range
does not have headers then the “My table has headers” in Figure 3.9
should be unticked.

Figure 3.9 The Create Table dialog box under the Table tab

4. Click OK and Excel will format the data range as a table shown in
Figure 3.10.
84 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 3.10 Table 3.1 converted into Excel Table

Now you can just add more data in Row 7 and the chart in Figure 3.8
will be automatically updated. This method has one disadvantage though,
if you delete data in Row 6, the bar in the chart will disappear but it will
create empty space in the Chart. This can be fixed by dragging the last row
of the table one row upward. This limitation is with bar charts, the line
charts will not have this limitation.

The Dynamic Formula Method

Another method to use is typically called the Dynamic Formula method.


This method does not require the data range to be converted into the table.
This method relies on dynamic ranges that update automatically, similar to
the way the table does as shown above. Only the initial setting requires some
formulation but it is not difficult and can be managed with some practice.
Figure 3.11 shows annual production of the United States, Canada,
and Mexico. We need to present this data in a stacked column (bar) chart
for each year. We have four dynamic ranges (Years, U.S. production,

Figure 3.11 Annual North America oil production


PRESENTING INFORMATION USING CHARTS 85

Canada production, and Mexico production). A normal static chart is


created, as shown in Figure 3.12, as we would normally do.

Figure 3.12 A static chart is created, using data of Figure 3.11, as


we would normally create

Use the following instructions to create dynamic labels for Columns


A to D.

1. Click on Formula tab.


2. Click on Define Names option in the Defined Names group.
3. Enter a name for the dynamic ranges as shown in the New Name
dialog box as shown in Figure 3.13.

Figure 3.13 Creating new Range Name or editing existing Range


Name
86 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

a. Name—YearLabels for Column A, USSeries for Column B, Can-


adaSeries for Column C, and MexicoSeries for Column D. The
Range Name for YearLabels is shown in Figure 3.13.
b. Comments—Optional.
c. Scope—The Scope of the New Name (Range Name) is selected as
the worksheet name (Fig 3-17). This means that the Range Names
are limited for use in this worksheet only and not the entire
workbook.
d. Refers to—Enter the formula OFFSET(‘Fig 3-17’!$A$3,0,
0,COUNTA(‘Fig 3-17’!$A:$A)-1). The -1 is used because the
reference starts from A3 but it tells Excel that the row before this
contains headings.
e. Click OK.
4. Click on Formula Name Manager in the Defined Names.
5. Click on New to add another series.
6. Repeat Step 3 for USSeries, CanadaSeries, and MexicoSeries. The
formula for each are given below.
OFFSET(‘Fig 3-17’!$B$3,0,0,COUNTA(‘Fig 3-17’!$B:$B)-1)
OFFSET(‘Fig 3-17’!$C$3,0,0,COUNTA(‘Fig 3-17’!$C:$C)-1)
OFFSET(‘Fig 3-17’!$D$3,0,0,COUNTA(‘Fig 3-17’!$D:$D)-1)
7. Now right click on the static chart developed in Figure 3.12.
Click on Select Data, the Select Data Source dialog box appears as
shown in Figure 3.14. Click on Canada Click on Edit. You will

Figure 3.14 Select Data Source dialog box to edit the data series
PRESENTING INFORMATION USING CHARTS 87

see Figure 3.15a. In the Series Values, replace the $C$3:$C$6 by


USSeries as shown in Figure 3.15.

(a)

(b)

Figure 3.15 Edit series dialog box for the chart

8. Repeat Step 7 for CanadaSeries and MexicoSeries.


9. Repeat Step 7 for the horizontal axis labels by clicking on the first
YearLabel (2011) and click Edit. The axis labels dialog appears as
shown in Figure 3.16a. Replace the $A$3:$A$6 by the Range Name
YearLabels as shown in Figure 3.16b. You only change the first label,
the rest will be automatically changed.
10. Click OK.
11. The worksheet is now ready for dynamic charting. Enter the 2014
data in Row 6 and see how the chart in Figure 3.12 is updated.
Deleting a row will also automatically adjust the horizontal axis. The
chart with the 2014 data is shown in Figure 3.17.
88 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

(a)

(b)
Figure 3.16 Axis labels dialog box to edit the horizontal axis

Figure 3.17 Dynamic Chart created using the above steps

Waterfall Chart
When making projects’ economics or financial statements or income
statement presentations to management, many times we are asked “why
there is difference in the profitability indicators or net income or cash
flow you are presenting today vs. what you presented few months ago?”
PRESENTING INFORMATION USING CHARTS 89

The management wants to see the variables or assumptions that have


made the difference to help them in their judgment and decision making.
This question is appropriately answered through variable-by-variable rec-
onciliation of the differences in profitability indicators, net incomes, net
cash flows, or annual budgets presented at two different times.
A Waterfall Chart, also referred to as Bridge Chart, is a great visual
or graphical reconciliation of two outcomes at two different times or two
different analysts. Typically, the chart reconciles between a high value in
the past with a lower value in the present (current situation) or vice versa.
The chart can be routinely used in the following situations.

1. Reconciliation of project or investment profitability indicators


(NPV, LRMC, IRR, etc.) calculated at two different occasions.
2. Reconciliation of project or investment profitability indicators cal-
culated by two different departments within the same organization.
3. Reconciliation of project or investment profitability indicators calcu-
lated by two different joint venture partners.
4. Reconciliation of income statements at two different dates.
5. Showing the breakdown of funds’ inflow and outflow, leading to a
final net income value.
6. Arriving at Netback value.

Google search shows many different ways of constructing a waterfall


chart, some are easy to build and some are more cumbersome. Three
of the methods, with step-by-step instructions, are shown here to rec-
oncile the difference between a project’s Long Range Marginal Cost
(LRMC) calculated by two different departments in the same organi-
zation. Review of economics models of the two departments showed
differences in assumptions. Comparison of the various assumptions is
shown in Table 3.2.
The first step in generating a waterfall chart is to reconcile the differ-
ences by determining the effect of each variable on the bottom-line prof-
itability indicators that are reported to management. In this exercise, it is
assumed that Department XYZ’s assumptions are correct. The objective
now is to calculate the effect of each assumption on the LRMC and show
the result graphically in a waterfall chart. The cash flow of ABC is used
90 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Table 3.2 Comparison of assumptions used by two departments for


economic evaluation
Department Department LRMC
Variable ABC XYZ of ABC Delta
LRMC, $/MMBtu 7.68 4.02
Discount rate 9.4% 6.5% 6.53 –1.15
Economic Life, Years 20 25 6.59 0.06
Income Tax rate 25% 0% 5.47 –1.12
(After-Tax (Before-Tax
LRMC) LRMC)
Inflation per year 3% 2.5% 4.86 –0.61
Facility CAPEX, MM$ 4,119 3,500 4.22 –0.64
Pipeline CAPEX, MM$ 4,859 2,500 4.02 –0.20

to assess the effect of each assumption by changing each assumption at a


time until we arrive at the LRMC of $4.02/MMBtu.

Method No. 1 (Using Excel 2010 and 2013)

Follow the following steps to generate the waterfall chart. These methods
are used with Excel 2010 and 2013. Excel 2016 has a built-in waterfall
chart function that we will also use later.

1. Enter the data in Excel as shown in Figure 3.18. The LRMCs


obtained by changing each variable are shown in C2 to C7. The
deltas are shown in Columns D to I. The 1.15 in Cell D2 is the delta
between 7.68 in Cell B1 and 6.53 in Cell C2 (D2 B1 – C2) and so
on. The LRMC in B1 and J8 are called PILLARS.

Figure 3.18 The LRMCs obtained by changing each assumption and


the resulting delta
PRESENTING INFORMATION USING CHARTS 91

2. Highlight Cells A1 to B8 as shown in Figure 3.19 INSERT


Insert Column Chart Stacked Column. The graph shown in
Figure 3.19 will appear.

Figure 3.19 Inserting the stacked vertical column chart

3. Click on the bottom right corner of B8 and drag it to J8. This will
highlight Columns B to J and complete the raw chart as shown in
Figure 3.20.

Figure 3.20 Preliminary waterfall chart, requires further formatting


92 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

4. Right click on one of the bottom-most bars Format Data Series


Change Fill to “No Fill” and Outline to “No Outline” or Border
to “No Line.”
5. Add data labels to the bars and format them
6. Change color of the Fall Bars (the Deltas). The negative Deltas may
be color-coded green and positive deltas may be color-coded red and
so on. The final desired waterfall chart is shown in Figure 3.21.

Figure 3.21 The final desired waterfall chart

Method No. 2 (Using Excel 2010 and 2013)

The same dataset is used to generate a waterfall chart. The following steps
will be followed.

1. Arrange the data of Table 3.2 in Excel as shown in Figure 3.22.


a. The BASE column is the calculated LRMC used as a starting
point for the FALL and RISE series in the chart.
b. All the negative deltas from the DELTA Column are placed in
the FALL column and all the positive deltas are placed in the
RISE column.
c. Select Cell C2 in the FALL column and enter the formula:
IF(E2<=0,E2,0).
d. Select D2 in the RISE column and enter the formula:
IF(E2>=0,E2,0).
PRESENTING INFORMATION USING CHARTS 93

Figure 3.22 Excel data for the waterfall chart (Method No. 2)

e. Copy Cells C2:D2 to C9:D9.


f. Enter the base LRMC ($7.68/MMBtu) in Cell B2.
g. Enter the formula B2 C3 D3 in Cell B3 and copy it down to
Cell B9.
2. Now create a standard stacked column chart.
a. Highlight Cells A2 to D9 as shown in Figure 3.22 INSERT
Insert Column Chart Stacked Column. The graph shown
in Figure 3.23 will appear.
b. Now repeat Steps 4 to 6 of Method No. 1 to format the final
waterfall chart as shown in Figure 3.23.

Figure 3.23 Final waterfall chart resulting from using Method No. 2
94 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

3. The Excel table as shown in Figure 3.24 can also be used. In this
version the START LRMC ($7.68/MMBtu) and the END LRMC
($4.02/MMBtu) are in Column B (B2 and B9, respectively) and
identified as PILLARS.
a. The FALL and RISE are given in Cells C2:D9.
b. The formula in Cell C3 is B2 D3 E3.
c. The formula in Cell C4 is C3 D4 E4 and it is copied down
to C8.

Figure 3.24 Alternative Excel data for the waterfall chart in


Figure 3.23

Method No. 3 (Using Excel 2016)

A waterfall chart, in these examples, was shown to reconcile the differ-


ences between LRMC of a project. The same approach can be used to
reconcile IRRs, NPVs, and other variables or parameters. The Excel 2016
has a built-in chart option to generate a waterfall chart. Follow the follow-
ing steps to generate a waterfall chart using Excel 2016.

1. Arrange the data as shown in Figure 3.25. Enter the beginning


value in Cell B2 and the deltas in Cells B3:B8. Enter the formula
SUM(B2:B8) in Cell B9.
2. Highlight Cells A2:B9.
3. Click on the Insert tab Click on the Waterfall Chart button (it
is the one with the bars going both above and below the horizontal
axis) Waterfall Chart Type.
4. The chart will be created.
PRESENTING INFORMATION USING CHARTS 95

Figure 3.25 Data for waterfall chart using Excel 2016

5. Format the chart as required.


6. If there are subtotals in the data, double click on the data point and
in the Format Data Point option, check the “Set as Total Box.” In this
way the chart will not add or subtract the value of the subtotal to the
other values. It should be displayed as total or subtotal in the chart.

Tornado Diagram
Tornado diagrams or tornado chart are modified version of horizontal
stacked bar charts. It is one of the classic tools used to assess the sensitivity
of various variables to the profitability of the project or investment. The
Tornado diagram is used by decision makers to have a quick overview
of the risks involved. In other words a Tornado diagram or chart shows
financial analysis for a project or investment.
There are add-in tools available that will help in construction Tornado
diagrams but it can also be easily constructed using Excel’s graphing capa-
bilities. The following steps are required to get data ready for constructing
a Tornado diagram.

1. First determine the profitability (rate of return, NPV, profitability


index or long-range marginal cost) of the project or investment using
the base values for all the variables. The base values are the most
96 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

likely values which are considered as the most likely case in the best
professional judgment of the analyst.
2. Then vary each variable by ±25 percent and calculate the profitabil-
ity indicators. For example if the base CAPEX is 1,000 MM$ then
the –25 percent would be 750 MM$ and the 25 percent would be
1,250 MM$. In this way you will get three profitability indicators
(let us say NPV at a certain discount rate). The three NPVs will be
the Base Case NPV, NPV resulting from 25% CAPEX, and NPV
resulting from 25 percent CAPEX.
3. In some cases the ±25 percent may not be feasible. For example infla-
tion rate of 1, 2, or 3 percent per year. On the other hand, tax rate of
30, 35, or 40 percent, and so on.

Figure 3.26 shows such sensitivities performed on an investment. The


CAPEX, oil price, and OPEX are varied by ±25 percent. The discount rate
for the base NPV is 10 percent, the lower discount rate is 8 percent and
the higher discount rate is 12 percent. The base inflation rate is 2 percent
per year, the low is 1 percent per year, and the high is 3 percent per year.
Once all the calculations are performed, arrange the data as shown
in Figure 3.26. The data have to be sorted in ascending order. The lowest
variation from the base at the top and the highest variation in profitability
at the bottom. When these data are plotted they will produce a wider bar
at the top and narrower bar at the bottom as shown in Figure 3.27.
In Figure 3.26, the first three columns a manual entries (the NPVs
resulting from variations in the listed variables). Enter the formula
IF(C3<=D3,C3 D3,B3 D3) in Cell E3 and copy it to Cell E7. Enter

Figure 3.26 Data for a Tornado diagram


PRESENTING INFORMATION USING CHARTS 97

Figure 3.27 Raw (needs formatting) Tornado diagram

the formula =IF(B3>D3,B3 D3,C3 D3) in Cell F3 and copy it Cell F7.
Now follow the following steps to construct the Tornado diagram.

1. Highlight Cells A3:A7.


2. Hold down the Ctrl key and at the same highlight Cells E3:F7.
3. Click on INSERT tab in the Excel Ribbon.
4. In the Charts tab, click on Insert Bar Chart and select the horizon-
tal stacked bars. The chart shown in Figure 3.27 is generated. The
chart needs to be formatted to make it clear, visually appealing and
clear. Note that the bars will be colored (colors will be automatically
selected by Excel). I have changed the colors for the purpose of this
book.
5. Add data labels to the bars.
6. Move the Y-Axis to the left end of the chart. Right click on the
Y-Axis labels Format Axis Click on Labels Select Low in
the Label Position.
7. Change the series names: Series1 is lower than base and Series2 is
higher than base.

The final Tornado diagram is shown in Figure 3.28. The Tornado dia-
gram tell us that CAPEX, Oil Price, and Discount rate are most sensitive
to the NPV. Any small variation in these can significantly increase or
decrease the NPV. The OPEX and inflation are not very sensitive to the
profitability. In short, the wider the bars more sensitive are these variables
98 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 3.28 Final version of the Tornado diagram

to profitability. The narrower the bars less sensitive are these variables to
profitability.
There are other variations to this typical Tornado diagram in which
the negative impact of profitability is shown on the left side of the base
and positive impact is shown on the right side of the base. Construct-
ing the diagram is same on the setting up the data is slightly different.
This kind of Tornado diagram shows the negative and positive impact of
changes in variables on the profitability. Figure 3.29 shows the NPVs for
changes in various variables. The Base Case NPV is calculated based on
15 percent discount rate.

Figure 3.29 Sensitivity analysis of various variables on profitability


(NPV)

The following steps are required to construct this type of Tornado


Diagram.

1. Highlight Cells A2:A7.


2. Hold down the Ctrl key and at the same highlight Cells C2:D7.
PRESENTING INFORMATION USING CHARTS 99

3. Click on INSERT tab in the Excel Ribbon.


4. In the Charts tab, click on Insert Bar Chart and select the hori-
zontal clustered bars. The chart shown in Figure 3.30 is generated.
The chart needs to be formatted to make it clear, visually appealing,
and meaningful. Note that the bars will be colored (colors will be
automatically selected by Excel). I have changed the colors for the
purpose of this book.

Figure 3.30 Raw (needs formatting) horizontal clustered bar chart


for data in Figure 3.20

5. Formatting the chart generated in Figure 3.30.


a. Right click on any one bar.
b. Click on Format Data Series.
c. In the Series Options menu, select 100 percent for Series Overlap
and 85 percent for Gap Width.
d. Right click on Y-Axis titles Click on Format Axis Tick the
Categories in reverse order.
e. Right click on X-Axis In the Axis Options menu change Min-
imum to 500, Maximum to 2,870, Major Units to 395, tick Axis
value in Vertical axis crosses, and enter 2,080 for the Axis value.
This will show the base NPV of 2,080 in the middle of the chart.
The 395 is obtained by (2,870–500)/6 395. There are six divi-
sions between 2,870 and 500.
f. Right click on the Y-Axis Click Format Axis Click Labels
Select Low in the Label Position.
100 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

g. The Tornado diagram is now almost ready. You need to do other


formatting as desired. The final Tornado diagram is shown in
Figure 3.31

Figure 3.31 Another version of the Tornado diagram

Interpretation of the Tornado diagram in Figure 3.31. The Base Case


NPV is 2,080 MM$.

1. Increasing the discount rate from 15 to 25 percent reduces the NPV


to 781 MM$.
2. Decreasing the discount rate from 15 to 12 percent increases the
NPV to 2,757 MM$.
3. Two-year delay in project reduces the NPV to 1,583 MM$.
4. Applying 20 percent royalty reduces the NPV to 1,779 MM$.
5. Increasing the Federal Income tax to 40 from 35 percent reduces the
NPV to 1,858.
6. Increasing the CAPEX by 35 percent reduces the NPV to 1,890.
7. Reducing the OPEX to 25 MM$ per year constant increases the
NPV to 2,105.

Spider Diagram
Spider diagram is another presentation for the sensitivity assessment of
various variables on the profitability. It gives the same message as the
Tornado diagram but in a line chart rather than the bar chart.
PRESENTING INFORMATION USING CHARTS 101

The data of Figure 3.26 is used to generate a Spider diagram. The dis-
count rate and inflation are not included in the Spider diagram because
these were not varied by ±25 percent. The X-Axis will be the variation in
Variables. The Spider diagram is shown in Figure 3.32.

Figure 3.32 Spider diagram for the data in Figure 3.26

In the Spider diagram, the steeper the slope of the line more sensitive
this variable is to the profitability. The shallower the slope of the line less
sensitive this variable is to the profitability. The OPEX line is with very
shallow slope showing that OPEX is not very sensitive to profitability.
The Tornado diagram also showed a very narrow bar for the OPEX, con-
firming what the Spider diagram is showing.

Multivariable Cross-Plots
Creating multivariable charts are becoming very popular. These charts
help in correlating variables in all the four quadrants of a graph and the
final result is obtained in the last quadrat. The first thing to do is, of
course, the sensitivity analysis on the desired variables. An example is
presented here that correlates Drilling Cost per well with the respective
LRMC (long range marginal cost) with the reserves per well. The result-
ing LRMC is then plotted against the LRMC of various facilities CAPEX
(pipeline and gas plant capital expenditure.
102 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Table 3.3 shows the data obtained from sensitivity analysis of various
drilling costs versus the reserves per well.

Table 3.3 LRMC ($/MMBtu) for various drilling costs and reserves/
well (Base facility CAPEX = 625 MM$)
Drilling cost/ 7.33 10.99 BSCF/ 21.40 BSCF/
well MM$ BSCF/well well well
10 6.97 5.02 3.17
15 8.35 5.95 3.67
20 9.72 6.88 4.18
25 11.09 7.81 4.69
30 12.47 8.74 5.19

Table 3.4 shows another set of sensitivities, that is, various facilities’
Capital Expenditures (CAPEX) versus the reserves per well.

Table 3.4 Faculties’ CAPEX vs. reserves per well


Base LRMC Base
column 2 of CAPEX CAPEX CAPEX CAPEX
Table 3.3 625 MM$ 925 MM$ 1,225 MM$ 1,525 MM$
6.97 (6.97) (7.33) (7.70) (8.06)
8.35 (8.35) (8.71) (9.07) (9.43)
9.72 (9.72) (10.08) (10.45) (10.81)
11.09 (11.09) (11.46) (11.82) (12.18)
12.47 (12.47) (12.83) (13.19) (13.56)

Now we build the first chart, Scatter Chart, for the data in Table 3.3
as we will normally do. Highlight Cells A3 to D7 Insert Scatter
Chart. The chart is created, format the chart as shown in Figure 3.33. The
X-Axis is the drilling cost and the Y-Axis is the Long Range Marginal Cost
(LRMC in $/MMBtu), also referred to as the breakeven gas price. Note
that the Y-Axis is not labeled yet as the LRMC will be read on the X-Axis
in the second quadrant.
Add linear trend lines through the data points in Figure 3.33.
Now add the data of Table 3.4 to the same chart. Note that the LRMCs
in Table 3.4 are not negative. Since they will be plotted in the second quadrant
PRESENTING INFORMATION USING CHARTS 103

Figure 3.33 Correlation between the drilling cost per well vs. the
reserves per well

on the X-Axis, their sign is changed from positive to negative. This is a very
important point to remember.
Right click on the chart Select Data Add X-Axis is G3:G7
and Y-Axis is F3:F7 OK.
Repeat the same step for all the other CAPEX (H3:H7 vs. F3:F7,
I3:I7 vs. F3:F7 and J3:J7 vs. F3:F7). Add trend line through each data
series in the second quadrant. The raw chart is shown in Figure 3.34.
Now we need to hide the Y-Axis labels and overwrite the negative X-Axis

Figure 3.34 Raw multivariable chart (requires further formatting)


104 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

labels. Follow the following step to hide the Y-Axis. I have removed the
legend from Figure 3.33 and instead put them on the respective lines in
the chart as shown in Figure 3.34.
Right click on the Y-Axis Format Axis Labels Label Position
NONE.
Now hide the negative numbers on the X-Axis in the second quadrant
and make the axis label for it. The axis label is done by using the following
step.
Click on Insert Shapes Rectangle (draw a rectangle) Right click
on the Rectangle Click on Add text Enter 15, 10 and 5 Change
the Fill color Remove the lines. Move the Rectangle over the negative
X-Axis labels and format to make sure the labels represent the major axis.
Repeat the above step to insert the X-Axis title for the second quad-
rant. Alternatively, edit the existing X-Axis title “Drilling Cost per Well,
MM$” by entering “LRMC, $/MMBtu” before it. And format the
placing of the title.
Figure 3.35 shows the final version of the multivariable cross plot. It
correlates the (a) drilling cost per well, (b) reserves per well, and (c) facili-
ties’ CAPEX. To read the LRMC, the following steps are required.

1. Enter the chart with the drilling cost.


2. Go vertically up to the desired reserves per well.

Figure 3.35 Final version of the multivariable cross plot for the data
in Tables 3.3 and 3.4
PRESENTING INFORMATION USING CHARTS 105

3. Go to the left to the desired CAPEX in the second quadrant of the


chart.
4. Go vertically down to the X-Axis to read the LRMC.

So if the drilling cost is 15 MM$ per well, the reserves per well are
10.99 BSCF and the facilities CAPEX is 1,525 MM$ then the LRMC will
be about $7.0/MMBtu (as shown in Figure 3.35). At facilities’ CAPEX
of 625 MM$, the LRMC from the chart would be approximately $6/
MMBtu (the actual $5.95/MMBtu).
In the same way, LRMCs at another set of variables can be added in
the third and fourth quadrants. Instead of the LRMC, NPVs can also be
correlated in the same way.

Interactive Chart
In this section we will show how to select data for charting using the Form
Controls or ActiveX Controls such as the Check Box (Form Control) or
Radio Button (Form Control) discussed in Chapter 1.
Figure 3.36 shows total revenue, cost of revenue and operating income
or loss for Exxon Mobile for 2014 to 2016. We want to generate an inter-
active chart to be able to show all or some of the variables in the chart
using the Form Controls.

Figure 3.36 2014–2016 Financial performance of Exxon Mobil


106 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Cells B3:D5 in Figure 3.36 show the annual total revenue, cost of
revenue and operating income or loss of Exxon Mobile Corporation. In
Cells B7:D7 we enter the Check Box (Form Controls) for each of these
parameters (the procedure is explained in Chapter 1). Link the outcome
of each Check Box to the cells underneath (i.e., Cells B8, C8, and D8).
These cells will show TRUE if the Check Box is ticked and FALSE if the
Check Box is not ticked. The TRUE means plot this parameter and the
FALSE means do not plot the parameter.
Enter the formula IF($B8 TRUE,B3,NA()) in Cell B10 and drag
it to Cell D10. Now highlight Cells B10:D10 and drag them down to
Cells B12:D12. The NA() in the formula enters #N/A if the selection is
FALSE. Whenever, you do not want to plot any of the variables, replace
these by #N/A. You can use this in manual plotting as well.
The interactive chart is now ready as shown in Figure 3.37. Since only
the first two parameters are ticked, these are shown in the chart. You can
also do similar chart where you can select the year for which you want to
show the data, that is, you can select to show data for 2014 only or 2014
and 2016 only and so on.

Figure 3.37 Interactive Chart showing financial performance of


Exxon Mobil

To make the Axis Titles, Chart Titles, Legends, and so on dynamic so


that when these change in the model, the chart is automatically updated.
Click on the Chart Title Enter the formula ‘Fig 3-36’!$A$1 in the
Formula Bar (OR Enter “ ” and link Cell A1 in the Formula Bar). Click
PRESENTING INFORMATION USING CHARTS 107

on the Y-Axis Title Enter the formula ‘Fig 3-36’!$A$9 in the For-
mula Bar (OR Enter “=” and link Cell A9 in the Formula Bar).
This becomes very handy when variables change. For example, you
are plotting discounted net cash flow at 10 percent discount rate versus
time. The X-Axis title in your chart shows years and the Y-Axis title is
manually entered to show “Discounted Cash Flow at 10 percent, MM$.”
Now if you change the discount rate in the input sheet to 15 percent,
the chart will be updated but the Y-Axis title will not be updated.
However, if the Y-Axis title is linked to a cell where the heading is “Dis-
counted Cash Flow at 10 percent, MM$” then the axis title will automat-
ically change. The heading has to be entered in a cell as “Discounted
Cash Flow at “&A1*100&”%, MM$” assuming the discount rate is
given in Cell A1.

Correlating Variables
Excel has built-in options to show correlations between variables. This
feature is available in scatter charts. Right click on the Data Series
Add Trendline Select Trendline Option Tick Display Equation on
Chart Tick Display R-Squared Value on Chart. The Display Equation
on chart will show correlation between the X-Axis data and Y-Axis data.
The R-Squared (R2) shows the correlation of correlation (goodness of fit)
between the data. The R2 1 is perfect correlation and R2 0.5 is poor
correlation (not very strong correlation). Following are the Trendline
Options available in Excel.

1. Exponential
2. Linear
3. Logarithmic
4. Polynomial (this could be 2nd order, 3rd order polynomial, and so on)
5. Power
6. Moving Average

The Format Trendline Option also gives option to forecast forward


or backward. Figure 3.38 shows a very simple chart with linear Trend-
lines for each set of data. The Coefficient of Correlation and straight line
108 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 3.38 Adding Trendlines, Equations, and R2 to datasets

equations are given on the chart. These are generated by the Trendline.
The Trendline equations also provide the slope and intercept of the lines.
The slope for Set 1 data is 1.5 with intercept 12.5. The slope of Set 2 data
is –1.5 with intercept of 87.5.
In some cases the chart may not be required but the correlation has to
be determined in order to use the historical trend to forecast the future.
Following are some of the Excel functions that can be used to find the
correlation between sets of data and other parameters such as slope, inter-
cept (equation of the correlation).

1. The CORREL Function


The CORREL function is used to calculate the Coefficient of
Correlation (R2) between a set of data. The syntax for this function is

CORREL(array1, array2)

array1 the X-Axis data and array2 Y-Axis data. The Excel
worksheet (Fig 9-38) shows the use of CORREL function in Cells
B7 and C7 for Set 1 and Set 2 data, respectively. The formula
CORREL(A3:A6,B3:B6) is entered in Cell B7 to calculate R2 for
the data Set 1 and CORREL(A2:A6,C2:C6) in Cell C7 to calculate
the R2 for data Set 2. These calculations are shown in Figure 3.39.
PRESENTING INFORMATION USING CHARTS 109

Figure 3.39 Showing correlations between two sets of data

A line with negative slope will show negative R2 and the line with
positive slope will show positive R2. The message is same, that is, how
strong is the relationship between the two datasets. The negative R2
only shows that the line is sloping downward (similar to the line of
Set 2 in Figure 3.38).
2. The TREND and FORECAST Functions
As mentioned above the TREND and FORECAST functions of
Excel are used to forecast the future based on historical linear trend.
The fitting of a straight line using the method of least squares (linear
regression) to the datasets.
The syntax for these two options is:
TREND(known_y’s, [known_x’s], [new_x’s], [const])
FORECAST(x, known_y’s, [known_x’s])
Following are the arguments for these two functions.
a. Known_y’s—A set of known Y-Axis values in the dataset. The
data can be in a ROW or COLUMN.
b. Known_x’s—A Set of known X-Axis values in the dataset. The
number of data points in both Y-Axis and X-Axis data must be
same (i.e., pairs). The array Known_x’s can include one or more
sets of variables.
c. New_x’s or x—New X-Axis values for which the corresponding
Y-Axis values have to be forecasted.
d. Const—Could be TRUE or FALSE. The FALSE means to forces
the correlation through intercept 0. The TRUE means to calcu-
late the intercept of the correlation. The default is TRUE.
110 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Both functions can be used as an array formula (to be entered as


CTRL SHIFT ENTER) if forecast of more than one New_x’s has
to be generated.
The use of these two functions is shown in Figure 3.39. The for-
mula TREND(B2:B6,A2:A6,D2,TRUE) in Cell E2 shows that
if the X-value is 55 then the corresponding Y-value will be 95. The
FORECAST function in Cell E6 gives the same answer.
Cells E3:E5 use the array form of the FORECAST function. Place
the Cursor in Cell E3 Enter the formula FORECAST(D3:D5,
B2:B6,A2:A6) Simultaneously Click on CTRL SHIFT ENTER.
Now drag Cell E3 down to Cell E5. The Cells D3:D5 in the formula
refer to the new X-Axis values for which the corresponding Y-Axis
values have to be calculated.
The array form of the TREND function will generate similar
results as shown in Cells E7:E9.
5. The SLOPE and INTERCEPT Functions
This function returns the slope of the linear regression line through
a set of known X-Axis and known Y-Axis values (the data has to be
in pairs).
The syntax for these options is:
SLOPE(known_y’s, known_x’s)
INTERCEPT(known_y’s, known_x’s)
Arguments for this option are the same as in the FORECAST
option above. There is no x since it is used only to calculate the
Slope of the line and not forecast the future trend. The SLOPE and
INTERCEPT functions are used in Cells B10 and B11, respectively.
The slope and intercept calculated in Cells B10 and B11 are the same
as shown in Figure 3.38, that is, Y 1.5x 12.5 (slope 1.5 and
Intercept 12.5).
The data have to be transformed, that is, to use the data on log-
log plot or semi logarithmic graph paper. For log-log graph the func-
tion will be SLOPE(LOG(known_y’s),LOG(known_x’s)) and so on.
If the X-Axis is linear and Y-Axis is logarithmic the function becomes
SLOPE(known_y’s, LOG(known_x’s)) and vice versa.
The SLOPE and INTERCEPT of a dynamic data range can
also be calculated by using the IF and ISNUMBER functions. For
PRESENTING INFORMATION USING CHARTS 111

example, how would calculate the slope and intercept of a set of data
when the dimensions could change, that is, adding or deleting data
from the range specified in the SLOPE and INTERCEPT function.
Figure 3.40 shows a dataset in which the SLOPE and INTER-
CEPT can be calculated for up to eight data pairs. The cells where
there is not data, enter NA() function in those cells as shown in
Figure 3.40.

Figure 3.40 Calculating SLOPE and INTERCEPT of a dynamic


range of data

Enter the formula {SLOPE(IF(ISNUMBER(B2:B9),(B2:B9)),


IF(ISNUMBER(A2:A9),(A2:A9)))} in Cell B10 to calculate
the SLOPE. Enter the formula INTERCEPT(IF(ISNUM-
BER(B2:B9),(B2:B9)),IF(ISNUMBER(A2:A9),(A2:A9))) in Cell
B11 to calculate the INTERCEPT. Both the formulas have to be
entered as an array formula.
6. The LINEST Function
This function is different from the functions presented above. It cal-
culates the statistics for a line using the least squares method. It can
112 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

be used for linear, polynomial, logarithmic, exponential, and power


series. It can handle equations such as Y mx b or Y m1x1
m2x2 . . . . . b.
The syntax for this option is:
LINEST(known_y’s, [known_x’s], [const], [stats])
The function syntax has the following arguments.

a. Known_y’s—A set of Y-Axis value already known.


b. Known_x’s—A set of X-Axis values already known.
c. Const—A logical value specifying whether the line has to go through
the zero intercept or calculate the natural intercept. If the logical
value is TRUE, it will calculate the natural intercept. If the logical
value if FALSE, it will set the intercept to zero, that is, forcing the
line through the zero intercept.
d. Stats—A logical value specifying whether to return additional regres-
sion statistics. If the Stats is TRUE, it will return an array of addi-
tional regression statistics. If the Stats is FALSE, it will only return
the slope and the intercept.

Calculating Intersection of Two Lines


The intersection of the two lines in Figure 3.38 can be calculated using
the SLOPE and INTERCEPT functions. The following equation is used.

INTERCEPT(C2:C6,A2:A6) – INTERCEPT(B2:B6,A2:A6)
Intersection =
SLOPE(B2:B6,A2:A6) – SLOPE(C2:C6,A2:A6)
CHAPTER 4

Automating Worksheets
In this chapter we will discuss the use of Macros and Visual Basic for
Application (VBA), that is, automating the execution of tasks requiring
many repetitive steps.

Macros and VBA


Many times we have to perform repeated tasks and each time we have
to go through clicking on various tabs and options to complete the task.
Macros are basically a recording of mouse clicks, keystrokes, and mouse
movement in the worksheet. Macros remember the steps we have to fol-
low in completing a certain task. Lot of times we use Macros to solve
problems requiring SOLVER or Goal Seek. Macros can also accommo-
date nested IF statements in a closed loop.
The Macros button is under the View tab on the Excel Ribbon or
under the Developer tab. As previously discusses, if the Developer tab is
not visible on the Ribbon, it should be activated using the following steps.
Click File Options Customize Ribbon Main Tabs
Developer OK
The expert software developers remember the Visual Basic language
for writing codes. For those of us who are not professional developers,
we can still do a very good job in automating some of our desired tasks
because Excel provides a Macro recording option. We go in the Macro
recording mode and then start solving the problem manually as we will
normally do. All the steps we perform to solve the problem are recorded
by Excel Macro recorder in VBA. The VBA is a subset of the powerful
Visual Basic programming language, and is included with most Office
applications.
When all the steps are complete then the Macro recording is stopped.
Since we are not expert developers there may be sometimes redundant or
114 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

repetitive steps in the Macro because the Macro Recorder captures almost
every move we make during the recording. These redundant and repet-
itive steps have to be edited. It is really not very difficult to understand
the moves (VBA Code) recorded by the Macro Recorder and identify and
edit the redundant or repetitive steps. Now the Macro is ready to perform
the required task at a click of a button.
Once the Macro is developed it is then assigned to a Form Control
button. So Clicking on the button automatically runs the Macro. Alter-
natively, the Macro can also be run manually. The following few guide-
lines need to be kept in mind when developing Macros.

1. Macros are range specific, that is, performing a set of tasks in a spec-
ified range (Rows and Columns) in Excel. If the Cells are altered by
adding or deleting Rows, Columns, or Cells then the Macro will give
error. The Macro will stop running when it does not encounter the
recorded Cells.
2. A very long Macro, handling multiple tasks, should be split into sev-
eral smaller Macros to avoid mistakes and enabling debugging easier.

Recording a Macro
As mentioned above, this option is mostly for the people who are not
experts in Visual Basic programming language. The expert developers can
write the VBA code without relying on this option. A Macro or VBA
code lists all the steps required to solve a certain problem especially if the
problem requires repetitive calculations.
The Macro icons (Macros and Record Macro) are given under the
Developer tab of the Excel Ribbon as shown in Figure 4.1. The Macro
icon can also be accessed from the VIEW tab on the Excel Ribbon as

Figure 4.1 The Macro icons under the Developer tab of Excel’s
Ribbon
AUTOMATING WORKSHEETS 115

shown in Figure 4.2. By clicking on this icon a dropdown list will appear
which will show (a) View Macros, (b) Record Macros, and (c) Use Relative
References.

Figure 4.2 The Macro icon under the View tab of Excel’s Ribbon

Figure 4.3 shows a simple loan amortization calculation. The user


wants to calculate the total amount of money he can borrow if he can
afford to pay $2,000 per month. We can solve this problem by entering
the formula PMT(B3/B4,B2*B4,B1) in Cell B5 and then use Goal Seek
to find the loan amount while changing the value in Cell B5 to –$2,000.

Figure 4.3 Manually calculating the loan amount

The following steps are required to manually solve the problem:

1. Place the Cursor in Cell B5.


2. Click on the DATA tab in the Excel Ribbon.
3. Click on What If icon in the DATA tab.
4. Click on Goal Seek. Cell B5 is shown in the Set Cell of the Goal Seek
dialog box as shown in Figure 4.4.
5. Enter –2000 in the To value in the Goal Seek dialog box.
6. Link the By changing to cell B1.
7. Click OK.
8. The recalculated loan amount based on the $2,000 monthly pay-
ments is $105,981 as shown in Figure 4.5.

We can do the same calculations through a Macro. So when we


activate the Macro, the calculations will be automatically performed at a
116 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 4.4 Manually using Goal Seek to find out the loan amount for
a specified monthly payment

Figure 4.5 Calculated loan amount based on the $2,000 monthly


payment using Goal Seek

Click of a button. The Macro will follow the Steps 1 to 7 listed above. The
following steps are followed to develop a Macro.

1. Click on Developer tab.


2. Click on Record Macro in the Code tab.
a. The Record Macro dialog box appears.
b. Macro name: The Macro Name “Macro1” automatically appears
in the Record Macro dialog box as shown in Figure 4.6. Each time
you click on the Record Macro the Macro Name will change. You
can also change the Macro Name to give it a different name.
c. Shortcut key: You can assign a short key called Ctrl+ key. For
example, you can assign Ctrl+M so each time you Click Ctrl+M
the Macro will be executed.
AUTOMATING WORKSHEETS 117

Figure 4.6 The Record Macro dialog box for recording a Macro

d. Store Macro in: Gives you option to (a) store the Macro in
Personal Macro Workbook, (b) New Workbook, or (c) This
Workbook. If the Macro is going to be used in the workbook
only then it is better to store it in This Workbook.
e. Description: Here you can enter brief description of what the
Macro will do.
3. Place the cursor in Cell B5 if it is not already in the Cell.
4. Click on DATA tab.
5. Click on What If Analysis in the Data Tools tab.
6. The Goal Seek dialog box appears.
a. Set cell: Enter B5 if it is not already there.
b. To value: Enter –2000.
c. By changing cell: Enter B1.
7. Click OK.
8. Goal Seek Status dialog box appears showing the Target value and
Current value. Click OK.
9. Click on Developer tab or View tab.
10. Click on Stop Recording.
118 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

The Macro is now recorded. To view the Macro, click on Macros


The Macro dialog box appears as shown in Figure 4.7. The Macro dialog
box allows you to:

1. Run Macro: Click on Run to execute the Macro and perform the
desired calculations.
2. Step Into: To see the Visual Basic code generated by the Record
Macro.
3. Edit: Click on Edit to open the Code.
4. Delete: To delete any of the Macros. Highlight the Macro to be
deleted and click on Delete.
5. Options: Gives you option to assign Short Cut Key and Macro
description.

Figure 4.7 The Macro dialog box

To view the Macro code, highlight the Macro and click on Step Into.
The Macro code for the recorded Macro is shown in Figure 4.8.
Save the workbook. When you save the Workbook just by clicking on
SAVE, it will give you error message and will alert you that the workbook
has a Macro and you cannot save it as regular workbook. Click on OK
AUTOMATING WORKSHEETS 119

Figure 4.8 The Visual Basic code for the recorded Macro

on the error message and then click on SAVE AS. A dropdown list will
appear showing various files options. Select Save As “Excel Macro-Enabled
Workbook.” All Macro-Enabled workbooks will have an exclamation mark
“!” in the right hand corner of the Excel icon. This exclamation mark dis-
tinguishes between the Workbooks with and without macros.
If you are not prepared or if you do not follow the precise steps
required to solve a problem and you start recording, many unnecessary
steps will be recorded by the Macro recorder. Also while you are recording
a Macro, the steps required to solve the problem are followed correctly
and recorded but you forget to Stop Recording. Whatever you do until
the Macro recording is stopped, all steps will be recorded which will not
be relevant to the problem you are trying to solve. Figure 4.9 shows a
Macro to solve the same problem as in Figure 4.8 but it has several unnec-
essary steps.

Figure 4.9 Macro showing redundant lines of Visual Basic code


120 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

When you see all these extra steps, you have to identify the steps that
are really needed and then delete the extra steps that are not required.
Sometimes the extra steps may not affect execution and function of the
Macro but most of the time it could be detrimental and perform actions
that are not required. In Figure 4.9 (Macro2), the first five lines and the
last two lines of the code are redundant and shall be deleted. In this par-
ticular case the first five lines will not affect the calculation but it will just
make the Macro go through few unwanted steps. The last two lines will
affect because they will take you to Figure 4.9 after the Macro solves the
problem.
The start and end of the Macro are defined by (a) Sub Macro1() and
(b) End Sub, respectively. Inside these two we can also call another Sub
Macro and when that Macro reaches its End Sub then it comes back to
the same spot in the Macro where it was asked to go to the other Macro.

One-Click Execution of a Macro


As mentioned above, the Macro can be executed by clicking on RUN in
the Macro dialog box. This may not be very efficient way of executing a
Macro. The alternative is to either assign the Macro to a Shortcut Key
or to a One-Click button. The Shortcut Key can be assigned as shown
in Figure 4.6. The One-Click button can be incorporated following the
steps below.

1. Click on the Developer tab.


2. Click on Insert in the Controls tab.
3. Click on the Button (Form Control) in the Forms Control drop-
down list.
4. Insert the Button (Form Control) in some blank space in the work-
sheet. When the Button is inserted, an Assign Macro dialog box will
appear asking you to Assign Macro. Highlight the Macro (Macro1,
Macro2 …. Macro_n) in the Assign Macro dialog box as required. If
you do not want to assign Macro here, just click Cancel.
5. Edit the text in the Button, initially it will show the Button number
(Button1, Button 2 etc.). Right click on the Button click on the Edit
Text in dialog box shown in Figure 4.10 Edit the text as required.
AUTOMATING WORKSHEETS 121

6. The Macro can be assigned, reassigned, or changed any time.


a. Right click on the Button.
b. A dropdown list will appear as shown in Figure 4.10.
c. Click on Assign Macro.
d. The Assign Macro dialog box will appear.
e. Highlight the Macro which you want to assign to the Form
Button Control.
f. Click OK.
g. SAVE.
h. The Macro1 is now assigned to the Form Control Button in
Figure 4.11. The Macro can now be executed by clicking on this
Form Button.

Figure 4.10 Dropdown List for Assigning Macro to the Form Control
Button

Nested Loops in a Macro


As mentioned above, the Macro recording will work in simple cases but
when it comes to complex operations then user editing will be required.
You can use the Macro recording to get the codes for various steps and
then go over these steps and try to tailor the code to fully automate it.
122 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 4.11 The Form Control Button with Macro Assigned to it

Figure 4.12 shows a problem that we want to solve using a Macro.


Column B shows the revenue generated by each well. Column J shows
our target revenue to achieve. Column K shows the matched target reve-
nue. Column L shows the number of wells required to achieve the target
revenue.
The objective is to use Excel’s Goal Seek function to find the number
of wells to be drilled each year in order to achieve the target revenue for
each year. The first thing is to set up the model before we can use the Goal
Seek. The steps below are followed to set up the model.

1. Cell C2: Enter the formula B2*L$2 and drag it to Cell C8.
2. Cell D3: Enter the formula B2*L$3 and drag it to Cell D8.
3. Repeat these steps for Cells E4, F5, G6, H7 and I8.

Figure 4.12 Calculating the number of wells to achieve target


revenue
AUTOMATING WORKSHEETS 123

4. Cell K2: Enter the formula SUM(C2:I2) and drag it down to Cell K8.
5. Now we are ready to record a Macro to perform Goal Seek on each
Cell.
a. Click on Developer tab Record Macro Macro3 (Macro3
will be assigned automatically since there are already two Macros
before from Figure 4.9).
b. Click on Data What If Analysis Goal Seek.
c. Set Cell: to K2.
d. To Value: 30000.
e. By Changing Cell: L2.
f. Repeat these steps for Cells K3, K4, and K5.
g. Click on Developer tab Stop Recording.

The recorded Macro is shown as follows. The result is shown in


Figure 4.13.

Figure 4.13 Figure 4.12 after the calculations are performed using
Macro3

Sub Macro3()

‘ Macro3 Macro


Range(“K2”).GoalSeek Goal: 30000, ChangingCell: Range(“L2”)
Range(“K3”).Select
124 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Range(“K3”).GoalSeek Goal: 29000, ChangingCell: Range(“L3”)


Range(“K4”).Select
Range(“K4”).GoalSeek Goal: 28200, ChangingCell: Range(“L4”)
Range(“K5”).Select
Range(“K5”).GoalSeek Goal: 27560, ChangingCell: Range(“L5”)
End Sub

The recorded Macro is fine, it has performed the calculations cor-


rectly but:

1. The Macro is not flexible, that is, if the targets are changed—the
matched target will not change because the Macro shows hard-coded
target revenues. We can add three more lines of Code to address
Ranges K6, K7, and K8 by copying one of the lines and paste it three
times after the last line. We should then edit the three lines to make
sure the Range, Goal, and Changing Cell references are correct. This
will add more flexibility but then it will give error or incorrect num-
ber of wells if the target cells are empty.
2. There are redundant steps in the Macro.
3. The Macro will not calculate the matched target if we enter another
target revenue in Cell J6.

We can edit the Macro to fix some of the above problems as shown
below. In the edited version, the redundant codes are deleted and the
additional target cells are manually added and edited. The revised Macro
is shown below.

Sub Macro3()

‘ Macro3 Macro


Range(“K2”).GoalSeek Goal: 30000, ChangingCell: Range(“L2”)
Range(“K3”).GoalSeek Goal: 29000, ChangingCell: Range(“L3”)
Range(“K4”).GoalSeek Goal: 28200, ChangingCell: Range(“L4”)
Range(“K5”).GoalSeek Goal: 27560, ChangingCell: Range(“L5”)
AUTOMATING WORKSHEETS 125

Range(“K6”).GoalSeek Goal: 27048, ChangingCell: Range(“L6”)


Range(“K7”).GoalSeek Goal: 26638, ChangingCell: Range(“L7”)
Range (“K8”).GoalSeek Goal: 26311,
ChangingCell: Range(“L8”)
End Sub

The Macro still has two limitations (a) hard-coded Goals and (b) the
Macro will not stop if the targets are empty. In the Macro below the hard
coded targets are replaced by the Range Cell reference [Range(“J2”) to
Range(“J8”)] as shown below.

Sub Macro3()

‘ Macro3 Macro


Range(“K2”).GoalSeek Goal: Range(“J2”),
ChangingCell: Range(“L2”)
Range(“K3”).GoalSeek Goal: Range(“J3”),
ChangingCell: Range(“L3”)
Range(“K4”).GoalSeek Goal: Range(“J4”),
ChangingCell: Range(“L4”)
Range(“K5”).GoalSeek Goal: Range(“J5”),
ChangingCell: Range(“L5”)
Range(“K6”).GoalSeek Goal: Range(“J6”),
ChangingCell: Range(“L6”)
Range(“K7”).GoalSeek Goal: Range(“J7”),
ChangingCell: Range(“L7”)
Range (“K8”).GoalSeek Goal: Range(“J8”),
ChangingCell: Range(“L8”)
End Sub

Now only one limitation is left, that is, to stop the calculations when
the Macro encounters empty target cells. This limitation is eliminated by
adding IF statement in the Macro as shown below. The If ActiveSheet.
Range(“J2”).Value = ”” Then Exit Sub tells the Macro that if the Target
126 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Cell is empty then Exit the Macro. The “Sub” is an abbreviation for
Subroutine.
Copy the following Macro Developer Macros Edit Paste
Macro4 at the end of the existing Macros.

Sub Macro4()

‘ Macro4 Macro


If ActiveSheet.Range(“J2”).Value ”” Then Exit Sub
Range(“K2”).GoalSeek Goal: Range(“J2”),
ChangingCell: Range(“L2”)
If ActiveSheet.Range(“J3”).Value ”” Then Exit Sub
Range(“K3”).GoalSeek Goal: Range(“J3”),
ChangingCell: Range(“L3”)
If ActiveSheet.Range(“J4”).Value ”” Then Exit Sub
Range(“K4”).GoalSeek Goal: Range(“J4”),
ChangingCell: Range(“L4”)
If ActiveSheet.Range(“J5”).Value ”” Then Exit Sub
Range(“K5”).GoalSeek Goal: Range(“J5”),
ChangingCell: Range(“L5”)
If ActiveSheet.Range(“J6”).Value ”” Then Exit Sub
Range(“K6”).GoalSeek Goal: Range(“J6”),
ChangingCell: Range(“L6”)
If ActiveSheet.Range(“J7”).Value ”” Then Exit Sub
Range(“K7”).GoalSeek Goal: Range(“J7”),
ChangingCell: Range(“L7”)
If ActiveSheet.Range(“J8”).Value ”” Then Exit Sub
Range (“K8”).GoalSeek Goal: Range(“J8”),
ChangingCell: Range(“L8”)
End Sub

Assign Macro4 to another Button in the worksheet and change the


text to show that by clicking on this button, Macro4 will be executed.
Macro4 is now flexible and all the limitations are eliminated.
AUTOMATING WORKSHEETS 127

However, can you imagine how the code will look like if you had to
match targets for 20 years or so? The code will be very crowded and may
be subject to other logic errors because it becomes too cumbersome to
edit properly.
This problem can also be solved by incorporating all the steps in a
nested IF Loop as shown in Macro5 below.

Sub Macro5()

‘ Macro5 Macro


Dim i As Integer
For i 2 To 8
If ActiveSheet.Range(“J” & i).Value ”” Then Exit Sub
Range(“K” & i).GoalSeek Goal: Range(“J” & i), ChangingCell:
Range(“L” & i)
Next
Range(“A1”).Select
End Sub

Macro5 shows the use of the “&” function to combine (CONCATE-


NATE) the Cell reference with the integer.
On the first iteration, all the Cell references (J, K, and L) are changed
to J2, K2, and L2 sine the integer “i” starts from 2. The reason we are
using 2 and 8 as the limits is because the Goal Seek starts in Row 2 and
ends in Row 8. Calculations are performed. When the Macro sees NEXT,
it starts again from the For i = 2 To 8.
On the second iteration it changes the cell references to J3, K3, and
L3. Every time the Macro goes back, it remembers the count and accord-
ingly changes the cell references. After every For i = 2 To 8 the Macro first
tests if the Target Cell is empty or not. If the Target Cell is empty then it
skips the next steps and goes to the End Sub.
Enter the above Macro as Macro5 in the same worksheet. Macros can
be added to the existing Macros by Clicking on Developer tab Macro
Enter A in Macro Name Click on Create as shown in Figure 4.14.
128 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

Figure 4.14 Adding Macro to exiting Macros

Now copy the above Macro (Macro5) and paste it in-between the Sub
Macro5() and End Sub. Assign this Macro to another Form Control
Button in the same worksheet.
The final worksheet is shown in Figure 4.15 with all the Macros devel-
oped in this section.

Figure 4.15 Final version of Figure 4.12


AUTOMATING WORKSHEETS 129

You can also develop code for nested loops as shown below.

Sub MacroX()

‘ MacroX Macro

Dim i As Integer, j As Integer
For i 1 To 2
For j 1 To 5
Cells(i, j).Value WorksheetFunction.RandBetween(20, 100)
Next j
Next i
End Sub

Using SOLVER in Macro


The investment optimization problem in Figure 2.59 (Chapter 2) is used
to automate the SOLVER operation. The Record Macro option of Excel
is used to record the Macro. The following VBA code is recorded by
Excel.

Sub Macro6()

‘ Macro6 Macro


SolverOk SetCell: “$G$8”, MaxMinVal: 1,
ValueOf: 0, ByChange: “$B$7:$F$7”, _
Engine: 2, EngineDesc: “Simplex LP”
SolverAdd CellRef: “$B$7:$F$7”, Rela-
tion: 5, FormulaText: “binary”
SolverAdd CellRef: “$I$2:$I$5”, Rela-
tion: 1, FormulaText: “$H$2:$H$5”
SolverOk SetCell: “$G$8”, MaxMinVal: 1,
ValueOf: 0, ByChange: “$B$7:$F$7”, _
Engine: 2, EngineDesc: “Simplex LP”
130 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

SolverOk SetCell: “$G$8”, MaxMinVal: 1,


ValueOf: 0, ByChange: “$B$7:$F$7”, _
Engine: 2, EngineDesc: “Simplex LP”
SolverSolve
End Sub

This code, as is, will not work. Lot of editing is required to make it to
function correctly. Following is the revised Code. Note, that many dialogs
are same but with some redundancy.

Sub Macro7()
Application.Run “SolverReset”
Application.Run “SolverOK”, “$G$8”, 1, 0, “$B$7:$F$7”, _
2, “Simplex LP”
Application.Run “SolverAdd”, “$B$7:$F$7”, 5, “binary”
Application.Run “SolverAdd”, “$I$2:$I$5”, 1, “$H$2:$H$5”
Application.Run “SolverSolve”, True
Range(“G8”).Select
End Sub

Following are the differences between Macro6 (recorded by the Macro


Recorder) and Macro7 (the edited version).

1. Each line in the Code must start with Application.Run, this is telling
Excel that Solver is an Application. The Macro recorder does not
insert this argument in the Code in Macro6
2. SolverOK, SolverSolver, and SolverAdd are the same in both Macros
but in Macro7 each is enclosed in double quotes while in Macro6
they are not enclosed in double quotes.
3. In Macro6 the other arguments in the Solver Parameters dialog box
are referred to by sequence number, that is, no description such as
MaxMinValue, ValueOf, ByChange, FormulaText, and so on. As
shown in Figure 4.16, Max 1, Min 2, Value Of 3 and the value
is zero if Max or Min are selected otherwise the required value has
to be entered.
AUTOMATING WORKSHEETS 131

Figure 4.16 The Solver Parameters dialog box

4. Cell references in Macro6 are preceded by CelLRef . Macro7 does


not use the text CellRef.
5. The Change Constraints in Macro6 are preceded by the text
Relation . In Macro7 only reference number of the constraint is
specified. The reference numbers of the constraints are shown in
Figure 4.17.

Figure 4.17 The Change Constraint dialog box for SOLVER


132 TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING

6. In Macro6, the Solving Method (Search Engine) is preceded by the


text Engine . Macro7 only specifies the reference number and enter
the Solving Method in double quotes.
7. At the end, Macro6 enters SolverSolve but does not specify if it is
TRUE or FALSE. Macro7 specifies TRUE.

Debugging a Macro
When a Macro is developed, it may sometimes have errors in it and these
errors need to be corrected. When a Macro with errors is executed, it
will stop execution when it reaches a Code that is not correct or it is
not recognized by Excel. The Microsoft VBA error message, as shown in
Figure 4.18 will appear. Click on OK, you will be taken the VBA Code
and the Code that has error will be highlighted in yellow. This is where
the Macro execution stopped.

Figure 4.18 The Macro Compile error warning

Correcting this error is referred to as debugging. The process of debug-


ging a Macro in VBA is the same as debugging in any other programming
language. The process of debugging requires stepping through the Code
one command at a time and carefully reviewing the logic. The F8 key can
be used to step through the Macro line-by-line. In this process you will
also examine the Code for any redundant command. Once you get used
to writing Macros, it becomes very easy to recognize the commands and
how they will perform when the Macro is executed.
AUTOMATING WORKSHEETS 133

Common VBA Arguments


Table 4.1 shows some commonly used VBA arguments. Try some of these
codes to get a feel for the VBA. These are just some samples, you can
always find a specific Code by using the Record Macro.

Table 4.1 Example of VBA codes


Argument Function
Cells(1,1) Refers to Row1 Column1, that is, A1.
Cells(1,4) “Yong” inserts Yong in Cell D1
Range(“A1”).Select Select Cell A1—Same as Cells(1,1)
Sheets(“Sheet2”).Range(“A5”) “Yong” Go to Cell A5 in Sheet2 and enter Yong
Range(“B2:C4”).Select Selects Cells B2, B3, B4, C2, C3 and C4
Range(“B2:C4”).Select Selects Cell B2:C4 and changes fills the
Selection.Interior.ColorIndex 3 Cells with Red color.
1—Black, 2—White, 3—Red, 4—Green
5—Blue, 6—Yellow, 7—Purple
Range(“A1:B4”).Copy Copies the contents from Cells A1:B4 and
Range(“E1”).Select pastes them in Cell E1:F4 in the same sheet
ActiveSheet.Paste where the content is; the Copy mode is
Application.CutCopyMode False then deactivated
Range(“A1:D5”).Clear Clears the contents and Format of Cells
A1:D5
Range(“A1:D5”).ClearContents Only the data in these Cells will be deleted
Sheet(“SheetName”).Cells.Clear Clear the content and format of the entire
worksheet
Sheets(“SheetName”).Cells. Clears only the contents of the entire
ClearContents worksheet
Range(“A1:B4”).Font.ColorIndex 3 Changes the Font color to Red in Cells
A1:B4
Range(“A1:B4”).Font.Bold Changes the Font to bold in Cells A1:B4
Range(“A1:B4”).Merge Merges the Cells A1:B4
Range(“A1:B4”).UnMerge Unmerge Cell A1:B4
Range(“A1”).ClearComments To add and clear comments in Cell A1
Range(“A1”).AddComment
Range(“A3”).AddComment Adds a Comment to Cell A3
Range(“A3”).Comment.Text
Text: “This is Example Comment Text”
About the Author
M. A. Mian has more than 35 years of experience in the oil and gas
industry. He has worked with Saudi Aramco as a Sr. Petroleum Engineer-
ing Consultant, with Qatar Petroleum as Head of QP Operations and
Planning, Keplinger & Associates (International Energy Consultants in
Denver, Colorado, USA), and as an independent consultant in Colorado,
USA. He has extensive experience in Project Economics and Decision
Analysis. His working experience includes petroleum reservoir engineer-
ing, economic evaluation of multibillion-dollar oil and gas projects, and
building financial/economics models.
He had been involved in developing economics models for the
economic evaluation of oil and gas field development projects, LNG
plants, power plants, oil refineries, NGL recovery plants, and Oil and
Gas fiscal regimes. He delivers short courses on Project Economics, Risk
and Decision Analysis (intermediate and advanced levels), and Interna-
tional Fiscal Regimes. He has delivered courses in more than 25 countries
worldwide and recognized as a subject matter expert (SME) in Project
Economics.
Mian is the author of four books: (a) Petroleum Engineering Hand-
book for the Practicing Engineer, Volume 1 and 2 and (b) Project
Economics and Decision Analysis, Volume 1 and 2. He has also published
several technical articles in the oil and gas trade journals. Mian has a BSc
in Mechanical Engineering, MSc in Petroleum Engineering, and MSc in
Mineral Economics. Both the masters’ degrees are from Colorado School
of Mines, Golden, Colorado, USA. Mian is also a registered professional
engineer (PE) in the State of Colorado, USA.
Index
ActiveX controls, 12, 27, 105 Data Validation
ampersand (&), 8 dialog box, 2–3, 30
error alert dialog box, 32
bubble chart, 80–81 function, 29–32
Button (Form Control), 15–16 debugging Macros, 132
DEVELOPER tab, 12
CAPEX (Capital Expenditure), 52–55 dropdown list
cash flow, 44–49 dependent, 3–12
consolidated, 47–48 simple, 1–3
Data Table function on, 53 dynamic charting, 81–88
to illustrate Scenario Manager, 60 Dynamic Formula method, 84–88
using Goal Seek, 51–52
chart(s) Flash Fill function, 32–34
bubble, 80–81 FORECAST function, 109–110
dynamic, 81–88 Form Control, 12–27
guidelines, 77–80 Button, 15–16
interactive, 105–107 Check Box, 18–21
multivariable, 101–105 Combo Box, 17–18
scatter, 107–112 Group Box, 25
spider, 100–101 inserting, 14–15
tornado, 95–100 Label, 25
waterfall, 88–95 List Box, 22–24
Check Box (Form Control), 18–21 Option Button, 24–25
Combo Box (Form Control), 17–18 Scroll Bar, 26–27
CONSOLIDATE function, 44–49 Spin Button, 21–22
according to position, 44–47 uses of, 13–15
into existing template, 47–48 Format Trendline Option, 107–108
using formula, 48–49 function(s)
control(s) Data Analysis, 29
ActiveX, 27 CONSOLIDATE, 29, 44–49
Form Control, 12–27 CORREL, 108–109
CORREL function, 108–109 Data Validation, 29–32
correlating variables, 107–112 Flash Fill, 29, 32–34
creating FORECAST, 109–110
dependent dropdown list, 3–12 Group, 29, 36–38
dynamic chart, 81–84 INDIRECT, 8
multivariable charts, 101–105 INSERT, 14
new Range Name, 85 INTERCEPT, 110–111
simple dropdown list, 1–3 LINEST, 111–112
Remove Duplicates, 29, 34–36
Data tab, Excel, 29–76 Scenario Manager, 55–61
Data Table option, 52–55 SLOPE, 110–111
138 INDEX

SOLVER, 29, 62 Macro recording option, 113


SUBTOTAL, 29, 38–44 Modify, 12
TREND, 109–110 multivariable chart, 101–105
Ungroup, 29, 36–38
What-If Analysis, 29, 49–52 nested loops in Macros, 121–129
See also Option(s) net present value (NPV), 51

Goal Seek option, 49–52 one-click execution of Macro,


Goal Seek Status, 50 120–121
Group Box (Form Control), 25 OPEX (operating expenditure),
Group function, 36–38 52–55
optimization. See investment
HLOOKUP, 3 optimization
hyphen (-), 8 optimizing investment portfolio,
hyperbolic curve analysis, 66–71 62–66
Option Button (Form Control),
INDIRECT formula, 11 24–25
INDIRECT function, 8 Option(s)
INSERT function, 14 Data Table, 52–55
inserting Format Trendline, 107–108
check boxes, 20 Goal Seek, 49–52
form controls, 14–15 Macro recording, 113
Scroll Bar, 26–27 Scenario Manager, 55–61
stacked vertical column chart, 91
interactive chart, 105–107 pricing worksheet, 3–12
INTERCEPT function, 110–111 Profitability Index (PI), 73
intersection of two lines, 112 push button. See Button (Form
investment optimization Control)
multiperiod, 71–73
portfolio, 62–66 Radio Button. See Option Button
under total budget constraint, rate of return (IRR), 51
73–76 recording Macro, 114–120
Remove Duplicate function, 34–36
Label (Form Control), 25–26
LINEST function, 111–112 scatter chart, 107–112
List Box (Form Control), 22–24 Scenario Manager option, 55–61
Long Range Marginal Cost (LRMC), Scroll Bar (Form Control), 26–27
89–90 shortcut key, 116
SLOPE function, 110–111
Macro(s) SOLVER in Macros, 129–132
debugging, 132 Solver option, 61–76
icons, 114–115 hyperbolic decline curve analysis
nested loops in, 121–129 using, 66–71
one-click execution of, 120–121 investment optimization under
recording, 114–120 total budget constraint, 73–76
using SOLVER in, 129–132 multiperiod investment
and VBA, 113–114 optimization, 71–73
INDEX 139

optimizing investment portfolio, Macros and, 113–114


62–66 visual presentation in Excel.
spider diagram, 100–101 See chart(s)
Spin Button (Form Control), VLOOKUP, 3
21–22
SUBSTITUTE formula, 11 waterfall chart, 88–95
SUBTOTAL function, 38–44 worksheet(s), Excel
automating, 113–133
tornado diagram, 95–100 check boxes inserted in, 20
TREND function, 109–110 consolidated, 45–49
hyperbolic decline curve analysis,
Ungroup function, 36–38 68
inserting form controls in, 14–15
variables, correlating, 107–112 pricing, 3–4
Visual Basic for Application (VBA)
code, 13, 133 XML commands, 12
OTHER TITLES IN OUR FINANCE AND FINANCIAL
MANAGEMENT COLLECTION
John A. Doukas, Old Dominion University, Editor

• Financial Services Sales Handbook: A Professionals Guide to Becoming a Top Producer


by Clifton T. Warren
• Money Laundering and Terrorist Financing Activities: A Primer on Avoidance Management
for Money Managers by Milan Frankl and Ayse Ebru Kurcer
• Introduction to Foreign Exchange Rates, Second Edition by Thomas J. O’Brien
• Rays of Research on Real Estate Development by Jaime Luque
• Weathering the Storm: The Financial Crisis and the EU Response, Volume I: Background
and Origins of the Crisis by Javier Villar Burke
• Weathering the Storm: The Financial Crisis and the EU Response, Volume II: The Response
to the Crisis by Javier Villar Burke
• Rethinking Risk Management: Critically Examining Old Ideas and New Concepts
by Rick Nason
• Towards a Safer World of Banking: Bank Regulation After the Subprime Crisis
by T.T. Ram Mohan
• Escape from the Central Bank Trap: How to Escape From the $20 Trillion Monetary
Expansion Unharmed by Daniel Lacalle

Announcing the Business Expert Press Digital Library


Concise e-books business students need for classroom and research

This book can also be purchased in an e-book collection by your library as

• a one-time purchase,
• that is owned forever,
• allows for simultaneous readers,
• has no restrictions on printing, and
• can be downloaded as PDFs from within the library community.

Our digital library collections are a great solution to beat the rising cost of textbooks. E-books
can be loaded into their course management systems or onto students’ e-book readers.
The Business Expert Press digital libraries are very affordable, with no obligation to buy in
future years. For more information, please visit www.businessexpertpress.com/librarians.
To set up a trial in the United States, please email [email protected].
THE BUSINESS Tips & Tricks for Excel-Based

MIAN
EXPERT PRESS
DIGITAL LIBRARIES
Financial Modeling
A Must for Engineers & Financial Analysts,
EBOOKS FOR Volume II
BUSINESS STUDENTS
Curriculum-oriented, born- M. A. Mian
digital books for advanced The purpose of this work is to show some advanced concepts
business students, written related to Excel based financial modelling. Microsoft Excel™
by academic thought

TIPS & TRICKS FOR EXCEL-BASED FINANCIAL MODELING, VOLUME II


is a very powerful tool and most of the time we do not utilize
leaders who translate real-
its full potential. Of course, any advanced concepts require the
world business experience
basic knowledge which most of us have and then build on it. It
into course readings and
is only by hands-on experimentation that one learns the art of
reference materials for
constructing an efficient worksheet.
students expecting to tackle
management and leadership The two volumes of this book cover dynamic charting, macros,
challenges during their goal seek, solver, the routine Excel functions commonly used,
professional careers. the lesser known Excel functions, the Excel’s financial functions
and so on. The introduction of macros in these books is not
POLICIES BUILT
BY LIBRARIANS exhaustive but the purpose of what is presented is to show
you the power of Excel and how it can be utilized to automate
• Unlimited simultaneous
usage most repetitive calculations at a click of a button. For those who
• Unrestricted downloading use Excel on a daily basis in financial modeling and project/
and printing investment evaluations, this book is a must.
• Perpetual access for a
M. A. Mian has more than 35 years of practical experience in the
one-time fee
• No platform or oil and gas industry. He has worked with major oil companies
maintenance fees such as Saudi Aramco and Qatar Petroleum. His working
• Free MARC records experience includes petroleum reservoir engineering and
• No license to execute economic evaluation of multi-billion-dollar oil and gas projects.
The Digital Libraries are a He had been involved in developing economics models for the
comprehensive, cost-effective economic evaluation of oil and gas field development projects,
way to deliver practical LNG plants, power plants, oil refineries, NGL recovery plants,
treatments of important and Oil & Gas fiscal regimes. He delivers short courses on project
business issues to every economics, risk & decision analysis (intermediate and advanced
student and faculty member. levels), and international fiscal regimes. He has delivered courses
in more than 25 countries worldwide and recognized as a subject
matter expert (SME) in project economics. Mian is the author of
four books and technical articles. He has a BSc in mechanical
For further information, a
engineering, MSc in petroleum engineering, and MSc in mineral
free trial, or to order, contact: economics.
[email protected]
Finance and Financial Management
www.businessexpertpress.com/librarians
Collection
John A. Doukas, Editor
ISBN: 978-1-63157-948-6

You might also like