Вы находитесь на странице: 1из 105

# Financial Modelling in Excel

January 1

2010
Manual

This document is the property of Celsoft Corporation and is meant for the participants of Celsoft Training Workshops only. Any use or reproduction of this manual without the authority of Celsoft is strictly prohibited.

## Financial Modelling in Excel (v2007)

Celsoft Corporation

CONTENTS
Introducing Financial Modelling 3 Financial Modelling Life Cycle 8 Introducing Excel 2007..23 Keyboard Shortcuts.27 Hyperlinks28 Naming Cells & Ranges. 29 Relative, Mixed & Absolute Referencing 32 Worksheet Protection.34 Data Validation..36 Auto Filtering & Advanced Filtering..40 Subtotal, Outline, Grouping & Ungrouping.44 Consolidation.45 Formula Auditing..50 Conditional Formatting..51 Introducing Excel functions.54 Logical functions..61 Worksheet Controls.62 Lookup functions..68 Statistical functions.71 Text functions77 Date & Time functions78 Pivot Tables81 Data Tables87 Scenario Manager90 Goal seek.95 Solver97 Analysis Toolpak.102 Recording macros..103

## Financial Modelling in Excel (v2007)

Celsoft Corporation

FINANCIAL MODELLING

Objectives Understanding what financial modeling is and what it involves. Understanding the importance of the modeling course to our jobs. Understand the financial modeling life cycle in detail.

1. INTRODUCTION FINANCIAL MODELLING is the practice of distilling numerical data with predictive insights and business logic to derive answers to business questions.

FOR EXAMPLE In a planning and forecasting situation for a Treasury Department of a financial institution, the model might start with an analysis of the portfolio for measures such as: margins by product, deposits by sector, concentration ratios, gap analysis, risk analysis

## Financial Modelling in Excel (v2007) ratio analysis and many more.

Celsoft Corporation

This will be followed by predictive insights of economic measures and expectations of the department e.g. Forecast interest rates; Forecast inflation rates; Forecast market liquidity; Expected GDP; Forecast balance of payments and exchange rates; Dealing strategy for the company etc,

These factors will be integrated in a robust financial model to forecast the expected treasury income, liquidity, balance sheet and to allow Treasurers to do what-if analysis and sensitivity analysis to guide Treasury strategy. Modelling can be done by employing various types of software e.g. Spreadsheets, Quantrix etc. In this training session, our focus shall be on spreadsheet modelling.

WHY MODELLING Necessary Skill - The use of Excel is a core skill for managers and non-managers because most work now require the use of spreadsheets. No formal Training - However, few users receive formal training in modelling techniques and the use of Excel. Powerful tool - Excel is a powerful tool, which can help automate a number of processes as well as guiding decision-making. No professionalism & Standardization - Since the introduction of spreadsheet model development has not taken any formal shape since users have not yet regarded modelling as a profession which can actually be standardized. CURRENT MODELLING IN AFRICA Users do not develop models, they develop templates and tables. No formal approach to model development, users start at the build stage. The models/ templates developed are not robust; they are very simple and ill-defined. Usually numbers are hardcoded in cells with no relationship with each other.

## Financial Modelling in Excel (v2007)

Celsoft Corporation

The templates are not reliable as you can see circular references, errors and some formulas that you cant follow and some parts having been deleted. Inputs and formulas are combined and not protected to prevent accidental deletions. Not useable by another person who has not developed them. No deliberate action by organizations to set up models or modelling units/departments. Very important decisions are made without the use of a computer model. No deliberate plan to train staff in financial modelling.

## Financial Modelling in Excel (v2007) The Evolution of Spreadsheet Modelling

Celsoft Corporation

3. TYPES OF MODELS There are different types of models but in this manual, we will focus on the simple classification of models into the following types: Complex Models For complex modelling problems, but where there is a good understanding of the problem that is being modelled and there is adequate time for the development of an appropriate model. Applying each of the six stages helps to ensure the development of a robust model, reducing the risk of errors and getting the most from the modelling process. Examples of types of models that fall into this category are long term financial planning or forecasting models that will be developed once and used many times.

## Financial Modelling in Excel (v2007) Simple Models

Celsoft Corporation

The principles of good spreadsheet design apply equally to the simplest or most complex of models. Examples of simple models are ones that take only a day of two to complete, or models that are used only by the developer for his or her own thought process.

Other Types of Financial Models Deterministic This is the most common type of model, and allows for specific data input with results defined by formulas. A change to the input data will result in a change to the calculated results. Generally, changes can be made backwards and forwards. Forward changes are commonly known as what-ifs (i.e. changes to input data), and backward changes are known as Goal seeks Optimization This is linear programming. A model is defined with sets of constraints (e.g. only 40 hours are available) and then manipulates the input data in line with the constraints to either maximize or minimize a result.

## Financial Modelling in Excel (v2007)

Celsoft Corporation

## THE MODELLING LIFE CYCLE

All computer models go through different stages of development, but the accessibility and ease of use of spreadsheet packages sometimes make it easy for these stages to become blurred. Experience of the way that models grow and evolve will help you develop better models. Each of the six stages of model development is described in detail below:

SCOPE

This stage is where we assess the nature, scale and complexity of the model required. During the scope stage you should: Define the objectives of the model (Decide what needs to be included in the model and what can be omitted). Some model features may be left for complexity and time challenges or may be left for future considerations as add-ons. Consider the level of detail required in the input and logical assumptions (complexity). The scope stage is the time to make sure that you understand, at least in broad terms, what data is required for the model and how you are going to obtain it.; Understand in outline how the model will work; Estimate the time and resource required for the model development; and

## Financial Modelling in Excel (v2007)

Celsoft Corporation

SPECIFY

## Agree the above with the key stakeholders.

To specify is to define the logic of the model in sufficient detail to provide an unambiguous statement of how the results will be calculated. For modelling projects where the logic of the model is difficult to define, specification is time consuming and this stage may need to be revisited a number of times.

We recommend that you separate the process of specifying the model calculations from actually building the model. It allows you to tackle the most difficult problems associated with the model before you have started to build it. Logically, all spreadsheet models should flow from inputs through calculations to the model results. The process of model specification should run the other way around, because it is model results that are most important and should determine the structure of the model.

Try to avoid letting the availability of input data determine the output that you produce. The model objectives should drive the results required, the results should drive the calculations and the calculations should drive the required inputs.

In short, the specify stage involves defining the model results, calculations and inputs. Calculations can be defined by drawing a simple bubble diagram as shown below:

## Financial Modelling in Excel (v2007)

Celsoft Corporation

## Data input Interest rate

Format %, 2dp

Units %

Frequency One entry only. One entry per month. One entry per month. One entry only. One entry per month. One entry only. Start year only. Start year only.

Sales

Numeric

000's units

Must be > 0.

## Price Debtor period

Numeric Numeric

ZMK Days

Agreed estimate. Estimated from budget data. Forecast Policy variable. Firm figure.

Must be > 0. Must be > 0; must be < model period. Capex model (auto transfer). Must be > 10.

Numeric Numeric

ZMK000's Years

## Balance sheet opening balance Year end

Numeric

000's

Date

Firm figure.

Hints and tips for model specification Are constants constant? Avoid using hard coded numbers in the definition of a formula. For example, the formula:

10

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Sale price including VAT = Sale price excluding VAT 1.175 assumes that the VAT rate is 17.5%. It works fine, until the VAT rate changes. To avoid having to search through every formula in the model for calculations which assume the VAT rate, set up an input cell for the VAT rate and refer to that instead. For a single cell of this sort, it is useful to create a range name, say VAT rate, so instead of typing the constant you use the formula: Sale price including VAT = Sale price excluding VAT (1 + VAT rate) If there is any change to the input assumption, or you want to run sensitivity, the constant can be changed throughout the model instantly. Even if the constant never changes, the new formula is much simpler to read and understand. Real or nominal prices? In financial models, a common problem is deciding whether to base monetary calculations on real or nominal prices. Real prices are prices of a particular base year and do not increase with inflation. Nominal prices, or money of the day, do include the effects of inflation. Real prices are frequently used for projections because it is possible to separate market trends from increases caused purely by inflation. For the same reason real prices are often used for summary results, particularly to calculate year on year changes in revenues or costs. To make conversion between real and nominal prices easy, it is a good idea to place the calculation of an RPI index in a clear place where it can be referred to quickly. Avoid circular references Circular references should be avoided in model calculations. Frequently they are a sign of an error in the logic. The best way to avoid a circular reference in your specification is to construct your calculation rules so that they always read from top to bottom and left to right: so that formulae always refer to cells above or to the left. DESIGN

The design stage involves producing the most effective structure for the model. By following some key guidelines it is possible to make your spreadsheet models significantly easier to use and less prone to errors.

11

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Before you design a spreadsheet, make sure that a spreadsheet is the most appropriate tool for the job. For example where multi-dimensions are required, spreadsheets which are two dimensional, will not be able to do the job.

Discipline in the spreadsheet design is even more important to create easy to understand spreadsheet models.

The Six Golden Rules of Spreadsheet model design Rule 1: Separate inputs, calculations and results Inputs to a model should be placed on a separate part of the worksheet from calculations. It is also a good idea to place those results which are produced by the model in a separate place from intermediate calculations. Separating inputs helps to avoid confusion in using and maintaining models. It reduces the risk that parts of the input data are overlooked or that calculations are overtyped with input figures. Inputs should be separated physically on the sheet, but can also be separated by clear labeling and colouring of the spreadsheet. When using multiple sheets, it can be a good idea to maintain a single sheet containing all of the model inputs in one place. So, whenever an input assumption needs to be changed, the user always knows where to go to look for it. An alternative design is to place inputs at the top of each sheet which requires them. This keeps inputs fairly close to the calculations in which they will be used, while keeping them separate from the calculation.

Rule 2: Use one formula per row or column As far as possible, formulae should be written so that a single formula can be copied across the entire row of calculations, or down the entire column. Designing a spreadsheet with one formula per row leads to a number of practical benefits, such as:

12

## Financial Modelling in Excel (v2007)

Celsoft Corporation

quicker development, because every formula can be written in a single column, then copied across; effective testing; robust updating and maintenance, because every time you change a formula in a cell you know that it should be copied across the rest of the row; and straightforward documentation, in a specification which has one definition for each row of the final model.

For some problems, producing a design with only one formula per row requires some careful thought. But the benefits of the design far outweigh the extra work required.

Rule 3: Refer to the left and above A well designed spreadsheet can be read like a book: from front to back, top to bottom and left to right. This makes the spreadsheet easier to understand and reduces the risk of introducing a circular reference to the calculation. For example, if your model has a different time period in each column, each cell reference in a formula could be: to an input or calculation further up the same column; to an input or calculation on an earlier sheet in the model; and to a calculation further down the sheet but in an earlier column, for example referencing the closing balance calculated in the previous time period to use as the opening balance in this time period. Rule 4: Use multiple worksheets When a model contains sections which can usefully be repeated, such as a model of a company with a number of similar business units, the best way to present it in a spreadsheet is to use one worksheet for each repeatable block. This approach will allow for: quicker development, by creating one standard sheet which you can then copy a number of times; easier updating, by grouping a number of sheets in the model you can update all of the blocks of the model together, which would be impossible if the blocks were all kept on the same sheet; quicker testing, by comparing the formulae in each of these sheets and making sure that they are the same. When the model for a number of subsidiaries in a business are similar, but not quite the same, it is still a good idea to use comparable worksheets for each subsidiary. When some subsidiaries require more detail, it is easy to develop a worksheet for the most complex example and then

13

## Financial Modelling in Excel (v2007)

Celsoft Corporation

blank out the relevant sections for other subsidiaries. Do not delete any rows or columns, so that the common elements on the different worksheets can still be edited together. Rule 5: Use each column for the same purpose throughout the model However many worksheets you use, it is good practice to always use the same layout for columns on all worksheets. For a financial model, an example column layout might be: Columns A. and B. Units Always using the same column for the same purpose makes the model easier to build and reduces some of the risks of errors. For example: if January 2001 is always in column X then you know that every formula that refers to January 2001 will also refer to column X. Rule 6: Include a documentation sheet Any model should contain some internal documentation. To make it noticeable, it is a good idea to set aside the first sheet of the spreadsheet as a documentation sheet, used purely for model control. The documentation should include: a short description of the models purpose; who built the model; how to contact the person responsible for the model; and the model version number and when it was written. details of the data which is currently in the model; some brief instructions, describing the layout of the model or how to use it; a list of recent changes to the model; and a summary of key logical assumptions in the model.

Depending on the model, other useful items to include on the documentation sheet are:

Hints and tips for model design While not being appropriate to all spreadsheets, the design ideas in this section can all be useful ways to make your model easier to understand and use. Colour coding Colour coding is a useful technique to make spreadsheets easier to use. Examples of using colour coding include: separating inputs from calculations, by making all of the cells requiring inputs the same colour;

14

## Financial Modelling in Excel (v2007)

Celsoft Corporation

separating types of inputs, such as by making the inputs required from the finance department one colour and those required from the marketing department another colour;

Units

It is important to use clearly define summarization levels for inputs to a model, e.g., ZMK000 or ZMK millions.

Formulae in English For simple models, with little formal documentation, it can be useful to include an extra column containing natural language translations of the formulae in the model. This helps to make the calculations in a model easy to understand, makes important logical assumptions more transparent to anyone using the model and makes it possible for an independent tester to check the coding in the model. There are two ways of achieving this: Firstly by naming ranges and secondly by providing an extra column that describes the formulae in English. When the model development is complete, the column containing the formula can be safely hidden, but not deleted to keep it as a record of what the model is attempting to do. BUILD The build stage is where the actual coding of the model takes place. Many spreadsheet models start their life cycle here with only scant regard to the three stages outlined above. This leads to: A model that is more complex than originally expected and takes longer to build; Assumptions being made that were not part of the original brief; and A lack of common understanding about what the model is doing.

Hints and tips for model building Keep formulae simple To make your spreadsheet as easy to understand as possible, keep the formulae simple. Just as a clearer writing style can be achieved by breaking up long sentences, a clearer model can be achieved by breaking up long formulae.

15

## Financial Modelling in Excel (v2007)

Celsoft Corporation

By breaking your calculations into a series of steps you make them easier to understand and reduce the chances of making an error. In most models, the intermediate steps introduced here are worth including for use in other calculations.

Use of named cells and ranges Allocating meaningful range names to areas or cells within a spreadsheet can speed up the development process, make the model easier to understand and reduce the risk of errors made by referring to the wrong cell. Build in error traps It is good practice to include checks for errors in a model. These can be set up to check for errors in the input data provided, or for errors in the model formulae. Cross casting is the process of checking that the totals in the rows and columns of a spreadsheet are consistent. Error traps can be usefully included: on balancing financial statements, such as a balance sheet or a sources and applications of funds statement; when equivalent data is provided from more than one source, for example when a total revenue is both input and calculated from individual revenue lines; and when it is possible to perform a calculation in two equivalent but different ways. When you use error traps, make sure you put them somewhere noticeable. For example, try placing references to all of your error traps in a single block at the top of one of the front sheets. Built in features When a model is going to be used over a long period of time, especially if it is to be used by a large number of people, Excel provides a number of facilities to make your spreadsheet more robust. For example, you can: use cell protection to protect formulae in the model from being overtyped, while still allowing input values to be changed; use the data validation feature, such that an error message will appear if inputs lie outside a valid range. TEST

To test a model is to root out errors and inconsistencies and to increase confidence in the results that the model produces.

16

## Financial Modelling in Excel (v2007)

Celsoft Corporation

While it is never possible to test a complex model to the extent that you can guarantee it to be error free, this stage does provide the confidence that the model is producing reliable results. Errors at this stage can undermine the credibility of both the model and its developer. The value of testing can be measured against the potential cost of a wrong decision: if a model is being used for an important and expensive business decision, the time and resource spent testing the model is time and money well spent. Testing should always be carried out by an independent third party. Testing should be carried out by the developer during building and by an independent tester after building but before use. Types of tests are: Specification test checking if model meets specifications. Formula tests checking if formulae are calculating results properly Numeric tests- Re-computing the results and comparing with test results. Also involves checking the validity of assumptions. Egg 120% margin is an invalid assumption. Robustness Test -The tester needs to consider all of the feasible circumstances under which the model may be used in future. This includes doing an environment check where one checks the ability of the model to work on a particular computer, memory or network. Also involves boundary tests which check the behaviour of the model when inputs reach sensible limits or checking if typing zeros in assumptions produce errors. Macro tests Checking if all macros and buttons are working effectively.

17

## Financial Modelling in Excel (v2007) Common errors

Celsoft Corporation

With experience, you can learn to spot many of the most common spreadsheet errors very quickly.

Formulae not copied Forgetting to copy the new formula across into the other cells in the row.

Wrong reference Nearly every formula in a spreadsheet refers back to another input or calculation. With the quantity of references in any large spreadsheet, it is inevitable that you will make mistakes and refer to the wrong cell. Sum over the wrong range A similar mistake is to include the wrong cell reference in a SUM formula. It is particularly easy to introduce this error when you insert an extra row in a block of cells that are being summed. Insert a row in the middle of the block, and the formula will automatically adjust to include the extra row, but insert a row immediately above or below the block and the new row will be omitted. Relative and absolute references Another commonly found error is caused by confusion between relative and absolute references. Remember that a cell reference in a formula of the form =D4 will change if you copy the formula across the row to E4, F4 and so on. Copied down a column it will change to D5, D6, etc. If you use the reference =\$D\$4 it will not change when copied across or down. You can also use semi-absolute references of the form \$D4 or D\$4. One technique to help avoid making this mistake is by following the fifth golden rule of spreadsheet design, by using each column for the same purpose throughout the spreadsheet. If you always use column D for constants, you know that every formula that refers to column D should contain an absolute reference, such as \$D\$4, while references to others columns should always be relative, for example E3.

18

## Financial Modelling in Excel (v2007) Unit errors

Celsoft Corporation

Mixing up the appropriate units for the elements in a calculation is another frequently occurring problem. Especially common is confusion between the order of magnitude for inputs, such as s versus 000s.

USE

A best practice spreadsheet model is a powerful tool, but to realize its usefulness you need to understand how to: Present useful information to help make decisions, not just print out numbers; Present sensitivities and scenarios to understand the important drivers in the business; and Control the evolution of the model when further changes are required.

Presenting results A big difference to the usefulness of a model can be made by effective presentation of results. Good presentation leads not just to easier communication of the results, but also improves the perception of the quality of the underlying model. Headers and footers Putting key information onto report headers and footers makes it much easier to keep track of different model runs. Without them, it is easy to mix up out of date versions of model output with the correct version. Include on the header or footer: the model file name and/or the model name and version number; the date and time of printing; the model users name;

19

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Spreadsheet models are powerful tools for analysis. A successfully developed model can analyse a variety of alternative situations and inform the decision making process. Using a model to produce useful information requires skill, not just to generate computer printouts.

Data tables One of the most powerful ways that a model can be used to improve understanding of a problem is by illustrating the sensitivity of the results to varying some of the key input assumptions. It is very easy to understand how your input assumptions affect the results by using Data tables. Simulation What do we mean by "simulation?" When we use the word sim ulation , we refer to any analytical method meant to imitate a reallife system, especially when other analyses are too mathematically complex or too difficult to reproduce. Without the aid of simulation, a spreadsheet model will only reveal a single outcome, generally the most likely or average scenario. Spreadsheet risk analysis uses both a spreadsheet model and simulation to automatically analyze the effect of varying inputs on outputs of the modeled system. One type of spreadsheet simulation is Monte Carlo simulation, which randomly generates values for uncertain variables over and over to simulate a model.

Monte Carlo Simulation One of the problems with carrying out sensitivity analysis is combining the individual sensitivities in the model, of which there may be many, in a way that realistically reflects the range of possible outcomes that may occur in practice. A simple approach that is often used is to set all the sensitivities to the worst case, and look at the results that this gives. However, by doing this the downside of the project is vastly over-stated; in reality, it is unlikely that everything will go wrong together. Monte Carlo simulation is often used in business for risk and decision analysis, to help make decisions given uncertainties in market trends, fluctuations, and other uncertain factors.

20

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Even if realistic combinations of sensitivities are used, simply applying these in the model do not provide any information about how likely, or probable, the resultant outcome is. The technique of Monte Carlo analysis overcomes these problems: it allows the user to combine many sensitivities in many different ways, effectively running hundreds, or even thousands, of scenarios. The output shows the range of possible results, and how probable each is. This information enables the user to understand the effect that variations in the inputs have on the output: in other words, this method makes clear the risks involved in the project.

This problem would require advanced risk analysis software like Risk Solver or Risk Analyser to solve.

Graphs Graphs allow faster assimilation of information than a page of numbers. Graphs are frequently valuable as a way to introduce information, but usually need to be supported by the actual numbers. Bear in mind that different people in your audience may have different needs, those who just want to understand the basic trends may want to see the graphs while those who need to understand more detail are likely to want to see the numbers behind it. A common mistake is to use an inappropriate type of graph for the message you want to present.

Spreadsheet Modelling Best Practice and Standards The Need for Standards & Conventions As spreadsheet modelling activities and underlying organizations grow and become more complex, the need for universal spreadsheet modelling standards and accountability behind decision-making processes also grows. Traditionally, a lack of generally accepted principles governing the model development process has resulted in model developers constructing models according to individual tastes and preferences. This lack of standardization has often resulted in unnecessary frustration and confusion as model developers have difficulty understanding and utilizing models developed by others and model users have been forced to adapt to models on a case by case basis. In the absence of universal spreadsheet modelling standards the spreadsheet modelling sector would continue to become more complex, disjointed and difficult for management and decision

21

## Financial Modelling in Excel (v2007)

Celsoft Corporation

makers to control, unnecessarily creating significant costs and risks for business organizations. Standards currently govern many areas of the business world. Some of the more prominent examples include accounting standards and auditing standards. In general, there is considerable standardization of reporting and analysis in relation to historical results, but very little standardization in relation to forecasted results. Prior to the first release of these Best Practice Spreadsheet Modelling Standards, there was little or no standardization within the spreadsheet modelling sector. Despite this lack of standardization, spreadsheet models have still been used as a fundamental component of the quantitative analysis which is undertaken in relation to almost every major business decision. The Best Practice Spreadsheet Modelling Standards and Conventions empower both model developers and model users with the knowledge to improve the quality and efficiency of spreadsheet modelling activities. In this regard, the primary spreadsheet modelling benefits of adopting these Standards and Conventions are: a) Improved quality & transparency b) Decreased development time & cost c) Minimization of error risk d) Facilitation of efficient sharing of model development methodologies e) Prevention of model redundancy f) Alignment of the needs of model developers & model users

22

## Financial Modelling in Excel (v2007)

Celsoft Corporation

## GETTING STARTED WITH MICROSOFT EXCEL 2007

Objectives Introduce Microsoft Excel 2007 citing the major changes from earlier versions. Understanding the Excel environment. Understand some of the basic efficiency functionalities in Microsoft Excel.

## INTRODUCING EXCEL 2007

Excel, as you probably know, is the worlds most widely-used spreadsheet program, and is part of the Microsoft Office suite. Other spreadsheet programs are available, but Excel is by far the most popular and has become the world standard. Here are just a few of the uses for Excel: Number crunching: Create budgets, analyze survey results, and perform just about any type of financial analysis you can think of. Creating charts: Create a wide variety of highly customizable charts. Organizing lists: Use the row-and-column layout to store lists efficiently. Accessing other data: Import data from a wide variety of sources. Creating graphics and diagrams: Use Shapes and the new SmartArt to create professionallooking diagrams. Automating complex tasks: Perform a tedious task with a single mouse click with Excels macro and Visual Basic Application (VBA) capabilities. Parts of the Excel Screen That You Need to Know Name Quick Access Toolbar Ribbon Description A toolbar that you customize to hold commonly-used commands The main location to find Excels commands. Clicking an item in the Tab list changes the ribbon thats displayed.

23

## Financial Modelling in Excel (v2007) Introducing the Ribbon

Celsoft Corporation

The most dramatic change in Office 2007 is the new user interface. Traditional menus and toolbars are gone, and theyve been replaced with the Ribbon. Office 2007 is the first software in history to use this new interface, and it remains to be seen whether it will catch on and replace traditional menus and toolbars.

1 Ribbon tabs The commands available in the Ribbon vary, depending upon which tab is selected. The Ribbon is arranged into groups of related commands. In addition to the standard tabs, Excel 2007 also includes contextual tabs. Whenever an object (such as a chart, a table, or a SmartArt diagram) is selected, specific tools for working with that object are made available in the Ribbon. THE QUICK ACCESS TOOLBAR

24

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Note the following: 1. You can select from a category of commands (the list below shows the All Commands category 2. The down and up arrows on the right-hand side of the dialogue boxes are used for repositioning the tools in your toolbar. 3. Tools can be removed from the Quick Access Toolbar by right-clicking them

25

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Excel 2003 1. Select Tools/Customize 2. Select the Commands tab 3. Drag the tools from the right-hand box onto your toolbar at the top of the screen

To install these two add-ins, proceed as follows: 1. Click on the Office button. Select "Excel Options"/Add-Ins 2. Select Analysis Toolpak 3. Click GO 4. In the dialogue box presented tick Analysis Toolpak 5. Do the same for Solver Add-in Excel 2003 - To install these two add-ins, proceed as follows: 1. Select Tools/Add-ins 2. Click on the Analysis Toolpak and Solver-Addin check boxes

26

## Financial Modelling in Excel (v2007)

Celsoft Corporation

## Application Fast and efficient use of Excel tools.

Ctrl A Ctrl B Ctrl C Ctrl D Ctrl F Ctrl G Ctrl H Ctrl I Ctrl K Ctrl N Ctrl O Ctrl P Ctrl R Ctrl S Ctrl U Ctrl V Ctrl X Ctrl Z Ctrl Pg Dn Ctrl Pg Up Ctrl Arrow Ctrl End Ctrl Home Ctrl 1 Ctrl F3 Ctrl ~

Select entire sheet Bold Copy Fill down Find Go to Replace Italics Hyperlink New sheet Open file Print Fill right - Copy the formula from the cell on the left of the active cell Save Underline Paste Cut Undo Move to the next sheet Move to the previous sheet Move to the end of the row (or column) in the direction of the arrow Go to bottom right-hand corner of spreadsheet Go to cell A1 Format cells Define a name Name Manager Display the formulas in the worksheet

27

## Financial Modelling in Excel (v2007)

Celsoft Corporation

## EXCELS BASIC EFFICIENCY TOOLS Hyperlinks

Application Jump from one sheet to another efficiently. Link to a reference file or website efficiently.

Hyperlinks can be inserted into a spreadsheet linking a cell with a cell in another sheet or another file. Give the cell you wish to link to (in the file you wish to link to) a range name, e.g. Income Statement Select the cell you wish to link from (cell C3 in our example) Select the commands Insert/Link/Hyperlink. (2003 Insert/Hyperlink) The dialogue box below appears. Click on Place in This Document (see the left hand side of the dialogue box), and select the desired Defined name (the cells range name) Click OK

28

## Financial Modelling in Excel (v2007)

Celsoft Corporation

## Naming Cells & Ranges

Benefits Efficient referencing of a cell Readable formulas that simply model auditing and testing. Using other Excel techniques including referencing in VBA.

You can assign any worksheet cell or range a name and then use that name in a formula. Reasons: Ease of reference Required by certain functions. Makes model auditing easy.

Manually, with the command Formulas/Defined Names/Define Name. (2003 - Insert/Names/Define) or by clicking in the Name box and typing in the name,

29

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Automatically, with the commands Formulas/Defined Names/Create from Selection (2003 - Insert/Names/Create), and directing Excel to use the column headings and/or row titles to name the columns and/or rows of data. An easy way to assign a name is to select a cell or range and enter the name you want to assign it in Excels name box on the formula bar. A name cannot have two words and the same name cannot be used twice in the same workbook. If you name cells or ranges after youve already used their values in formulas, you need to explicitly tell Excel to use the names in the formulas. You can do this with the command Formulas, Define Name, Apply Names or Insert, Name, Apply in 2003. Select the names you want to use from the Apply Names

Using a Formula to Name a Range Dynamically The section above (Naming Cells & Ranges Used in Formulas) describes the usual methods used to create names in a worksheet. However, you can also make use of a special range-naming option: Name a range by using a formula. When might you want to do this? A common situation is this: You want to refer to a range whose length may change over time. You dont want to have to rename the range each time its length changes. However, if you name the range using a dynamic formula, the formula will adjust when the range length adjusts, and the name will always refer to the entire set of data. Heres how to accomplish this: Locate your list in some area of the worksheet. Below is a simple, three column list.

## The current list is in the range B5:D9.

Without having selected the list, issue the commands Formulas, Define Name to open the Define Name dialog. Supply a name for the range when prompted.

30

## Financial Modelling in Excel (v2007)

Celsoft Corporation

In the example above, I supplied the name MyRange. In the Refers to box, enter not the reference to the current range (B5:D9), but instead, a formula that will dynamically define the range. The formula will take this format: =OFFSET(Sheet1!\$B\$5, 0,0, COUNTA(Sheet1!\$B:\$B),3)

How the formula works: The first argument of the OFFSET function is the anchor cell: In our example, B5. This cell should be the upper-left-hand cell in the range, either a data cell or the first header cell if your list has headers. Note that the sheet name is included in this reference and the reference to the anchor cell is absolute. The second argument indicates how many rows down to move from the offset cell to begin the range. In our example, since 5 is the first row of the range, we move zero rows. The third argument indicates how many columns to the right to move from the offset cell to begin the range. In our example, since B is the first column of the range, we move zero columns. The fourth argument tells how many rows belong in the range. Instead of providing a static value here, use the COUNTA function. Supplying the COUNTA function with the reference \$B:\$B indicates that it should count all the occupied rows in the B column. If more or fewer values are included in the B column, COUNTA(Sheet1!\$B:\$B) will keep track of them. Its important not to

have extraneous data beneath the dynamic range. Note also that the sheet name is included and
the column B reference is absolute. The fifth and final argument tells how many columns to include in the range.

31

## Financial Modelling in Excel (v2007) Notes:

Celsoft Corporation

A dynamic range name constructed in this way will appear in the list of worksheet range names when you choose Formulas, Define Name. However it will not appear in the list of names in the drop-down Name Box on the formula bar. Because a dynamic named range is dependent on calculation, it can only be referenced in an open workbook.

## Copying formulas: relative and absolute addressing

Application To ensure accuracy of formulas when formulas are copied across and down the sheets

You may often want to use the same formula in one or more places in a worksheet. Its most efficient to build the formula one time and then copy it to the other locations where you need it. If you copy a formula, you must understand Excels relative and absolute addressing. For copied formulas Excel uses relative addressing as the default. That is, Excel adjusts the cell references in your source formula when the formula is copied to a new location. Specify absolute addressing with a dollar sign (an arbitrarily selected symbol) before the row reference and the column reference. Relative: The row and column references can change when you copy the formula to another cell because the references are actually offsets from the current row and column. Absolute: The row and column references do not change when you copy the formula because the reference is to an actual cell address. Mixed: Either the row or column reference is relative, and the other is absolute.

11 You can enter non-relative references (that is, absolute or mixed) manually by inserting dollar signs in the appropriate positions of the cell address. Or you can use a handy shortcut: the F4

32

## Financial Modelling in Excel (v2007)

Celsoft Corporation

key. When youve entered a cell reference (by typing it or by pointing), you can press F4 repeatedly to have Excel cycle through all four reference types.

Worksheet Protection

Objectives To understand how to protect formula cells and leave input cells editable To understand how to assign permissions to users. To understand workbook protection and its effects.

Excel users protect a worksheet for a variety of reasons. One reason is to prevent yourself or others from accidentally deleting formulas or other critical data. A common scenario is to protect a worksheet so that the data can be changed, but the formulas cant be changed. To protect a worksheet, activate the worksheet and choose Review Changes Protect Sheet. Excel displays the Protect Sheet dialog box

Note that providing a password is optional. If you enter a password, that password will be required to unprotect the worksheet. If you accept the default options in the Protect Sheet dialog box, none of the cells on the worksheet can be modified.

FIGURE 31.1 Unlocking cells In many cases, you will want to allow some cells to be changed when the worksheet is protected. For example, your worksheet may have some input cells that are used by formula cells. In such a case, you would want the user to be able to change the input cells, but not the formula cells. Every cell has a Locked attribute, and that attribute determines whether the cell can be changed when the sheet is protected. By default, all cells are locked. To change the locked attribute, select the cell or range and then use the Protection tab of the Format Cells dialog box To display this dialog box, right-click the cell or range and choose Format Cells from the shortcut menu (or press Ctrl+1). Remove the check mark from Locked and click OK.

33

## Financial Modelling in Excel (v2007)

Celsoft Corporation

31 To unprotect a protected sheet, choose Review Changes Unprotect Sheet. If the sheet is protected with a password, youre prompted to enter the password. Sheet protection options The Protect Sheet dialog box has several options, which determine what the user can do when the worksheet is protected. Select locked cells: If checked, the user can select locked cells using the mouse or the keyboard. This setting is checked, by default. Select unlocked cells: If checked, the user can select unlocked cells using the mouse or the keyboard. This setting is checked, by default. Format cells: If checked, the user can apply formatting to locked cells. Format columns: If checked, the user can hide or change the width of columns. Format rows: If checked, the user can hide or change the height of rows. Insert columns: If checked, the user can insert new columns. Insert rows: If checked, the user can insert new rows. Insert hyperlinks: If checked, the user can insert hyperlinks (even in locked cells). Delete columns: If checked, the user can delete columns. Delete rows: If checked, the user can delete rows. Sort: If checked, the user can sort data in a range (as long as the range doesnt contain any locked cells). Use AutoFilter: If checked, the user can use existing auto filtering. Use PivotTable reports: If checked, the user can change the layout of pivot tables or create new pivot tables. Edit objects: If checked, the user can make changes to objects (such as Shapes) and charts, as well as insert or delete comments.

34

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Edit scenarios: If checked, the user can use scenarios (see Chapter 36).

Assigning User Permissions Excel also offers the ability to assign user-level permissions to different areas on a protected worksheet. You can specify which users can edit a particular range while the worksheet is protected. As an option, you can require a password to make changes. This feature is rarely used, and the setup procedure is rather complicated. But if you need this level of protection, setting it up is worth the effort to get it. Start by unprotecting the worksheet if its protected. Then choose Review Changes Allow Users To Edit Ranges, which displays the dialog box shown in Figure 31.4. Then follow the prompts in the series of dialog boxes that follow. Make sure that you protect the sheet as the final step. Protecting a workbooks windows To prevent others (or yourself) from changing the size or position of a workbooks windows, you can protect the workbooks windows: 1. Choose Review Changes Protect Workbook. 2. In the Protect Workbook dialog box, place a check mark next to Windows. 3. Enter a password, if desired. 4. Click OK. When a workbooks windows are protected, the user cant change anything related to the window size or position. For example, if the workbook window is maximized when the windows are protected, the user cannot unmaximize the window. The windows can, however, be zoomed. To unprotect the workbooks windows, choose Review Changes Unprotect Workbook. If the workbooks windows were protected with a password, you are prompted to enter the password. FIGURE 31.9

35

## Financial Modelling in Excel (v2007) DATA MANAGEMENT TOOLS

Celsoft Corporation

Objectives To understand some key techniques of summarizing data To understand techniques of preventing invalid data from being entered in cells To understand ways of accessing (filtering) data and consolidating different data sets.

## Validating data & producing drop-down lists

Application Prevent invalid typing into particular cells, accidentally or intentionally. To prevent entering of invalid input that will lead the model to producing ridiculous results e.g. margin of 120% or decimals of human beings. Circle in valid data if the data had already been entered into the spreadsheet Present the user with a drop-down list containing a list of input choices

Go to Data\Data Tools\Data Validation\Data validation (2007) or; Data\Validation in 2003 Validation can be performed on data in a cell according to the validation criteria shown in the box below.

36

## Financial Modelling in Excel (v2007)

Celsoft Corporation

One can also select the message that should be displayed if invalid data is entered, along with the error alert symbol that should be displayed.

To prevent invalid data being entered into the spreadsheet: 1. Select the relevant cells on the spreadsheet 2. Open the Data validation dialogue box 3. Select the desired validation criteria Types of Validation Criteria You Can Apply Any Value: Selecting this option removes any existing data validation. Whole Number: The user must enter a whole number. You specify a valid range of whole numbers by using the Data drop-down list. For example, you can specify that the entry must be a whole number greater than or equal to 100. Decimal: The user must enter a number. You specify a valid range of numbers by using the Data drop-down list. For example, you can specify that the entry must be greater than or equal to 0 and less than or equal to 1. List: The user must choose from a list of entries you provide. Date: The user must enter a date. You specify a valid date range by using the Data drop-down list. For example, you can specify that the entered data must be greater than or equal to January 1, 2007, and less than or equal to December 31, 2007. Time: The user must enter a time. You specify a valid time range by using the Data drop-down list. For example, you can specify that the entered data must be greater than 12:00 p.m. Text Length: The length of the data (number of characters) is limited. You specify a valid length by using the Data drop-down list. For example, you can specify that the length of the entered data be 1 (a single alphanumeric character).

37

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Custom: To use this option, you must supply a logical formula that determines the validity of the users entry (a logical formula returns either True or False). You can enter the formula directly into the Formula control (which appears when you select the Custom option), or you can specify a cell reference that contains a formula.

To present the user with a drop-down box containing a list of input choices for the current cell: 1. In a column on the spreadsheet list the choices for the input cells concerned 2. Select the cells on the spreadsheet for which this list of choices is applicable 3. Open the Data validation dialogue box. In the Allow box, select List 4. In the Source box now presented, enter the column of choices, either in the form of cell addresses or a range name (if you named the column of choices). Note that the range or name should be preceded by an =. This creates what is termed an in-cell drop down list. Encircle Invalid Data The Data Data Tools Data Validation drop-down control contains an item named Circle Invalid Data. When you click this item, circles appear around cells that contain incorrect entries. If you correct an invalid entry, the circle disappears. To get rid of the circles, choose Data Data Tools Data Validation Clear Validation Circles.

Using Formulas for Data Validation Rules For simple data validation, the data validation feature is quite straightforward and easy to use. But the real power of this feature becomes apparent when you use data validation formulas. The formula that you specify must be a logical formula that returns either True or False. If the formula evaluates to True, the data is considered valid and remains in the cell. If the formula evaluates to False, a message box appears that displays the message specified in the Error Alert tab of the Data Validation dialog box. You can specify a formula in the Data Validation dialog box by selecting the Custom option in the Allow drop-down list of the Settings tab. You can enter the formula directly into the Formula control, or you can enter a reference to a cell that contains a formula. If the formula that you enter into the Data Validation dialog box contains a cell reference, that reference is considered a relative reference, based on the upper-left cell in the selected range.

38

## Financial Modelling in Excel (v2007)

Celsoft Corporation

## Example: Data validation examples.xlsx.

Accepting text only Excel has a Data Validation option to limit the length of text entered into a cell. To force a cell or range to accept only text (no values), use the following data validation formula: =ISTEXT(A1) This formula assumes that the active cell in the selected range is cell A1.

Accepting a larger value than the previous cell The following data validation formula enables the user to enter a value only if its greater than the value in the cell directly above it: =A2>A1 This formula assumes that A2 is the active cell in the selected range. Note that you cant use this formula for a cell in row 1. Accepting no duplicate entries only The following data validation formula does not permit the user to make a duplicate entry in the range A1:C20: =COUNTIF(\$A\$1:\$C\$20,A1)=1 This formula assumes that A1 is the active cell in the selected range. Note that the first argument for COUNTIF is an absolute reference. The second argument is a relative reference, and it adjusts for each cell in the validation range Accepting only a date thats a Monday The following Data Validation formula ensures that the cell entry is a date, and the date is a Monday. =WEEKDAY(A1)=2 This formula assumes that the active cell in the selected range is cell A1. It uses the WEEKDAY function, which returns 1 for Sunday, 2 for Monday, and so on.

39

Financial Modelling in Excel (v2007) Accepting only values that dont exceed a total

Celsoft Corporation

The following Data Validation formula ensures that the sum of the budget items does not exceed the budget: =SUM(\$B\$1:\$B\$6)<=\$E\$5

Application Understand how to filter data and drill down to select the data one wants to see. Understand how to filter data using various dimensions either on the same place or extracting the selection required.

Searching a database in Excel is known as "Filtering". Excel provides us with a means of filtering data "automatically" - called AutoFilter, or creating filters (criteria) and storing results in a more permanent manner - called Advanced Filter. To merely display required data (filter the database), choose the commands Data/Sort & filter/Filter. This will cause arrow buttons to be displayed at the top of each column. Click the arrow button in the column in which you want to search for data, and choose from the selection list displayed. To remove the AutoFilter arrows, again select the commands Data/Sort & Filter/Filter. (2003 Data/Filter/Autofilter)

The Advanced command works differently from the Filter command in several important ways. It displays the Advanced Filter dialog box instead of the AutoFilter menu. You type the advanced criteria in a separate criteria range on the worksheet and above the range of cells or table you want to filter. Microsoft Office Excel uses the separate criteria range in the Advanced Filter dialog box as the source for the advanced criteria.

40

## Financial Modelling in Excel (v2007)

Celsoft Corporation

To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.

B Salesperson

C Sales

## Sales \$5122 \$450 \$6328 \$6544

Because the equal sign (=) is used to indicate a formula when you type text or a value in a cell, Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range: =''=entry'' Where entry is the text or value you want to find. For example:

## Multiple criteria, one column, any criteria true

41

Financial Modelling in Excel (v2007) Boolean logic: (Salesperson = "Davolio" OR Salesperson = "Buchanan")

Celsoft Corporation

Insert at least three blank rows above the list range that can be used as a criteria range. The criteria range must have column labels. Make sure that there is at least one blank row between the criteria values and the list range.

To find rows that meet multiple criteria for one column, type the criteria directly below each other in separate rows of the criteria range. In the example, you would enter: A 1 2 3 Type B Salesperson ="=Davolio" ="=Buchanan" C Sales

Click a cell in the list range. In the example, you would click any cell in the range, A6:C10. On the Data tab, in the Sort & Filter group, click Advanced.

Do one of the following: To filter the list range by hiding rows that don't match your criteria, click Filter the list, in-place. To filter the list range by copying rows that match your criteria to another area of the worksheet, click Copy to another location, click in the Copy to box, and then click the upper-left corner of the area where you want to paste the rows. Tip When you copy filtered rows to another location, you can specify which columns to include in the copy operation. Before filtering, copy the column labels for the columns that you want to the first row of the area where you plan to paste the filtered rows. When you filter, enter a reference to the copied column labels in the Copy to box. The copied rows will then include only the columns for which you copied the labels.

42

Financial Modelling in Excel (v2007) Multiple criteria, multiple columns, all criteria true Boolean logic: (Type = "Produce" AND Sales > 1000)

Celsoft Corporation

To find rows that meet multiple criteria in multiple columns, type all of the criteria in the same row of the criteria range. In the example, you would enter:

A 1 2 Type ="=Produce"

B Salesperson

C Sales >1000

In the Criteria range box, enter the reference for the criteria range, including the criteria labels. In the example, you would enter \$A\$1:\$C\$2. Multiple criteria, multiple columns, any criteria true Boolean logic: (Type = "Produce" OR Salesperson = "Buchanan") To find rows that meet multiple criteria in multiple columns, where any criteria can be true, type the criteria in the different columns and rows of the criteria range. In the example, you would enter: A 1 2 3 Type ="=Produce" ="=Buchanan" B Salesperson C Sales

Multiple sets of criteria, one column in all sets Boolean logic: ( (Sales > 6000 AND Sales < 6500 ) OR (Sales < 500) ) To find rows that meet multiple sets of criteria, where each set includes criteria for one column, include multiple columns with the same column heading. In the example, you would enter: A 1 2 3 Type B Salesperson C Sales >6000 <500 D Sales <6500

43

Financial Modelling in Excel (v2007) Multiple sets of criteria, multiple columns in each set

Celsoft Corporation

Boolean logic: ( (Salesperson = "Davolio" AND Sales >3000) OR (Salesperson = "Buchanan" AND Sales > 1500) ) A 1 2 3 Type B Salesperson ="=Davolio" ="=Buchanan" C Sales >3000 >1500

## Subtotal, Outline (Grouping & Ungrouping)

Application Quickly summarize data by categories. Drill down data to see the summary or the detail.

Like the other list management features in Excel, the Subtotal recognizes data in an Excel list format and will operate on that list if you click on any cell in the list before getting started. When you plan to use the Subtotal command, always first consider whether and how to use the Sort command. Excel cant effectively subtotal unsorted data. Choose the commands Data, Outline Group, Subtotal to open the Subtotal dialog box.

The default subtotal function is sum. Other functions available include Count, Average, Max, Min, Product, Count Nums, StdDev, StdDevp, Var, and Varp. The dialog allows you to determine how the subtotal will be organized. Excel creates subtotals and puts them in an outline format so they can be easily collapsed for a summary view. Remove subtotals with Data, Outline Group, Subtotals, Remove All.

44

## Financial Modelling in Excel (v2007) Outline

Celsoft Corporation

Excel provides a convenient outline feature that facilitates showing your data in summary or detail fashion. The Outline view displays automatically after you use the Subtotal command. Or, you can create an outline automatically (Data, Group and Outline, Auto Outline) or by hand. To create an outline manually, select the data to outline and choose Data, Group and Outline,

Group.
Make sure you insert your own summary rows with formulas immediately below or above each group of detail rows.

An outline can encompass up to eight levels of detail. Remove outlining from the spreadsheet with Data, Group and Outline, Clear Outline.

## Consolidate data in multiple worksheets

Application Understand how to filter data and drill down to select the data one wants to see. Understand how to filter data using various dimensions either on the same place or extracting the selection required.

To summarize and report results from separate worksheets, you can consolidate data from each separate worksheet into a master worksheet. The worksheets can be in the same workbook as the master worksheet or in other workbooks. When you consolidate data, you are assembling data so that you can more easily update and aggregate it on a regular or ad hoc basis. For example, if you have a worksheet of expense figures for each of your regional offices, you might use a consolidation to roll up these figures into a corporate expense worksheet. This master worksheet might contain sales totals and averages, current inventory levels, and highest selling products for the entire enterprise. For data consolidation, use Excels Consolidate dialog box. This method is very flexible, and in some cases, it even works if the source worksheets arent laid out identically. This technique can create consolidations that are static (no link formulas) or dynamic (with link formulas). The Data Consolidate feature supports the following methods of consolidation:

45

## Financial Modelling in Excel (v2007)

Celsoft Corporation

By position: This method is accurate only if the worksheets are laid out identically. By category: Excel uses row and column labels to match data in the source worksheets. Use this option if the data is laid out differently in the source worksheets or if some source worksheets are missing rows or columns.

The picture below shows the Consolidate dialog box, which appears when you choose Data Data Tools Consolidate. Following is a description of the controls in this dialog box:

FIGURE 27.6 The Consolidate dialog box enables you to specify ranges to consolidate. Function list box: Specify the type of consolidation. Sum is the most commonly used consolidation function, but you also can select from ten other options. Reference text box: Specify a range from a source file that you want to consolidate. You can enter the range reference manually or use any standard pointing technique (if the workbook is open). After you enter the range in this box, click the Add button to add it to the All References list. If you consolidate by position, dont include labels in the range. If you consolidate by category, do include labels in the range. All References list box: Contains the list of references that you have added with the Add button.

46

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Use Labels In check boxes: Use to instruct Excel to perform the consolidation by examining the labels in the top row, the left column, or both positions. Use these options when you consolidate by category. Create Links to Source Data check box: When you select this option, Excel adds summary formulas for each label and creates an outline. If you dont select this option, the consolidation doesnt use formulas, and an outline isnt created. Browse button: Displays a dialog box that enables you to select a workbook to open. It inserts the filename in the Reference box, but you have to supply the range reference. Youll find that your job is much easier if all the workbooks to be consolidated are open. Add button: Adds the reference in the Reference box to the All References list. Make sure that you click this button after you specify each range. Delete button: Deletes the selected reference from the All References list. To consolidate data, use the Consolidate command in the Data Tools group on the Data tab.

What do you want to do? If you want to Arrange the data in all worksheets in identical order and location Organize the data differently in the separate worksheets, but use the same row and column labels so that the master worksheet can match the data Use a PivotTable report instead of a consolidation Use a PivotTable report to consolidate data Consolidate by category Then Consolidate by position

Consolidate by position 1. Set up the data to be consolidated on each separate worksheet. Make sure that each range of data is in list format: each column has a label in the first row and contains similar facts, and there are no blank rows or columns within the list.

47

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Put each range on a separate worksheet. Don't put any of the ranges on the worksheet where you plan to put the consolidation.

Make sure that each range has the same layout. Name each range: Select the entire range, and then on the Formulas tab in the Named Cells group, click the arrow next to Name a Range, and type a name for the range in the Name box.

2. Click the upper-left cell of the area where you want the consolidated data to appear in the master worksheet. NOTE Make sure that you leave enough cells to the right and below this cell for the

consolidated data. The Consolidate command populates the area as needed. 3. On the Data tab, in the Data Tools group, click Consolidate.

4. In the Function box, click the summary function that you want Microsoft Office Excel to use to consolidate the data. 5. If the worksheet is in another workbook, click Browse to locate the file, and then click OK to close the Browse dialog box. The file path is entered in the Reference box followed by an exclamation point. 6. Type the name that you gave the range, and then click Add. Repeat this step for each range. 7. Decide how you want to update the consolidation. Do one of the following: To set up the consolidation so that it updates automatically when the source data changes, select the Create links to source data check box. IMPORTANT You can only select this check box if the worksheet is in another workbook. Once you select this check box, you won't be able to change which cells and ranges are included in the consolidation.

48

## Financial Modelling in Excel (v2007)

Celsoft Corporation

To set up the consolidation so that you can update the consolidation manually by changing the included cells and ranges, clear the Create links to source data check box.

8. Leave the boxes under Use labels in blank. Excel does not copy the row or column labels in the source ranges to the consolidation. If you want labels for the consolidated data, copy them from one of the source ranges or enter them manually.

Consolidate by category Select the check boxes under Use labels in that indicate where the labels are located in the source ranges: either the Top row, the Left column, or both. NOTES Any labels that don't match up with labels in the other source areas result in separate rows or columns in the consolidation. Make sure that any categories that you don't want to consolidate have unique labels that appear in only one source range.

An example The simple example in this section demonstrates the power of Excels Data Consolidate feature. shows three single-sheet workbooks that will be consolidated. These worksheets report product sales for three months. Notice, however, that they dont all report on the same products. In addition, the products arent even listed in the same order. In other words, these worksheets arent laid out identically. Creating consolidation formulas manually would be a very tedious task. Use workbooks The files are named region1.xlsx, region2.xlsx, and region3.xlsx. To consolidate this information, start with a new workbook. You dont need to open the source workbooks, but consolidation is easier if they are open. Follow these steps to consolidate the workbooks: Choose Data Data Tools Consolidate. Excel displays its Consolidate dialog box. Use the Function drop-down list to select the type of consolidation summary that you want to use. Use Sum for this example.

49

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Enter the reference for the first worksheet to consolidate. If the workbook is open, you can point to the reference. If its not open, click the Browse button to locate the file on disk. The reference must include a range. You can use a range that includes complete columns, such as A:K. This range is larger than the actual range to consolidate, but using this range ensures that the consolidation will still work if new rows and columns are added to the source file. When the reference in the Reference box is correct, click Add to add it to the All References list. Enter the reference for the second worksheet. You can point to the range in the Region2 workbook, or you can simply edit the existing reference by changing Region1 to Region2 and then clicking Add. This reference is added to the All References list. Enter the reference for the third worksheet. Again, you can edit the existing reference by changing Region2 to Region3 and then clicking Add. This final reference is added to the All References list. Because the worksheets arent laid out the same, select the Left column and Top row check boxes to force Excel to match the data by using the labels. Select the Create Links to Source Data check box to make Excel create an outline with external references. Click OK to begin the consolidation.

Refreshing a consolidation If you want to refresh a consolidation later, you dont have to re-enter the references. Just display the Consolidate dialog box, verify that the ranges are correct, and click OK.

Formula Auditing

Application Understand how to trace errors, check cell dependents and precedents. Understand how to display formulas on screen instead of their cell results

50

## Financial Modelling in Excel (v2007)

Celsoft Corporation

You can locate the cells that supply data for formulas and find cells that depend on values in other cells by using the Auditing Group on the Formulas Tab Use Excel's Auditor to Correct Problems and Examine Cell Relationships For example, a circular reference occurs when a formula mistakenly refers to itself and thus can't be resolved. Click the problem cell and use the Trace Error button on the Auditing Toolbar to locate the error. Click the cell whose dependents or precedents you want to locate and use the trace precedents or trace dependents icons on the Auditing Group. Excel draws arrows on the worksheet to show relationships between cells. Use the Remove Arrows icon or the erase dependent arrows icons to erase the arrows when you're through.

## Creating conditional formats in Excel 2007

Application Understand how to dynamically format cells to reveal information hidden in numbers. Understand how to improve the appearance of your model through fine visual effects.

Conditional formatting works a little differently in Excel 2007, and quite a few enhancements have been made. The Conditional formatting command sequence is: Home/Styles/Conditional formatting This will bring up the following dialogue box

51

Financial Modelling in Excel (v2007) And selecting the first item on the menu will expand the dialogue box to:

Celsoft Corporation

And again selecting the first item Greater than will bring up the dialogue box allowing you to format the cell according to its contents.

To format a cell according to a formula, one would select the More rules. option on the previous page. The following dialogue box will appear

52

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Creating conditional formats in Excel 2007 (contd) Thus in Excel 2007, a desired format can be applied to cells if: A cell meets certain specified criteria (e.g. is greater than, less than, equal to, falls between certain values, contains a string of text, occurs between two dates) Values in a range are duplicated (or are unique) Values fall within the top x number of values or the bottom x number of values, or are above, or below, the average. Cells can be highlighted according to their values (called data bars) or can be flagged with icons depending on where their values fall.

53

## Financial Modelling in Excel (v2007)

Celsoft Corporation

EXCEL FUNCTIONS

Objectives Understand various Excel functions and learn how to apply them in different modeling scenarios.

Formula Basics
Formulas are what make a spreadsheet program so useful. You use formulas in your Excel worksheets to calculate results from the data stored in the worksheet. When data changes, those formulas calculate updated results with no extra effort on your part. We introduce formulas and functions that will help you get up to speed with this important element. Understanding Formula Basics A formula can consist of any of these elements: Mathematical operators, such as + (for addition) and * (for multiplication) Cell references (including named cells and ranges) Values or text Worksheet functions (such as SUM or AVERAGE) Formulas always begin with the equal sign so that Excel can distinguish them from text.

## Operators Used in Formulas

Operator + * / Name Addition Subtraction Multiplication Division

54

Financial Modelling in Excel (v2007) ^ & = > < >= <= <> Exponentiation Concatenation Logical comparison (equal to) Logical comparison (greater than) Logical comparison (less than) Logical comparison (greater than or equal to) Logical comparison (less than or equal to) Logical comparison (not equal to)

Celsoft Corporation

You can, of course, use as many operators as you need to perform the desired calculation. Following are some examples of formulas that use various operators. What It Does

Formula

=Part-&23A Joins (concatenates) the two text strings to produce Part-23A. =A1&A2 Concatenates the contents of cell A1 with cell A2. Concatenation works with values as well as text. If cell A1 contains 123 and cell A2 contains 456, this formula would return the value 123456. =6^3 =216^(1/3) =A1<A2 Raises 6 to the third power (216). Returns the cube root of 216 (6). Returns TRUE if the value in cell A1 is less than the value in cell A2. Otherwise, it returns FALSE. Logical-comparison operators also work with text. If A1 contained Bill and A2 contained Julia, the formula would return TRUE, because Bill comes before Julia in alphabetical order. =A1<=A2 =A1<>A2 Returns TRUE if the value in cell A1 is less than or equal to the value in cell A2. Otherwise, it returns FALSE. Returns TRUE if the value in cell A1 isnt equal to the value in cell A2. Otherwise, it returns FALSE Understanding operator precedence in formulas When Excel calculates the value of a formula, it uses certain rules to determine the order in which the various parts of the formula are calculated. You need to understand these rules if you want your formulas to produce the desired results.

55

## Financial Modelling in Excel (v2007)

Celsoft Corporation

The table below lists the Excel operator precedence. This table shows that exponentiation has the highest precedence (its performed first) and logical comparisons have the lowest precedence (theyre performed last).

Operator Precedence in Excel Formulas Symbol ^ * / + & = < > Operator Exponentiation Multiplication Division Addition Subtraction Concatenation Equal to Less than Greater than Precedence 1 2 2 3 3 4 5 5 5

You can use parentheses to override the Excels built-in order of precedence. Expressions within parentheses are always evaluated first. E.g. =(B2-B3)*B4 Compare with the following formula without parentheses: =B2-B3*B4 You can also nest parentheses within formulasthat is, put them inside other parentheses. If you do so, Excel evaluates the most deeply nested expressions firstand then works its way out. Heres an example of a formula that uses nested parentheses: =((B2*C2)+(B3*C3)+(B4*C4))*B6 Every left parenthesis, of course, must have a matching right parenthesis. If you have many levels of nested parentheses, keeping them straight can sometimes be difficult. If the parentheses dont match, Excel displays a message explaining the problemand wont let you enter the formula. In some cases, if your formula contains mismatched parentheses, Excel may propose a correction to your formula.

56

## Financial Modelling in Excel (v2007)

Celsoft Corporation

## Excels Formula AutoCorrect feature often suggests a correction to an erroneous formula.

Using functions in your formulas Most formulas you create use worksheet functions. These functions enable you to greatly enhance the power of your formulas and perform calculations that are difficult (or even impossible) if you use only the operators discussed previously. For example, you can use the TAN function to calculate the tangent of an angle. You cant do this calculation by using only the mathematical operators. Examples of formulas that use functions A worksheet function can simplify a formula significantly. To calculate the average of the values in 10 cells (A1:A10) without using a function, youd have to construct a formula like this: =(A1+A2+A3+A4+A5+A6+A7+A8+A9+A10)/10 Not very pretty, is it? Even worse, you would need to edit this formula if you added another cell to the range. Fortunately, you can replace this formula with a much simpler one that uses one of Excels built-in worksheet functions: =AVERAGE(A1:A10) Syntax of Excel functions All the functions used parentheses. A formula must begin with an equal sign to inform Excel that the cell contains a formula rather than text. A comma as a list-separator character The information inside the parentheses is called the list of arguments. Functions vary in how they use arguments. Depending on what it has to do, a function may use: No arguments

57

Financial Modelling in Excel (v2007) One argument A fixed number of arguments An indeterminate number of arguments Optional arguments

Celsoft Corporation

An example of a function that doesnt use an argument is the NOW function, which returns the current date and time. Even if a function doesnt use an argument, you must still provide a set of empty parentheses, like this: =NOW()

More about functions All told, Excel includes 340 functions. And if thats not enough, you can purchase additional specialized functions from third-party suppliersand even create your own custom functions (by using VBA) if youre so inclined. Some users feel a bit overwhelmed by the sheer number of functions, but youll probably find that you use only a dozen or so, on a regular basis. And as youll see, Excels Insert Function dialog box (described later in this section) makes it easy to locate and insert a function, even if its not one that you use frequently. You can insert a function by selecting it from one of the function categories.

58

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Yet another way to insert a function while youre entering a formula is to use the Function List to the left of the Formula bar

Common Formula Errors TABLE 11.3 Excel Error Values Error Value #DIV/0! #NAME? #N/A Explanation The formula is trying to divide by zero. This also occurs when the formula attempts to divide by whats in a cell that is empty (that is, by nothing). The formula uses a name that Excel doesnt recognize. This can happen if you delete a name thats used in the formula or if you have unmatched quotes when using text. The formula is referring (directly or indirectly) to a cell that uses the NA function to signal that data is not available. Some functions (for example, VLOOKUP) can also return #N/A. #NULL! #NUM! #REF! #VALUE! The formula uses an intersection of two ranges that dont intersect. (This concept is described later in the chapter.) A problem with a value exists; for example, you specified a negative number where a positive number is expected. The formula refers to a cell that isnt valid. This can happen if the cell has been deleted from the worksheet. The formula includes an argument or operand of the wrong type. An operand is a value or cell reference that a formula uses to calculate a result

59

## Financial Modelling in Excel (v2007) Intentional Circular References

Celsoft Corporation

You can sometimes use a circular reference to your advantage. For example, suppose a company has a policy of contributing 5 percent of its net profit to charity. The contribution itself, however, is considered an expenseand is therefore subtracted from the net profit figure. This produces a circular reference (see the accompanying figure). The Contributions cell contains the following formula: =5%*Net_Profit The Net Profit cell contains the following formula: =Gross_Income-Expenses-Contributions

These formulas produce a resolvable circular reference. If the Enable Iterative Calculation setting is on, Excel keeps calculating until the Contributions value is, indeed, 5 percent of Net Profit. In other words, the result becomes increasingly accurate until it converges on the final solution.

Specifying when formulas are calculated Youve probably noticed that Excel calculates the formulas in your worksheet immediately. If you change any cells that the formula uses, Excel displays the formulas new result with no effort on your part. All this happens when Excels Calculation mode is set to Automatic. In Automatic Calculation mode (which is the default mode), Sometimes, however, you may want to control when Excel calculates formulas. For example, if you create a worksheet with thousands of complex formulas, youll find that processing can slow to a snails pace while Excel does its thing. In such a case, set Excels calculation mode to Manualwhich you can do by choosing Formulas Calculation Calculation Options Manual

60

Financial Modelling in Excel (v2007) You can control when Excel calculates formulas.

Celsoft Corporation

Logical Functions
The IF function It is often necessary in financial modelling to use logical tests in a model. i.e. a statement that reads:

If this condition is true, then use this formula, else use that formula.
E.g. If sales are greater than target of 10 000, then calculate commission at 10% of the sales,

## else just pay the minimum commission of 1000.

In most modelling systems this is known as an If, Then, Else statement. Excels IF function is probably the most important of the set of Excels logical functions. Excels other logical functions are AND, NOT, OR, FALSE and TRUE. The IF function checks a condition that must be either true or false. If the condition is true, the function returns one value; if the condition is false, the function returns another value. The IF function has three arguments: the condition you want to check, the value to return if the condition is true, and the value to return if the condition is false. The syntax of the IF statement is: =IF(logical_test,value_if_true,value_if_false) Here are some examples of logical statements in a spreadsheet system: =If(C6>=10000,C6*10%,1000) =If(B10<0,"Overdraft","Cash") =If(B1<>B2,"Out of balance!","") Nested Ifs Ifs can also be nested. For example you might have an IF statement that reads IF(this condition is true, THEN take D1*D10, ELSE IF this condition is true, THEN take D1*D11, ELSE IF this condition is true, THEN take D1*D12, ELSE take 0) For example:

61

## Financial Modelling in Excel (v2007)

Celsoft Corporation

IF(Score>89,"A", IF(Score>79,"B", IF(Score>69,"C", IF(Score>59,"D", "F")))) Up to seven IF functions can be nested as value_if_true and value_if_false arguments to construct more elaborate tests. However, a statement with more than one or two embedded IF functions is hard to read and may be unnecessarily complicated.

The AND Function The AND function can handle up to thirty conditions that can evaluate to true or false. This function requires that all its arguments evaluate as true in order for AND to evaluate to True. For example, the formula =AND(1<5,10>2) evaluates to True. But the formula =AND(1<5,12<2) evaluates to False. The OR Function Like the AND function, the OR function can handle up to thirty conditions. However, the OR function requires that only one of the arguments evaluate as true in order to return true. So =OR(1<5,12<2) evaluates to True. The NOT Function The NOT function changes a TRUE outcome to a FALSE one and vice versa. For example, =NOT(12>2) returns False. Excel has additional functions you can use to analyze your data based on a condition. For example, to count the number of occurrences of a string of text or a number within a range of cells, use the COUNTIF worksheet function. To calculate a sum based on a string of text or a number within a range, use the SUMIF worksheet function.

Worksheet Controls

Application To manipulate the model more easily and flexibly To prevent manual typing of assumptions or model variations To control invalid input into the model

62

## Financial Modelling in Excel (v2007) Introduction

Celsoft Corporation

You can build a custom form for a worksheet by using Excel controls. Buttons, check boxes, drop-down lists, spinners, and other kinds of controls can make a worksheet easier for you and others to use. There are two categories of Excel controls you can choose from, and theres a close correspondence between the two. Controls on the Forms toolbar are something of a holdover from earlier versions of Excel. These controls dont require any special programming or definition other than what can be provided from within Excel itself. Use a control from the Forms toolbar when you need a control to run a single macro or for a simple interactive worksheet. In contrast, controls from the Control Toolbox are more sophisticated. Theyre closely linked to Excels Visual Basic for Applications (VBA) environment and require that you write code to manage how the control works.

To bring the Forms toolbox to the Excel ribbon, go to Excel Options, under Customize, All commands, select Controls, click Add and then OK.

63

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Using Forms Toolbar Controls All the control buttons on the Forms toolbar work using the same two-part process: 1) Draw the control on the worksheet, and 2) Format the control. 3) Link a control to a cell Formatting a control determines what data is associated with the control. In addition, formatting can change a controls protection status, how it moves when underlying cells are moved, and what its data entry limits might be. Formatting a control is achieved by right clicking the control and then selecting format control and then the Control tab.

The Check Box Used to collect True/False responses. The check box control is linked to a cell. The result of the check box status appears as TRUE or FALSE in the linked cell. The users selection of the check box results in TRUE; de-selection results in FALSE. For example, in a budget model, you could have a button for Consider recruitment or Suspend recruitment. This control is often used with an IF function that examines the TRUE or FALSE status of the linked cell. For example, =if(LinkCell,TrueResult,FalseResult)

64

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Option Button Used most often to make a single choice from a group of options. E.g., selecting a depreciation method to use. If you draw several option buttons on a worksheet, all these buttons will belong to the same group, so the user will be able to select only one button at a time. However, you can enclose a group of buttons in a group box (drawn with the group tool) and these buttons will function separately from any outside the group box or any other group box.

The Group Box The result from a group of option buttons appears in one, linked cell. To create a group of option buttons draw a group box with the group box tool. While the box is selected, type a title to replace the default box title. Because only one linked cell exists for all option buttons in a group, if the first button is selected, the linked cell holds 1. If the second button is selected, the linked cell holds 2, and so on. The CHOOSE function can be used to turn the numeric choice into different results. For example: =choose(LinkCell,Result1,Result2,Result3...)

The List or Combo Box A list box and a combo (drop-down) box produce the same result, but they look different to the user. A list box shows multiple items in a list while the list itself stays the same height. A combo box (drop-down or pull-down list) is only one item high and has a down-arrow at the right. Clicking the arrow displays the list.

65

## Financial Modelling in Excel (v2007)

Celsoft Corporation

1. After drawing the control, on the workings worksheet, enter a column with the items you want to appear in the list. Enter one item per cell. 2. Right click the list and choose Format Control to display the Format Control tabbed dialog. Select the Control tab. 3. Select the Input Range box and drag across the range in the worksheet that contains the list. This is the list that will appear in the list box or combo box. 4. Select the Cell Link box and click the cell that will receive the results of the list. 5. If youre formatting a combo box, enter in the Drop down Lines box the number of lines that should display when the list appears. Displaying the selection The result of a selection from a list is the number thats the position of the selected item in the list. If a user selected the second item in the list, for example, the linked cell holds 2. If you want to convert this number into an actual item in the list, use the CHOOSE function described earlier, or use the INDEX function. The syntax of the index function is: =index(ItemList,LinkCell,ColumnNo) In our example, assume that a list of items in the range B3:B7 is used for the range in the Input Range box. The link cells for the list is C9 & E9. This cell is where the numeric position of the item the user selects will appear. In another cell you can show the item selected with the formulae: =index(\$B\$3:\$B\$7,\$E\$9,1) =index(\$B\$3:\$C\$7,\$G\$9,2)

This function looks down the list B3:B7 to the row specified in C9. The item in that row of the list (1) is then returned to the cell that contains the index function.

Two-list lookup You can display details in another column by choosing from one list but use a corresponding value from another list. You could use this technique to look up items by name or description etc e.g. in our example in the list box we are selecting the day in order to pick the corresponding %

66

## Financial Modelling in Excel (v2007)

Celsoft Corporation

To use a two-list lookup, you need two lists. One is used as the Input Range for the control, and its the list the user sees. The other is used to find the result you want to retrieve and have appeared in the worksheet. Notice the formula on top.

The Spinner A spinner increases or decreases the amount in the cell linked to it. Holding down the mouse button on a spinner makes it change continuously. Note that using a spinner can cause a great deal of recalculation in a worksheet unless you control worksheet recalculation deliberately. To set the defaults and limits on a spinner control: 1. Right-click the spinner control and choose the Format Control command. 2. On the Format Control tabbed dialog, select the Control tab. 3. In the Current Value box, enter the amount you want the linked cell to have by default when the worksheet opens. 4. In the Minimum Value box, enter the lowest value you want the spinner to produce. In the Maximum Value box, enter the highest. Set the amount of change for each click to the spinner in the Incremental Change box. (The Page Change box isnt used for spinner control.) 5. Select the Cell Link box and click the cell in the worksheet that you want to receive the spinner result.

The Scroll Bar A scroll bar, or slider, lets a user select from a wide range of numbers while getting a visual impression of where their entry lies within the possibilities. The scroll bar can be drawn to operate vertically or horizontally. To enter a number, the user clicks the top or bottom arrow for incremental change or the grey part of the bar for a page amount of change. Or, the user can drag the square button in the scroll bar. Like a spinner, a scroll bar can cause a great deal of recalculation in a worksheet unless you control worksheet recalculation deliberately. To set scroll bar defaults:

67

## Financial Modelling in Excel (v2007)

Celsoft Corporation

The Command Button works with macros hence will be deferred until the topic on Macros.

LookUp Functions
Excel has three functions (LOOKUP, VLOOKUP, and HLOOKUP) designed for this task. A lookup formula essentially returns a value from a table by looking up another related value. A common telephone directory provides a good analogy. If you want to find a persons telephone number, you first locate the name (look it up) and then retrieve the corresponding number.

D2 E2 F2 G2

## =VLOOKUP(C2,EmpData,2,FALSE) =VLOOKUP(C2,EmpData,3,FALSE) =VLOOKUP(C2,EmpData,4,FALSE) =VLOOKUP(C2,EmpData,5,FALSE)

Lookup formulas in row 2 look up the information for the employee name in cell C2.

Functions Relevant to Lookups Several Excel functions are useful when writing formulas to look up information in a table. Table 15.1 lists and describes these functions.

68

## Financial Modelling in Excel (v2007) Basic Lookup Formulas

Celsoft Corporation

You can use the Excel basic lookup functions to search a column or row for a lookup value to return another value as a result. Excel provides three basic lookup functions: HLOOKUP, VLOOKUP, and LOOKUP. In addition, the MATCH and INDEX functions are often used together to return a cell or relative cell reference for a lookup value. The VLOOKUP function The VLOOKUP function looks up the value in the first column of the lookup table and returns the corresponding value in a specified table column. The lookup table is arranged vertically (which explains the V in the functions name). The syntax for the VLOOKUP function is VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) The VLOOKUP functions arguments are as follows:

look up_value : The value to be looked up in the first column of the lookup table. table_array : The range that contains the lookup table. col_index _num : The column number within the table from which the matching value is
returned.

## range_lookup : Optional. If TRUE or omitted, an approximate match is returned. (If an exact

match is not found, the next largest value that is less than lookup_value is returned.) If FALSE, VLOOKUP will search for an exact match. If VLOOKUP cant find an exact match, the function returns #N/A.

NOTE: If the range_lookup argument is TRUE or omitted, the first column of the lookup table must be in ascending order. A very common use for a lookup formula involves an income tax rate schedule. The tax rate schedule shows the income tax rates for various income levels. The following formula (in cell B3) returns the tax rate for the income in cell B2: =VLOOKUP(B2,D2:F7,3) Note that an exact match is not required. If an exact match is not found in the first column of the lookup table, the VLOOKUP function uses the next largest value that is less than the lookup value. In other words, the function uses the row in which the value you want to look up is greater than or equal to the

69

## Financial Modelling in Excel (v2007)

Celsoft Corporation

row value but less than the value in the next row. In the case of a tax table, this is exactly what you want to happen. The HLOOKUP function The HLOOKUP function works just like the VLOOKUP function except that the lookup table is arranged horizontally instead of vertically. The HLOOKUP function looks up the value in the first row of the lookup table and returns the corresponding value in a specified table row. The syntax for the HLOOKUP function is HLOOKUP(lookup_value,table_array,row_index_num,range_lookup) The HLOOKUP functions arguments are as follows

look up_value : The value to be looked up in the first row of the lookup table. table_array : The range that contains the lookup table. row _index _num : The row number within the table from which the matching value is returned. range_lookup : Optional. If TRUE or omitted, an approximate match is returned. (If an exact
match is not found, the next largest value less than lookup_value is returned.) If FALSE, VLOOKUP will search for an exact match. If VLOOKUP cant find an exact match, the function returns #N/A.

The formula in cell B3 is =HLOOKUP(B2,E1:J3,3) The LOOKUP function The LOOKUP function has the following syntax: LOOKUP(lookup_value,lookup_vector,result_vector) The functions arguments are as follows:

look up_value : The value to be looked up in the lookup_vector. look up_vector : A single-column or single-row range that contains the values to be looked up.
These values must be in ascending order.

70

## Financial Modelling in Excel (v2007)

Celsoft Corporation

result_vector : The single-column or single-row range that contains the values to be returned. It
must be the same size as the lookup_vector.

The LOOKUP function looks in a one-row or one-column range (lookup_vector) for a value (lookup_value) and returns a value from the same position in a second one-row or one-column range (result_vector). CAUTION: Values in the lookup_vector must be in ascending order. If lookup_value is smaller than the smallest value in lookup_vector, LOOKUP returns #N/A. Specialized Lookup Formulas Looking up an exact value As demonstrated in the previous examples, VLOOKUP and HLOOKUP dont necessarily require an exact match between the value to be looked up and the values in the lookup table. An example is looking up a tax rate in a tax table. In some cases, you may require a perfect match. For example, when looking up an employee number, you would probably require a perfect match for the number.

## Counting and Summing Worksheet Cells

Generally, a counting formula returns the number of cells in a specified range that meet certain criteria. A summing formula returns the sum of the values of the cells in a range that meet certain criteria. Selected Excels Counting and Summing Functions Function COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS* SUM SUMIF SUMIFS* Description Returns the number of cells that contain a numeric value Returns the number of nonblank cells Returns the number of blank cells Returns the number of cells that meet a specified criterion Returns the number of cells that meet multiple criteria Returns the sum of its arguments Returns the sum of cells that meet a specified criterion Returns the sum of cells that meet multiple criteria

71

## Financial Modelling in Excel (v2007) Counting the total number of cells

Celsoft Corporation

To get a count of the total number of cells in a range (empty and non-empty cells), use the following formula. This formula returns the number of cells in a range named Data. It simply multiplies the number of rows (returned by the ROWS function) by the number of columns (returned by the COLUMNS function). =ROWS(Data)*COLUMNS(Data)

Counting blank cells The following formula returns the number of blank (empty) cells in a range named Data: =COUNTBLANK(Data) The COUNTBLANK function also counts cells containing a formula that returns an empty string. For example, the formula that follows returns an empty string if the value in cell A1 is greater than 5. If the cell meets this condition, the COUNTBLANK function counts that cell. =IF(A1>5,,A1) You can use the COUNTBLANK function with an argument that consists of entire rows or columns. For example, this next formula returns the number of blank cells in column A: =COUNTBLANK(A:A) The following formula returns the number of empty cells on the entire worksheet named Sheet1. You must enter this formula on a sheet other than Sheet1, or it will create a circular reference. =COUNTBLANK(Sheet1!1:1048576) Counting nonblank cells To count nonblank cells, use the COUNTA function. The following formula uses the COUNTA function to return the number of nonblank cells in a range named Data: =COUNTA(Data) The COUNTA function counts cells that contain values, text, or logical values (TRUE or FALSE).

72

## Financial Modelling in Excel (v2007)

Celsoft Corporation

NOTE: If a cell contains a formula that returns an empty string, that cell is included in the count returned by COUNTA, even though the cell appears to be blank.

Counting numeric cells To count only the numeric cells in a range, use the following formula (which assumes the range is named Data): =COUNT(Data) Cells that contain a date or a time are considered to be numeric cells. Cells that contain a logical value (TRUE or FALSE) arent considered to be numeric cells.

Advanced Counting Formulas Most of the basic examples presented above use functions or formulas that perform conditional counting. The advanced counting formulas that we present here represent more complex examples for counting worksheet cells, based on various types of criteria. Counting cells by using the COUNTIF function Excels COUNTIF function is useful for single-criterion counting formulas. The COUNTIF function takes two arguments:

range : The range that contains the values that determine whether to include a particular
cell in the count

criteria : The logical criteria that determine whether to include a particular cell in the
count Examples of Formulas Using the COUNTIF Function

## =COUNTIF(Data,12) =COUNTIF(Data,<0) =COUNTIF(Data,<>0) =COUNTIF(Data,>5) =COUNTIF(Data,A1) =COUNTIF(Data,>&A1)

Returns the number of cells containing the value 12 Returns the number of cells containing a negative value Returns the number of cells not equal to 0 Returns the number of cells greater than 5 Returns the number of cells equal to the contents of cell A1 Returns the number of cells greater than the value in

73

Financial Modelling in Excel (v2007) cell A1 =COUNTIF(Data,*) =COUNTIF(Data,???) =COUNTIF(Data,budget) =COUNTIF(Data,*budget*) =COUNTIF(Data,A*) =COUNTIF(Data,TODAY()) =COUNTIF(Data,>&AVERAGE(Data)) =COUNTIF(Data,3)+COUNTIF(Data,-3) =COUNTIF(Data,TRUE) =COUNTIF(Data,#N/A)

Celsoft Corporation

Returns the number of cells containing text Returns the number of text cells containing exactly three characters Returns the number of cells containing the single word budget (not case sensitive) Returns the number of cells containing the text budget anywhere within the text Returns the number of cells containing text that begins with the letter A (not case sensitive): Returns the number of cells containing the current date Returns the number of cells with a value greater than the average Returns the number of cells containing the value 3 or 3 Returns the number of cells containing logical TRUE Returns the number of cells containing the #N/A error value

Counting cells by using multiple criteria In many cases, your counting formula will need to count cells only if two or more criteria are met. For example, you may want to count cells that contain a value greater than 100 and less than or equal to 200. For this example, the new COUNTIFS function will do the job: =COUNTIFS(Amount,>100,Amount,<=200) The first member of the pair is the range to be counted (in this case, the range named Amount); the second member of the pair is the criterion. Counting the most frequently occurring entry The MODE function returns the most frequently occurring value in a range. =MODE(Data)

74

Financial Modelling in Excel (v2007) The MODE function returns the most frequently occurring value in a range.

Celsoft Corporation

To count the number of times the most frequently occurring value appears in the range (in other words, the frequency of the mode), use the following formula: =COUNTIF(Data,MODE(Data))

Summing Formulas The examples in this section demonstrate how to perform common summing tasks by using formulas. The formulas range from very simple to relatively complex array formulas that compute sums by using multiple criteria. Summing all cells in a range It doesnt get much simpler than this. The following formula returns the sum of all values in a range named Data: =SUM(Data) The SUM function can take up to 255 arguments. The following formula, for example, returns the sum of the values in five noncontiguous ranges: =SUM(A1:A9,C1:C9,E1:E9,G1:G9,I1:I9) You can use complete rows or columns as an argument for the SUM function. The formula that follows, for example, returns the sum of all values in column A.

75

## Financial Modelling in Excel (v2007) =SUM(A:A) Computing a cumulative sum

Celsoft Corporation

You may want to display a cumulative sum of values in a rangesometimes known as a running total. =SUM(B\$2:B2) Conditional Sums Using a Single Criterion Often, you need to calculate a conditional sum. With a conditional sum, values in a range that meet one or more conditions are included in the sum. This section presents examples of conditional summing by using a single criterion. The SUMIF function is very useful for single-criterion sum formulas. The SUMIF function takes three arguments:

Range : The range containing the values that determine whether to include a particular
cell in the sum.

Criteria : An expression that determines whether to include a particular cell in the sum. sum _range : Optional. The range that contains the cells you want to sum. If you omit
this argument, the function uses the range specified in the first argument.

Summing only negative values The following formula returns the sum of the negative values in column F. In other words, it returns the total number of past-due days for all invoices. For this worksheet, the formula returns 63. =SUMIF(Difference,<0) Because you omit the third argument, the second argument (<0) applies to the values in the

Difference range.
You dont need to hard-code the arguments for the SUMIF function into your formula. For example, you can create a formula, such as the following, which gets the criteria argument from the contents of cell G2: =SUMIF(Difference,G2) This formula returns a new result if you change the criteria in cell G2.

76

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Summing values based on a different range The following formula returns the sum of the past-due invoice amounts (in column C): =SUMIF(Difference,<0,Amount) This formula uses the values in the Difference range to determine if the corresponding values in the

## Amount range contribute to the sum.

Summing values based on a text comparison The following formula returns the total invoice amounts for the Oregon office: =SUMIF(Office,=Oregon,Amount) Conditional Sums Using Multiple Criteria The examples in the preceding section all used a single comparison criterion. The examples in this section involve summing cells based on multiple criteria. =SUMIFS(Amount,Difference,<0,Office,Oregon)

Text Functions
Text Functions Excel has an excellent assortment of worksheet functions that can handle text. You can access these functions just where youd expect: from the Text control in the Function Library group of the Formula tab. Determining whether a cell contains text In some situations, you may need a formula that determines the type of data contained in a particular cell. For example, you may use an IF function to return a result only if a cell contains text. The easiest way to make this determination is to use the ISTEXT function.

77

## Financial Modelling in Excel (v2007)

Celsoft Corporation

The ISTEXT function takes a single argument and returns TRUE if the argument contains text and FALSE if it doesnt contain text. The formula that follows returns TRUE if A1 contains a string: =ISTEXT(A1) Joining two or more cells Excel uses an ampersand (&) as its concatenation operator. Concatenation is simply a fancy term that describes what happens when you join the contents of two or more cells. For example, if cell A1 contains the text Tucson and cell A2 contains the text Arizona, the following formula will return TucsonArizona: =A1&A2 NOTE: Excel also has a CONCATENATE function, which takes up to 255 arguments. For example: =CONCATENATE(A1,B1,C1,D1) Changing the case of text Excel provides three handy functions to change the case of text: UPPER converts the text to ALL UPPERCASE. LOWER converts the text to all lowercase. PROPER converts the text to Proper Case (the first letter in each word is capitalized, as in a proper name). These functions are quite straightforward. The formula that follows, for example, converts the text in cell A1 to proper case. =PROPER(A1)

## Time and Date Functions

Date-Related Functions Excel has quite a few functions that work with dates. These functions are accessible by choosing Formulas Function Library Date & Time.

78

Financial Modelling in Excel (v2007) The Table below summarizes the date-related functions available in Excel. Selected Date-Related Functions Function MONTH NETWORKDAYS* NOW TODAY WEEKNUM* YEAR Description Converts a serial number to a month Returns the number of whole work days between two dates Returns the serial number of the current date and time Returns the serial number of todays date Returns the week number in the year Converts a serial number to a year

Celsoft Corporation

Displaying the current date The following function displays the current date in a cell: =TODAY() You can also display the date combined with text. The formula that follows, for example, displays text, such as =Today is &TEXT(TODAY(),dddd, mmmm d, yyyy) Its important to understand that the TODAY function is updated whenever the worksheet is calculated. For example, if you enter either of the preceding formulas into a worksheet, the formulas display the current date. But when you open the workbook tomorrow, they will display the current date (not the date when you entered the formula). Calculating the number of days between two dates A common type of date calculation determines the number of days between two dates. For example, you may have a financial worksheet that calculates interest earned on a deposit account. The interest earned depends on the number of days the account is open. If your sheet contains the open date and the close date for the account, you can calculate the number of days the account was open. =EndDay-StartDay+1 Calculating the number of work days between two dates

79

## Financial Modelling in Excel (v2007)

Celsoft Corporation

When calculating the difference between two dates, you may want to exclude weekends and holidays. For example, you may need to know how many business days fall in the month of November. This calculation should exclude Saturdays, Sundays, and holidays. The NETWORKDAYS function can help out. NEW FEATURE: In versions prior to Excel 2007, the NETWORKDAYS function was available only when the Analysis ToolPak add-in was installed. The function is now part of Excel 2007. The NETWORKDAYS function calculates the difference between two dates, excluding weekend days (Saturdays and Sundays). As an option, you can specify a range of cells that contain the dates of holidays, which are also excluded. Excel has absolutely no way of determining which days are holidays, so you must provide this information in a range. Figure 13.4 shows a worksheet that calculates the work days between two dates. The range A2:A11 contains a list of holiday dates. The two formulas in column C calculate the work days between the dates in column A and column B. For example, the formula in cell C15 is =NETWORKDAYS(A15,B15,A2:A11) This formula returns 4, which means that the seven-day period beginning with January 1 contains four work days. In other words, the calculation excludes one holiday, one Saturday, and one Sunday. The formula in cell C16 calculates the total number of work days in the year. Calculating the number of years between two dates The following formula calculates the number of years between two dates. This formula assumes that cells A1 and B1 both contain dates: =YEAR(A1)-YEAR(B1) This formula uses the YEAR function to extract the year from each date and then subtracts one year from the other. If cell B1 contains a more recent date than the date in cell A1, the result will be negative. 13 Displaying the current time This formula displays the current time as a time serial number (or as a serial number without an associated date):

80

## Financial Modelling in Excel (v2007) =NOW()-TODAY()

Celsoft Corporation

You need to format the cell with a time format to view the result as a recognizable time. The quickest way is to choose Home Number Format Number and select Time from the drop-down list.

## ANALYSING DATA Pivot Tables

A pivot table is essentially a dynamic summary report generated from a database. The database can reside in a worksheet (in the form of a table) or in an external data file or into a meaningful presentation of the data. For example, a pivot table can create frequency distributions and crosstabulations of several different data dimensions. In addition, you can display subtotals and any level of detail that you want. Perhaps the most innovative aspect of a pivot table is its interactivity. After you create a pivot table, you can rearrange the information in almost any way imaginable and even insert special formulas that perform new calculations. You even can create post hoc groupings of summary items (for example, combine Northern Region totals with Western Region totals). And the icing on the cake: With a few mouse clicks, you can apply formatting to a pivot table to convert it into an attractive report. One minor drawback to using a pivot table is that, unlike a formula-based summary report, a pivot table does not update automatically when you change information in the source data. This drawback doesnt pose a serious problem, however, because a single click of the Refresh button forces a pivot table to update itself with the latest data. A pivot table example The best way to understand the concept of a pivot table is to see one. Start with the table below which shows a portion of the data used in creating the pivot table in this chapter.

81

## Financial Modelling in Excel (v2007) FIG

Celsoft Corporation

This table is used to create a pivot table. This table consists of a months worth of new account information for a three-branch bank. The table contains 712 rows, and each row represents a new account. The table has the following columns: Analyzing Data with Excel The bank accounts database contains quite a bit of information. But in its current form, the data doesnt reveal much. To make the data more useful, you need to summarize it. Summarizing a database is essentially the process of answering questions about the data. Following are a few questions that may be of interest to the banks management: What is the daily total new deposit amount for each branch? How many accounts were opened at each branch, broken down by account type? Whats the dollar distribution of the different account types? What types of accounts do tellers open most often? How does the Central branch compare to the other two branches? In which branch do tellers open the most checking accounts for new customers?

You can, of course, spend time sorting the data and creating formulas to answer these questions. Often, however, a pivot table is a much better choice. Creating a pivot table takes only a few seconds, doesnt require a single formula, and produces a nice-looking report. In addition, pivot tables are much less prone to error than creating formulas.

82

## Financial Modelling in Excel (v2007)

Celsoft Corporation

The picture below shows a pivot table created from the bank data. This pivot table shows the amount of new deposits, broken down by branch and account type. This particular summary represents one of dozens of summaries that you can produce from this data.

FIGURE 34.2 A simple pivot table. The picture below shows another pivot table generated from the bank data. This pivot table uses a drop-down Report Filter for the Customer item (in row 1). In the figure, the pivot table displays the data only for Existing customers. (The user can also select New or All from the drop-down control.) Notice the change in the orientation of the table? For this pivot table, branches appear as column labels, and account types appear as row labels. This change, which took about five seconds to make, is another example of the flexibility of a pivot table.

83

Financial Modelling in Excel (v2007) E 34.3 A pivot table that uses a report filter. Data appropriate for a pivot table

Celsoft Corporation

A pivot table requires that your data is in the form of a rectangular database. You can store the database in either a worksheet range (which can be a table or just a normal range) or an external database file. Although Excel can generate a pivot table from any database, not all databases benefit. Generally speaking, fields in a database table consist of two types: Data: Contains a value or data to be summarized. For the bank account example, the Amount field is a data field. Category: Describes the data. For the bank account data, the Date, AcctType, OpenedBy, Branch, and Customer fields are category fields because they describe the data in the Amount field. A single database table can have any number of data fields and category fields. When you create a pivot table, you usually want to summarize one or more of the data fields. Conversely, the values in the category fields appear in the pivot table as rows, columns, or filters.

Creating a Pivot Table Creating a pivot table is an interactive process. Its not at all uncommon to experiment with various layouts until you find one that youre satisfied with. If your data is in a worksheet range, select any cell in that range and then choose Insert Tables PivotTable, which displays the dialog box shown below

84

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Excel attempts to guess the range, based on the location of the active cell. If youre creating a pivot table from an external data source, you need to select that option and then click Choose Connection to specify the data source. 34.5 In the Create PivotTable dialog box, you tell Excel where the data is and where you want the pivot table. Use the bottom section of the Create PivotTable dialog box to indicate the location for your pivot table. The default location is on a new worksheet, but you can specify any range on any worksheet, including the worksheet that contains the data. Click OK, and Excel creates an empty pivot table and displays its PivotTable Field List, as shown below

85

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Laying out the pivot table Next, set up the actual layout of the pivot table. You can do so by using either of these techniques: Drag the field names to one of the four boxes in the PivotTable Field List. Right-click a field name and choose its location from the shortcut menu.

1. Drag the Amount field into the Values area. At this point, the pivot table displays the total of all the values in the Amount column. 2. Drag the AcctType field into the Row Labels area. Now the pivot table shows the total amount for each of the account types. 3. Drag the Branch field into the Column Labels area. The pivot table shows the amount for each account type, cross-tabulated by branch. FIGURE 34.7 Formatting the pivot table Notice that the pivot table uses General number formatting. To change the number format used, select any value and choose PivotTable Tools Options Active Field Field Settings to display the Data Field Settings dialog box. Click the Number Format button and change the number format. You can apply any of several built-in styles to a pivot table. Select any cell in the pivot table and choose PivotTable Tools Design PivotTable Styles to select a style. FIGURE 34.14 Creating Pivot Charts A pivot chart is a graphical representation of a data summary displayed in a pivot table. A pivot chart is always based on a pivot table. Although Excel lets you create a pivot table and a pivot chart at the same time, you cant create a pivot chart without a pivot table. Choose Insert Tables Pivot Table Pivot Chart. Excel creates a pivot table and a pivot chart.

## PERFORMING WHAT-IF ANALYSIS

FIGURE 36.1 Types of What-If Analyses Not surprisingly, Excel can handle much more sophisticated models than the preceding example. To perform a what-if analysis using Excel, you have three basic options: Manual what-if analysis: Plug in new values and observe the effects on formula cells.

86

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Data tables: Create a table that displays the results of selected formula cells as you systematically change one or two input cells. Scenario Manager: Create named scenarios and generate reports that use outlines or pivot tables.

## Manual What-If Analysis

This method doesnt require too much explanation. In fact, the example that opens this chapter demonstrates how its done. Manual what-if analysis is based on the idea that you have one or more input cells that affect one or more key formula cells. You change the value in the input cells and see what happens to the formula cells. You may want to print the results or save each scenario to a new workbook. The term scenario refers to a specific set of values in one or more input cells. Manual what-if analysis is very common, and people often use this technique without even realizing that theyre doing a type of what-if analysis. This method of performing what-if analysis certainly has nothing wrong with it, but you should be aware of some other techniques.

Data Tables
This section discusses one of Excels most underutilized features: data tables. A data table is a dynamic range that summarizes formula cells for varying input cells. You can create a data table fairly easily, but data tables have some limitations. In particular, a data table can deal with only one or two input cells at a time. This limitation becomes clear as you view the examples. Creating a one-input data table A one-input data table displays the results of one or more formulas for various values of a single input cell.

FIGURE 36.2

87

Financial Modelling in Excel (v2007) How a one-input data table is set up.

Celsoft Corporation

You can place the data table anywhere in a worksheet. The left column contains various values for the single input cell. The top row contains references to formulas located elsewhere in the worksheet. You can use a single formula reference or any number of formula references. The upper-left cell of the table remains empty. Excel calculates the values that result from each value of the input cell and places them under each formula reference. This example uses the mortgage loan worksheet from earlier in the chapter (see A What-If Example). The goal of this exercise is to create a data table that shows the values of the four formula cells (loan amount, monthly payment, total payments, and total interest) for various interest rates ranging from 6 to 8 percent, in 0.25-percent increments. (The file is named mortgage loan data table.xlsx.)

The screen above shows the setup for the data table area. Row 3 consists of references to the formulas in the worksheet. For example, cell F3 contains the formula =C10, and cell G3 contains the formula =C11. Column E contains the values of the single input cell (interest rate) that Excel will use in the table. To create the table, select the data table range (in this case, E3:I12) and then choose Data Data Tools

What-If Analysis Data Table. Excel displays the Data Table dialog box, shown below.

88

## Financial Modelling in Excel (v2007)

Celsoft Corporation

FIGURE 36.4 In the Data Table dialog box, you must specify the worksheet cell that contains the input value. Because variables for the input cell appear in the left column in the data table, you place this cell reference in the text box labeled Column Input Cell. Enter C7 or point to the cell in the worksheet. Leave the Row Input Cell field blank. Click OK, and Excel fills in the table with the calculated results (see below).

The result of the one-input data table. Creating a two-input data table As the name implies, a two-input data table lets you vary two input cells. You can see the setup for this type of table below.

89

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Although it looks similar to a one-input table, the two-input table has one critical difference: It can show the results of only one formula at a time. With a one-input table, you can place any number of formulas, or references to formulas, across the top row of the table. In a two-input table, this top row holds the values for the second input cell. The upper-left cell of the table contains a reference to the single result formula.

FIGURE 36.6URE 36.7 To create the data table: 1. Enter the response rate values in F4:M4. 2. Enter the number mailed values in E5:E14. 3. Select the range E4:M14 and choose Data Data Tools What-If Analysis Data Table. 4. In the Data Table dialog box, specify B5 as the Row input cell (the response rate) and cell B4 as the Column input (the number mailed). 5. Click OK, and Excel fills in the data table.

## Using Scenario Manager

Data tables are useful, but they have a few limitations: You can vary only one or two input cells at a time. The process of setting up a data table is not all that intuitive.

90

## Financial Modelling in Excel (v2007)

Celsoft Corporation

A two-input table shows the results of only one formula cell (although you can create additional tables for more formulas). In many situations, youre interested in a few select combinations, not an entire table that shows all possible combinations of two input cells.

Excels Scenario Manager Feature makes automating your what-if models easy. You can store different sets of input values (called changing cells in the terminology of Scenario Manager) for any number of variables and give a name to each set. You can then select a set of values by name, and Excel displays the worksheet by using those values. You can also generate a summary report that shows the effect of various combinations of values on any number of result cells. These summary reports can be an outline or a pivot table. For example, your annual sales forecast may depend on several factors. Consequently, you can define three scenarios: best case, worst case, and most likely case. You then can switch to any of these scenarios by selecting the named scenario from a list. Excel substitutes the appropriate input values in your worksheet and recalculates the formulas.

Defining scenarios To introduce you to Scenario Manager, this section starts with an example that uses a simplified production model, as shown below.

This workbook, named production model.xlsx, This worksheet contains two input cells: the hourly labor cost (cell B2) and the unit cost for materials (cell B3). The company produces three products, and each product requires a different number of hours and a different amount of materials to produce.36

91

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Formulas calculate the total profit per product (row 13) and the total combined profit (cell B15). Management is trying to predict the total profit, but is uncertain what the hourly labor cost and material costs will be. Theyve identified three scenarios, listed in Table 36.1.

TABLE 36.1 Scenario Best Case Worst Case Most Likely Hourly Cost 30 38 34 Materials Cost 57 62 59

The Best Case scenario has the lowest hourly cost and lowest materials cost. The Worst Case scenario has high values for both the hourly cost and the materials cost. The third scenario, Most Likely Case, has intermediate values for both of these input cells. The managers need to be prepared for the worst case, however, and theyre interested in what would happen under the Best Case scenario. Choose Data Data Tools What-If Analysis Scenario Manger to display the Scenario Manager Dialog box. When you first open this dialog box, it tells you that no scenarios are definedwhich is not too surprising because youre just starting. As you add named scenarios, they appear in the Scenarios list in this dialog box. To add a scenario, click the Add button in the Scenario Manager Dialog box. Excel displays its Add Scenario dialog box, shown below.

This dialog box consists of four parts: Scenario Name: The name for the scenario. You can give it any name that you like preferably something meaningful.

92

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Changing Cells: The input cells for the scenario. You can enter the cell addresses directly or point to them. If youve created a name for the cells, type the name. Non-adjacent cells are allowed (if pointing to multiple cells, press Ctrl while you click the cells). Each named scenario can use the same set of changing cells or different changing cells. The number of changing cells for a scenario is limited to 32.

Comment: By default, Excel displays the name of the person who created the scenario and the date that it was created. You can change this text, add new text to it, or delete it. Protection: The two Protection options (preventing changes and hiding a scenario) are in effect only when you protect the worksheet and choose the Scenario option in the Protect Sheet dialog box. Protecting a scenario prevents anyone from modifying it; a hidden scenario doesnt appear in the Scenario Manager Dialog box.

Displaying scenarios After you define all the scenarios and return to the Scenario Manager Dialog box, the dialog box displays the names of your defined scenarios. Select one of the scenarios and then click the Show button. Excel inserts the corresponding values into the changing cells and calculates the worksheet to show the results for that scenario. Modifying scenarios The Edit button in the Scenario Manager Dialog box lets you change one or more of the values for the changing cells of a scenario. From the Scenarios list, select the scenario that you want to change and click the Edit button. In the Edit Scenario dialog box, click OK to access the Scenario Values dialog box. Make your changes and click OK to return to the Scenario Manager Dialog box. Notice that Excel automatically updates the Comments box with new text that indicates when the scenario was modified. Merging scenarios In workgroup situations, you may have several people working on a spreadsheet model, and several people may have defined various scenarios. The marketing department, for example, may have its opinion of what the input cells should be, the finance department may have another opinion, and your CEO may have yet another opinion. Excel makes it easy to merge these various scenarios into a single workbook by using the Merge button in the Scenario Manager Dialog box. Clicking this button displays the Merge Scenarios dialog box.

93

## Financial Modelling in Excel (v2007)

Celsoft Corporation

Before you merge scenarios, make sure that the workbook from which youre merging is open. Then, click the Merge button in the Scenario Manager Dialog box. Excel displays its Merge Scenarios dialog box. Choose the workbook that contains the scenarios youre merging in the Book drop-down list. Then, choose the sheet that contains the scenarios you want to merge from the Sheet list box. (Notice that the dialog box displays the number of scenarios in each sheet as you scroll through the Sheet list box.) Click OK, and you return to the previous dialog box, which now displays the scenario names that you merged from the other workbook.

Using the Scenarios Drop-Down List Excel has a Scenarios control, which is a drop-down list that shows all the defined scenarios and enables you to quickly display a scenario. Oddly, this useful tool doesnt appear in the Ribbon. But, if you use Scenario Manager, you may want to add the Scenarios control to your Quick Access Toolbar (QAT), using the following procedure: 1. Right-click your QAT and choose Customize Quick Access Toolbar. Excel displays the Customization tab of the Excel Options dialog box. 2. In the Choose Commands From drop-down list, select Commands not In the Ribbon. 3. Scroll down the list and select Scenario. 4. Click the Add button. 5. Click OK to close the Excel Options dialog box. Using the Scenarios control is more efficient than bringing up the Scenario Manager Dialog box to view a different scenario. Generating a scenario report If youve created multiple scenarios, you may want to document your work by creating a scenario summary report. When you click the Summary button in the Scenario Manager Dialog box, Excel displays the Scenario Summary dialog box. You have a choice of report types: Scenario Summary: The summary report appears in the form of a worksheet outline. Scenario PivotTable: The summary report appears in the form of a pivot table.

94

## Financial Modelling in Excel (v2007)

Celsoft Corporation

The Scenario Summary dialog box also asks you to specify the result cells (the cells that contain the formulas in which youre interested). For this example, select B13:D13 and B15 (a multiple selection) to make the report show the profit for each product, plus the total profit.

Goal Seeking
Goal Seeking: Determines the value that you need to enter in a single input cell to produce a result that you want in a dependent (formula) cell. Solver: Determines the values that you need to enter in multiple input cells to produce a result that you want. Moreover, because you can specify certain constraints to the problem, you gain significant problem-solving ability.

## Single-Cell Goal Seeking

Single-cell goal seeking is a rather simple concept. Excel determines what value in an input cell produces a desired result in a formula cell. The following example shows you how single-cell goal seeking works. A goal-seeking example

The diagram above shows the mortgage loan worksheet used in the preceding chapter. This worksheet has four input cells (C4:C7) and four formula cells (C10:C13). Originally, this worksheet was used for a what-if analysis example. This example demonstrates the opposite

95

## Financial Modelling in Excel (v2007)

Celsoft Corporation

approach. Rather than supply different input cell values to look at the calculated formulas, this example lets Excel determine one of the input values that will produce the desired result. FIGURE 37.1 This worksheet is a good demonstration of goal seeking. Assume that youre in the market for a new home and you know that you can afford a \$1,800 monthly mortgage payment. You also know that a lender can issue a 30-year fixed-rate mortgage loan for 6.50 percent, based on an 80-percent loan-to-value (that is, a 20-percent down

payment). The question is What is the maximum purchase price I can handle? In other words,
what value in cell C4 causes the formula in cell C11 to result in \$1,800? In this simple example, you could plug values into cell C4 until C11 displays \$1,800. With more complex models, Excel can usually determine the answer much more efficiently. To answer the question posed in the preceding paragraph, first set up the input cells to match what you already know. Specifically: Enter 20% in cell C5 (the down payment percent) Enter 360 in cell C6 (the loan term, in months) Enter 6.5% in cell C7, the annual interest rate Next, choose Data Data Tools What-If Analysis Goal Seek. Excel displays the Goal Seek dialog box, shown below. Completing this dialog box is similar to forming a sentence.

You want to set cell C11 to 1800 by changing cell C4. Enter this information in the dialog box either by typing the cell references or by pointing with the mouse. Click OK to begin the goalseeking process.

FIGURE 3

96

## Financial Modelling in Excel (v2007)

Celsoft Corporation

In less than a second, Excel displays the Goal Seek Status box, which shows the target value and the value that Excel calculated. In this case, Excel found an exact value. The worksheet now displays the found value in cell C4 (\$284,779). As a result of this value, the monthly payment amount is \$1,800. At this point, you have two options: Click OK to replace the original value with the found value. Click Cancel to restore your worksheet to the form that it had before you chose the Goal Seek command.

Introducing Solver
The Excel Goal-Seek feature is a useful tool, but it clearly has limitations. It can solve for only one adjustable cell, and it returns only a single solution. Excels powerful Solver tool extends this concept by enabling you to do the following: Specify multiple adjustable cells Specify constraints on the values that the adjustable cells can have Generate a solution that maximizes or minimizes a particular worksheet cell Generate multiple solutions to a problem

Although goal seeking is a relatively simple operation, using Solver can be much more complicated. In fact, Solver is probably one of the most difficult (and potentially frustrating) features in Excel. Im the first to admit that Solver isnt for everyone. In fact, most Excel users have no use for this feature. However, many users find that having this much power is worth spending the extra time to learn about it.

Appropriate problems for Solver Problems that is appropriate for Solver fall into a relatively narrow range. They typically involve situations that meet the following criteria: A target cell depends on other cells and formulas. Typically, you want to maximize or minimize this target cell or set it equal to some value. The target cell depends on a group of cells (called changing cells) that Solver can adjust to affect the target cell. The solution must adhere to certain limitations, or constraints.

97

## Financial Modelling in Excel (v2007)

Celsoft Corporation

After you set up your worksheet appropriately, you can use Solver to adjust the changing cells and produce the result that you want in your target celland simultaneously meet all the constraints that youve defined. You access Solver by choosing Data Analysis Solver. If this command isnt available, you need to install the Solver add-in. Its a simple process: 1. Choose File Excel Options. 2. In the Excel Options dialog box, click the Add-Ins tab. 3. At the bottom of the dialog box, select Excel Add-Ins from the Manage drop-down list and click Go. Excel displays its Add-Ins dialog box. 4. In the Add-Ins dialog box, place a check mark next to Solver Add-In and click OK.

A simple Solver example I start with a simple example to introduce Solver and then present some increasingly complex examples to demonstrate what this feature can do. The figure below shows a worksheet that is set up to calculate the profit for three products. Column B shows the number of units of each product, Column C shows the profit per unit for each product, and Column D contains formulas that calculate the total profit for each product by multiplying the units by the profit per unit.

Use Solver to determine the number of units to maximize the total profit. You dont need an MBA degree to realize that the greatest profit comes from Product C. Therefore, in order to maximize total profit, the logical solution is to produce only Product C. If things were really this simple, you wouldnt need tools such as Solver. As in most situations, this company has some constraints that must be met:

98

## Financial Modelling in Excel (v2007)

Celsoft Corporation

The combined production capacity is 300 total units per day. The company needs 50 units of Product A to fill an existing order. The company needs 40 units of Product B to fill an anticipated order. Because the market for Product C is relatively limited, the company doesnt want to produce more than 40 units of this product.

These four constraints make the problem more realistic and a bit more challenging. In fact, its a perfect problem for Solver. I go into more detail in a moment, but here is the basic procedure for using Solver: 1. Set up the worksheet with values and formulas. Make sure that you format cells logically; for example, if you cant produce partial units of your products, format those cells to contain numbers with no decimal values. 2. Choose Data Analysis Solver to bring up the Solver dialog box. 3. Specify the target cell. 4. Specify the range that contains the changing cells. 5. Specify the constraints. 6. Change the Solver options, if necessary. 7. Let Solver solve the problem. To start Solver to tackle this example, choose Data Analysis Solver. Excel displays its Solver Parameters dialog box, shown below.

The Solver Parameters dialog box. In this example, the target cell is D6the cell that calculates the total profit for three products.

99

## Financial Modelling in Excel (v2007)

Celsoft Corporation

1. Enter (or point to) cell D6 in the Set Target Cell field of the Solver Parameters dialog box. 2. Because the objective is to maximize this cell, click the Max option. 3. Next, specify the changing cells (which are in the range B3:B5) in the By Changing Cells box. The next step is to specify the constraints on the problem. The constraints are added one at a time and appear in the box labeled Subject To the Constraints. 4. To add a constraint, click the Add button. Excel displays the Add Constraint dialog box, shown below.

This dialog box has three parts: a Cell Reference, an operator, and a Constraint value. 5. To set the first constraint (that the total production capacity is 300 units), enter B6 as the Cell Reference, choose equal (=) from the drop-down list of operators, and enter 300 as the Constraint value. 6. Click Add to add the remaining constraints. The diagram below summarizes the constraints for this problem.

FIGURE 37ABLE 37.1 Constraints Summary Constraint Capacity is 300 units At least 50 units of Product At least 40 units of Product B No more than 40 units of Product C Expressed As B6=300 A B3>=50 B4>=40 B5<=40

7. After you enter the last constraint, click OK to return to the Solver Parameters dialog box, which now lists the four constraints. At this point, Solver knows everything about the problem.

100

## Financial Modelling in Excel (v2007)

Celsoft Corporation

8. Click the Solve button to start the solution process. You can watch the progress onscreen, and Excel soon announces that it has found a solution. The Solver Results dialog box is shown below

At this point, you have the following options: Replace the original changing cell values with the values that Solver found. Restore the original changing cell values. Create any or all three reports that describe what Solver did. Click the Save Scenario button to save the solution as a scenario, so that Scenario Manager can use it. If you specify any report options, Excel creates each report on a new worksheet, with an appropriate name. The figure below shows an Answer Report. In the Constraints section of the report, two of the constraints are binding, which means that these constraints were satisfied at their limit with no more room to change.

101

## Financial Modelling in Excel (v2007)

Celsoft Corporation

ANALYSIS TOOLPAK
The Analysis ToolPak is an add-in that provides analytical capability that normally isnt available. In previous versions of Excel, the Analysis ToolPak add-in included many additional worksheet functions. In Excel 2007, these worksheet functions are built into Excel and no longer require the Analysis ToolPak add-in. These analysis tools offer many features that may be useful to those in the scientific, engineering, and educational communitiesnot to mention business users whose needs extend beyond the normal spreadsheet fare. The Analysis ToolPak covers each of the following tools: Analysis of variance (three types) Correlation Covariance Descriptive statistics Exponential smoothing F-Test Fourier analysis

102

## Financial Modelling in Excel (v2007) Histogram

Celsoft Corporation

RECORDING A MACRO
A macro is a recorded (or typed) sequence of commands that can be used repeatedly.

Any macro given the name Auto_Open will run the moment the workbook containing the macro is opened
Macros can greatly speed up your work and increase accuracy by having long sequences of commands rerun at the press of a button. Macros can be written in Excel 4 macro language or in Visual Basic, and are stored: In the case of macros written in Excel 4 language, on a Macro sheet. A macro sheet can be set up by right-clicking the mouse whilst pointing at a sheet tab. In the case of macros written in Visual Basic, macros are placed on a Visual Basic sheet, but this sheet does not appear as a sheet in the workbook. To see this sheet hit Alt F11.

## Note: Ex cel m acros can only be recorded in Visual Basic

Macros once written, can be attached to: A button drawn on a worksheet Any picture or object on the worksheet In an icon on the toolbar.

Before recording macros it will be convenient to get the Developer tab displayed on the ribbon. Do this by: 1. Click on the Office tool 2. Select Excel Options shown at the bottom of the dialogue box 3. Select Popular 4. Click the checkbox for Show Developer tab in the Ribbon Alternatively command path (Developer/ Record Macro) Excel 2003 ( Tools/Macros)

103

## Financial Modelling in Excel (v2007)

Celsoft Corporation

The easiest way to create a macro is to record it whilst you are actually performing the desired task.

Recording a Macro: To record a macro all you have to do is turn on the macro recorder and then perform the commands as usual. While you are doing this Excel writes the commands step by step onto a visual basic module sheet (not visible as a sheet in your workbook)

Steps in recording a macro: 1. Choose Developer/Code/Record Macro OR View/Macros/Record Macro (2003 Tools/Macro/Record a new macro) The following dialogue box appears:

2. Replace the name Macro1 with a name of your choice, and type a single letter to use as a shortcut key in the Shortcut Key box. Pressing Ctrl and this shortcut letter will cause the macro to run once complete. Avoid shortcut letters that are already used by Excel (such as ctrl c for Copy) 3. Decide where you would like to store this macro. (Normally in this workbook, but if stored in a Personal Macro Workbook, it will be available for all spreadsheet files)

104

## Financial Modelling in Excel (v2007)

Celsoft Corporation

4. Click OK. A Stop button appears, and the word Recording appears at the bottom of the screen. 5. Carry out the commands you wish to record 6. When you have finished choose Developer/Code/Stop Recording 7. To view your macro hit Alt F8 (or Developer/Code/Macros), and click the Edit button. 8. The macro now shown can be edited if desired. Two ways of running a macro: 1. Choose Developer/Code/Macros and click the Run button or 2 Hit the Ctrl key and the shortcut letter you assigned to the macro

105