Click on the Data tab in the Ribbon.Click on the Data Validation icon, the Data Validation dialog box, as shown in Figure 1.2, appears.. Figure 1.7 The defined Range Names in the Name Ma
Trang 2Tips & Tricks for
Excel-Based Financial Modeling
Trang 3Tips & Tricks for
Excel-Based Financial Modeling
A Must for Engineers & Financial Analysts
Volume II
M A Mian, PE
Trang 4Tips & 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 anyform 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
Collection ISSN: 2331-0049 (print)
Collection ISSN: 2331-0057 (electronic)
Cover and interior design by Exeter Premedia Services PrivateLtd., Chennai, India
First edition: 2017
10 9 8 7 6 5 4 3 2 1
Printed in the United States of America
Trang 5The purpose of this work is to show some advanced conceptsrelated to Excel based financial modeling Microsoft ExcelTM is avery powerful tool and most of the time we do not utilize its fullpotential Although not very difficult to use but it needs practiceand continuously striving to use the full potential of Excel Ofcourse, any advanced concepts require the basic knowledge whichmost of us have and then build on it It is only by hands-onexperimentation that one learns the art of constructing an efficientworksheet 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 workingwith somebody else’s model The basic requirement for mostfinancial modeling is to keep them simple so anyone can look at itcan 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, thelesser known Excel functions, the Excel’s financial functions, and
so on The introduction of macros in these books is not exhaustivebut the purpose of what is presented is to show you the power ofExcel, and it can be utilized to automate most repetitivecalculations at a click of a button
For those who use Excel on a daily basis in financial modelingand project/investment evaluations, this book is a must It contains
a wealth of practical examples, tips, new techniques all designed tohelp quickly exploit and master Excel to its full advantage andtherefore use spreadsheets more effectively in your jobs
Keywords
advance Excel, Excel based financial modeling, financial modeling,investment evaluation, investment evaluation modeling, MicrosoftExcelTM, project economics
Trang 6About the Author
Index
Trang 7In this Volume 2 of the book, we continue with other importantuse of Excel in Financial Modeling Six chapters were presented inVolume 1, followed by four more chapters in this volume Bothvolumes complement each other
As mentioned in Volume 1, this book is an outcome of teaching
“Project Economics, Risk and Decision Analysis” course to morethan 800 participants since 2006 The course is computer basedwhere problems are solved using Excel It is observed during thesecourses that a majority of the participants really struggle with thecorrect and efficient use of Excel in solving problems
The book is about utilizing the full potential of MicrosoftExcelTM in financial modeling and other technical fields Simple,intuitive, step-by-step instructions reinforce theoretical intuitionwhile teaching mechanics of the model building process Theauthor uses his 35 years of experience in writing this book andtherefore it introduces the most practical and direct approach tomastering the Excel-based financial modeling
The book teaches students and professionals how to build,analyze, interpret, and present financial models in a step-by-stepfashion at their own pace A case study format is used to make surethe recipients can comprehend the real life modeling challenges.The book bridges the gap between academics and the real world toequip recipients with the practical financial skill set that they willneed on the job
The book starts with introducing the basic financial and otherroutinely usable functions of Excel, how to correctly use thesefunctions, what are the limitations of these functions, how toovercome these limitations, and so on The book then grills intohow to incorporate these functions into the context of a completeeconomics or financial model Finally, it provides opportunity tohelp users interpret the outcome of the models
Trang 8Who is the audience for this book and why they should not bewithout it?
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 goodreferences, but they provide generic use of Excel, that is, notspecific to financial modeling It takes time to understand thesegeneric applications and then try to incorporate them in thefinancial modeling I have concentrated on the use of some of theones I frequently visit or consult with
I frequently use Excel Forum (www.excelforum.com) when I
am stuck I have always received prompt and valuable
Trang 93
4
5
suggestions from the members of Excel Forum
(http://chandoo.org/wp) to capture new ideas
The Peltier Tech Blog (http://peltiertech.com) is anotheruseful blog with good tips and tricks from time to time
(www.MyOnlineTrainingHub.com)
(www.ExcelDemy.com) periodic e-mails with useful tips andtricks
However, a majority of the sites give generic examples, and some
of them may not be even applicable to specific financial modelingsituations The thing that is different with this book is that it isspecific to financial modeling and bridges the gap between thegeneric and specific techniques
The concepts presented in this book are accompanied by Excelspreadsheets or worksheets so that the users can reinforce theirunderstanding by looking at how these are developed Thesespreadsheets are available in a Dropbox at the following link Forany questions, corrections, and suggestions, please feel free tocontact the author at mianma@OGKnowledgeShare.com or
mianma.OGKnowledgeShare@gmail.com.
All the figures and tables in this book are available at thefollowing link on Dropbox
msYC2JYd8WyaP_K534a?dl=0
Trang 102
CHAPTER 1
Creating Dropdown Lists
In this chapter, we will show how to develop dropdown lists ormenus to control data entry and user choices available in themodel Dropdown lists can greatly facilitate data entry by limitinguser entries and forcing users to choose a value from a controlledlist The data validation dialog box in the Excel’s Data tab is used toconstruct 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 Forexample, I have a worksheet that has products’ pricing scenariosunder (a) Low Case, (b) Base Case, and (c) High Case If I have adropdown menu of these three pricing options in the model, I will
be able to assess the impact of these three pricing scenarios on theeconomics of the project easily Creating a dropdown menurequires the following steps
Enter the names of the three scenarios in Cells A3, A4, and A5 asshown in Figure 1.1a
Figure 1.1 Stages of creating a dropdown menu in Excel
We would like to select the option in Cell A1 Upon selection ofthe desired option in Cell A1, VLOOKUP, INDEX, and MATCHfunctions are then used to read the respective pricing scenario
Trang 11from the products’ pricing worksheet.
Place the cursor in Cell A1
Click on the Data tab of Excel’s Ribbon
Click on Data Validation icon The Data Validation dialog box
appears as shown in Figure 1.2
Figure 1.2 Data Validation dialog box
Select List in the Validation criteria Allow dropdown.
Select the Source, which is the list of options in Cells A3 to A5.
Tick the Ignore blank and In-cell dropdown in the dialog box.Click OK—a dropdown arrow will appear in Cell A1 The arrowwill show only when the cell is active (cursor is in the cell)
Click on the dropdown arrow to select the option The dropdownlist as shown in Figure 1.1b appears The final option selection
“Base Case” in Cell A1 is shown in Figure 1.1c
The dropdown can be easily cleared by placing the cursor in CellA1 → Data Validation → Clear All → OK
Note: Normally the list of options in Cells A3 to A5 will be
somewhere way below the main body of the model or even bettersomewhere to the right of the entire model Therefore, the list willnot 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 adropdown menu Click on Data Validation → List → Enter the list
Trang 12Creating Dependent Dropdown List
In financial modeling, many times we will have variables that will
be dependent upon other variables One typical example is crude oiland products’ export We have a worksheet (called “Pricing”) in thefinancial model This worksheet has multiple scenarios of products’pricing We can run economics by selecting a pricing scenario fromdropdown menus and then using the VLOOKUP or HLOOKUP toread the corresponding price for each year in the main body of themodel This will be shown later in the book The “Pricing”worksheet contains the following scenarios
Low Case Scenario
Trang 13Here 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 inthe “Pricing” worksheet These will be located somewhere awayfrom the main body of the model, either to the right or at thebottom In this list, the product types in Columns B, C, and D aredependent on the Products in Column A This means that if I pickCrude_Oil, I should be able to select what quality of crude oil.Column E has the pricing scenarios The Low Case has (a) fourpricing for the crude oil, (b) two prices for condensate, and (c) fourprices for the export products The same are repeated for Base Caseand High Case scenarios
Figure 1.4 Various pricing options or scenarios of the
“Pricing” worksheet
Now we start selecting the options available to us First, we selectthe scenario (Low Case, Base Case, or High Case) in Cell B1 Theseare common to all the product categories so they can be treated inthe same way as shown in the preceding section Follow thefollowing steps to get a dropdown menu for the scenarios
Trang 14Click on the Data tab in the Ribbon.
Click on the Data Validation icon, the Data Validation dialog box,
as shown in Figure 1.2, appears
Select List in the Validation criteria dropdown.
Select the Source, which is the list of scenarios in Cells E26 to
E29
Tick the Ignore blank and In-cell dropdown in the dialog box.Click OK—a dropdown arrow will appear in Cell B1 The arrowwill show only when the cell is active (cursor is in the cell)
Click on the dropdown arrow to select the option The Base Caseoption 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 thefollowing steps to get a dropdown menu for the product type For
this, we need to define Range Names.
Click on Formula tab in the Ribbon.
Click on Define Name icon.
The New Name dialog box, as shown in Figure 1.6 appears
T h e Name is normally preselected by Excel but it can be
manually entered if it is different than what you want to use
In the Refers to: highlight Cells A26 to A29.
Click OK.
Trang 15Manager in the Ribbon.
Click on the Data tab in the Ribbon.
Trang 163
4
Figure 1.7 The defined Range Names in the Name
Manager dialog box
Click on the Data Validation icon, the Data Validation dialog
box, as shown in Figure 1.8, appears
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
In the Source, enter = ProductCategory → Click OK The source
name should be exactly as in the defined names Figure 1.9shows the dropdown menu for Product Category
Trang 172
3
4
Figure 1.9 Dropdown menu for the Product Category
Now we add the third dropdown menu in Cell B3, the outcome ofthis is dependent on what is selected in Cell B2 This requires theuse of Excel’s INDIRECT function Follow the following steps:
Click on the Data tab in the Ribbon
Click on the Data Validation icon, the Data Validation dialog
box, as shown in Figure 1.8, appears
Select List in the Validation criteria Allow dropdown.
In the Source, enter = INDIRECT(B2) → Click OK The Data
Validation dialog box is shown in Figure 1.10 The resultingdropdown 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 Inthe next section, we will deal with multiword entries In addition,the names of the dependent lists must be exactly the same as thematching entry in main list For example, the dependent list to bedisplayed when “Crude_Oil” is selected from the first dropdown listshould be named CrudeOil It is also recommended that the list inthe dropdown menus is either in alphabetical order for easyreference or in some other logical order Also remember thatcharacters such as the hyphen (-), ampersand (&), and so on, are
not accepted in Range Names.
Trang 18Figure 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) twoindependent dropdown menus and (b) one dependent dropdownmenu The independent menus are in Cells B1 and B2 while thedependent menu is in Cell B3 (which is dependent upon theselection in Cell B2)
A third dropdown menu may be added that is dependent uponthe selection in Cells B2 and B3 Figure 1.4 shows that the productscould be exported to difference regions The destinations for theCrudeOil and Condensate products could be EU, FE, or USA andthe 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
Trang 19essential for the correct work of your cascading dropdown menus.
In Cell B4, we need to specify the export destination for theproduct because the price of the product depends upon thedestination The following additional name ranges are defined asshown in Figure 1.12
Figure 1.12 Define New Names for
CrudeOilArabExtraLight (Crude Oil and Arab Extra
Light)
Repeat this step for all the other combinations The final Name
Manager is shown in Figure 1.13
Trang 20Figure 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 Anew formula is required for this step If you notice, we havecombined the items in Cells B2 and B3 to create the name range Inthe Data Validation, they have to be split again by applying Excel’s
INDIRECT and SUBSTITUTE formula This will split the name
(concatenates) into two names and remove the spaces from thenames For example, in Cell B4, the data validation formula wouldbe:
= INDIRECT(SUBSTITUTE(B2&B3,” “,””))where Cells B2 and B3 contain the first and second dropdowns,respectively The Data Validation dialog box with this formula isshown in Figure 1.14 The completed dropdown menus are asshown in Figure 1.15
Trang 21Figure 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 macrorecording, (b) Add-Ins—to activate the Excel’s standard Add-Intools, (c) Controls—creating Form or ActiveX Controls such asaction buttons, checkboxes, dropdown lists, combo boxes, and so
on, (d) XML—using XML commands, and (e) Modify Thefunctions that we will discuss in this section are the Form orActiveX Controls
The DEVELOPER tab should always be visible on the ribbon.Sometimes 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
Trang 22steps below (most recent versions of Excel).
Click on the FILE tab
Click on OPTIONS
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
Click on the Developer checkbox under the list of Main Tabs on
the right as shown in Figure 1.17
Click on the OK button This will add the Developer tab to theRibbon
The FORM Controls are used to (a) easily reference and interactwith cell data without using VBA code, (b) add controls to chartsheets, and (c) attach an existing macro to a control so a macro isexecuted when a user clicks on the control
Trang 23The main advantage of using the Combo Box or List Box is thatthe dropdown arrow is always visible in the cell On the other hand,the dropdown arrow in the dropdown list created by using the DataValidation is visible only when the cursor is placed in the cell withthe dropdown list.
The Form and ActiveX Controls are shown under the INSERTfunction of the DEVELOPER tab as shown in Figure 1.18 Thefollowing common steps are used to insert Form or ActiveXControls in the worksheet
Click on the desired button on the Forms toolbar, the mousepointer will turn into a plus sign
Trang 24Figure 1.18 The Form Controls dialog box under the
INSERT tab of the Developer tab
Click the worksheet location where you want the upper-leftcorner of Form Control or ActiveX button to appear
Drag the list box to where you want the lower-right corner of thelist box to be If the button has to be in only one cell then justcover the grid lines of the cell
Right click on the button → Click on Format Control TheFormat Control dialog box will appear where the desiredformatting can be done The Format Control dialog box can also
be accessed by clicking on Properties
The FORM Controls have the following 12 controls available
Button (Form Control)—Runs a macro that performs an
action when a user clicks it A button is also referred to as a pushbutton
Click the Developer tab, click Insert in the Controls group Click on the Button icon, the mouse pointer will turn into a
plus sign Keep the left click pressed
Place the plus sign in the upper-left corner of the cell in whichyou want the Button to appear, and then drag the cross towhere 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, themacro can also be assigned later In this example, the Button
is shown in Cells A1:B2 as shown in Figure 1.20
Trang 25Combo Box (Form Control)—Combines a Text Box with a list
box to create a dropdown List Box A combo box is more compactthan a list box but requires the user to click the down arrow todisplay the list of items It works in the same way as thedropdown list created using the Data validation shown in Figure1.1
Click the Developer tab, click Insert in the Controls group Click on the Combo Box icon, the mouse pointer will turn
into a plus sign Keep the left click pressed
Place the plus sign in the upper-left corner of the cells in whichyou want the Combo Box to appear, and then drag the cross to
Trang 26where you want the lower-right corner of the Combo Box to
be Release the left click, a Format Control dialog box willappear as shown in Figure 1.21 Click on the Control tab andassign the Input range A7:A9 In this example, the Button isshown in Cells A1:B2 as shown in Figure 1.22
The Input range A7:A9 in Figure 1.21 picks the list of optionsavailable The cell link links Cell A1, so whatever option isselected its sequence number in the list will be entered in CellA1 The number of option can be specified in the dropdownlines Cell B5 is linked to Cell A1, which shows the sequencenumber corresponding to the options list
Figure 1.21 The Format Control dialog box for the Combo Box
Figure 1.22 The Combo Box developed in Figure 1.21
Trang 27It adds a 3D look to the dropdown or combo box.
Check Box (Form Control)—Turns on or off a value that
indicates an opposite and unambiguous choice More than oneCheck Box can be selected in a worksheet or a group (GroupForm Control) 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
Click the Developer tab, click Insert in the Controls group Click on the Combo Box icon, the mouse pointer will turn
into a plus sign Keep the left click pressed
Place the plus in the upper-left corner of Cell A1 in which youwant the Check Box to appear, and then drag the plus sign towhere you want the lower-right corner of the Check Box to be.Release the left click
Right click on the Check Box created Format Control dialogbox will appear as shown in Figure 1.23 Click on the Controltab and assign the cell link to $B$1
Figure 1.23 The Form Control dialog box for Check Box
Trang 28Change Text—The title or reference of the Check Box can bechanged using: Right click on the Check Box → Click on EditText in the dropdown list.
The Check Boxes created are shown in Figure 1.24 with theresult in Cells B1:B4
Figure 1.25 shows an example of how the Check Box optioncan be used In this example, we have revenue from threecountries and we need to look at the total and average revenueper country or selected countries The selection of the countries
is done using the Check Boxes The rest of the steps to createCheck Boxes are the same as presented in the preceding pages.Following are the additional steps required
Figure 1.24 Check Boxes inserted in worksheet
Figure 1.25 Example showing the use of Check Boxes
Select blank cells anywhere in the worksheet (they do not need
to be visible to the user) Cells E4:G7 are selected in Figure1.25
Enter the name of the countries (associated with the CheckBoxes created) in Cells E5:E7
Link Cells F5:F7 to the Check Boxes for Singapore (Cell A1),United Kingdom (Cell B1), and Bahrain (Cell C1), respectively.Enter formula = IF(F5 = TRUE,”Singapore”,”-”) in Cell G5 The
Trang 29Enter formula = DSUM(A4:C10,”Revenue, M$”,G4:G7) in CellB2 to calculate the sum of the revenues for the countriesidentified by the ticks in the Check Boxes.
DSUM(database, field, criteria)
Enter formula = DAVERAGE(A4:C10,”Revenue, M$”,G4:G7)
to calculate the average revenue for the countries identified bythe ticks in the Check Boxes
Note: It is important to note the following else the formulaswill give error
The database (Cells A4:C10) must include the Columnheadings (Cell A4:C4)
The field specified in the DSUM formula must be the same
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 thisvolume
Spin Button (Form Control)—Spin button (Form Control) is
used to increase or decrease a value, such as a numberincrement, time, or date To increase the value, click the uparrow; to decrease the value, click the down arrow Typically, auser can also type a text value directly into an associated cell ortext box
The Spin Button in inserted in a desired cell in the same way asshown in the previous Form Controls
Right click on the Spin Button created—The Form Objectdialog box, as shown in Figure 1.26, appears Specify theranges of data to capture The limits in Figure 1.26 are for acertain project CAPEX By changing this CAPEX, we can assessthe profitability of the project at various CAPEX
Link the cell link to Cell A2 This is where the selected CAPEXwill be input
The CAPEX in Cell A2 can be changed by clicking on the up ordown arrows, the change will be within the specified limitsand increments
The final Spin Button is shown in Figure 1.27
The Spin Button can be placed in the same cell where the result
Trang 30Figure 1.26 The Spin Button (Form Control) Format
Object dialog box
Figure 1.27 Example of the Spin Button (Form Control)
List Box (Form Control)—Displays a list of one or more items
of text from which a user can choose Use a List Box fordisplaying large numbers of choices that vary in number orcontent There are three types of list boxes:
A single-selection List Box enables only one choice In thiscase, a list box resembles a group of Option Buttons, exceptthat a list box can handle a large number of items moreefficiently
A multiple-selection List Box enables either one choice orcontiguous (adjacent) choices
An extended-selection List Box enables one choice, contiguouschoices, and noncontiguous (or disjointed) choices
The List Box returns sequence reference (1, 2, 3 n) to theselection in a linked cell
The following steps are followed to build a single-selection ListBox
The List Box in inserted in a desired cell in the same way as
Trang 31ii.
iii
iv
6
shown in the previous Form Controls
Right click on the List Box created—the Form Control dialogbox, as shown in Figure 1.28, appears Specify the ranges ofdata to capture, that is, Cells C1:C4 The data could beentered in any blank cells anywhere in the worksheet asshown in Figure 1.29
Figure 1.28 Format Control dialog box for the List Box
(Form Control)
Link the cell link to Cell B1 as shown in Figure 1.29 Cell B1will show the sequence number of the selected option fromthe List Box
By reducing the height of the List Box to cover Cells A1:A2only will show three items out of the list in Cells C1:C4.The up and down arrows will then become live to scroll thelist up and down
Figure 1.29 Illustration of the List Box (Form Control)
function
Option Button (Form Control)—An Option Button, also
referred to as Radio Button, allows a single choice within a
Trang 32The following steps are followed to use Option Buttons.
The Option Button in inserted in a desired cell in the sameway as shown in the previous Form Controls
Insert one Option Button in one cell and then Copy andPaste it to the other desired cells depending on the number
of options under consideration
Right click on the first Option Button—the Format Controldialog box, as shown in Figure 1.30 appears
Figure 1.30 Format Control dialog box for the Option
Button
Link the cell link to Cell B1 as shown in Figure 1.31 Cell B1will show the sequence number of the selected optionfrom the Option Button
Figure 1.31 Illustration of the Option Button (Forma
Control) function
Group Box (Form Control)—If we are using more than one
Trang 33Figure 1.32 Option Buttons for product type and pricing scenario
Label (Form Control)—Label (Form Control) identifies the
purpose of a cell or text box, or displays descriptive text (such astitles, captions, pictures) or brief instructions
Figure 1.33 Illustration of the Grouped Option Buttons
Scroll Bar (Form Control)—The Scroll Bar (Form Control)
scrolls through a range of user-specified values when the up anddown arrows are clicked (in vertical Scroll Bar) and left and rightarrows (in horizontal Scroll Bar) or drag the scroll box Inaddition, you can move through a page (a preset interval) ofvalues by clicking the area between the scroll box and either ofthe scroll arrows Typically, a user can also type a text valuedirectly into an associated cell or text box The following stepsare followed in inserting a Scroll Bar in a worksheet
Use the same steps as used for the previous Form Controls to
Trang 34Click OK.
The Scroll Bar is shown in Figure 1.35 Every time you click onthe left or right arrow, the number in Cell B1 will change by 10(upward if right arrow is clicked or downward if left arrow isclicked)
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 FormControls discussed in the preceding pages The designrequirements for the ActiveX Controls are more flexible They also
Trang 35have a much better ties to VBA in terms of programming and have
a number of events that can be accessed through programming
Trang 36Using Excel’s Data Tab
The Excel’s Data tab is shown in Figure 2.1 We have alreadycovered the Filter and Sort options in Volume 1 Some functions ofthe Data Validation option were also covered in Volume 1 In thischapter, we will cover the following:
The Data Validation function
The Flash Fill function
The Remove Duplicates function
The Group and Ungroup functions
The Subtotal function
The Consolidate function
The What-If Analysis function—This is a very important andwidely used function We use this option in almost everyfinancial analysis This function includes the following threeadditional very useful options
The Scenario Manager option
The Goal Seek option
The Data Table option
The Data Analysis function
The Solver function
Figure 2.1 Excel’s Data tab
The Data Validation Function
Part of this feature (creating dropdown list) is already covered inChapter 5 of Volume 1 In this section, we will cover some of theother useful aspects of this function This option has threeadditional functions as shown below
Data validation
Circle invalid data
Clear validation circles
Trang 37In addition to using the Data Validation for creating thedropdown list, we can also use this function to achieve otherobjectives The List option shown in Figure 2.2 is already used increating the dropdown list The other functions show the validationcriteria, that is, to restrict the type of data entry as (a) Wholenumber, (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 boxprompts the user to a user-specified message explaining the kind ofdata allowed in a cell Figure 2.3 shows formatting of Cell A1 toaccept only text of minimum length 5 and maximum length 10 Tocreate this restriction, select Cell A1 → Data Validation → AllowText Length → Minimum 5 → Maximum 10 → OK
Now create an input message, which will show up when cursor isplaced in Cell A1 The message will not be shown if the cursor isplaced in any other cell The error message should be clear andmeaningful so that anyone entering data into this cell knows whatthe message means Enter OK The message is shown in Figure 2.3.Figure 2.4 shows the message when cursor is placed in Cell A1
Trang 38Figure 2.3 Formatting Cell A1 to accept only text (no
to take corrective action Click on Retry or Cancel to correct theentry In this example, we specified the text length between 5 and
10 The Settings dialog box has a dropdown list allowing the user toenter other specifications such exact text length and so on
Trang 39Figure 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 → DataValidation → Clear All → OK
If you have not specified Stop in the Error Alert Style and youhave specified only Warning or Information then it will not stopyou from entering the data However, you can enter DataValidation → Circle Invalid Data Now when incorrect format ofdata is entered, it will put a circle around the cell as shown inFigure 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 usethe Auto Fill feature to fill cells with data that follows a pattern orthat is based on data in other cells In the latest versions of Excel
Trang 40another feature is added which is called Flash Fill The Flash Filloption of Excel helps in filling out data based on an example Thisfeature starts working when it recognizes a pattern in your data.The feature works best when there is some consistency in the datayou are going to enter.
Figure 2.7 Circle invalid data
You have to make sure that the Fill Flash is on This is done byClick 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
If Flash Fill is activated as described above and shown in Figure2.8 but it does not start automatically when you type data thatmatches a pattern then start it manually by Clicking Data → FlashFill, or by pressing Ctrl+E Figure 2.9a shows first and last name in