Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

Teaching Week One

Introduction to financial modelling


& Excel Techniques 1
Reference:
• Simon Benninga, Financial Modeling 4th edition
• Chandan Sengupta, Financial Analysis and Modeling 2nd
edition
Lecture Agenda

1. Steps in creating a financial model


2. Introduction to Excel
3. Learning Excel functions
 Financial functions
 Date-related functions
 Logical functions
 Table lookup functions
Steps in creating a financial model
1. Define and structure the problem
 What is the problem you are trying to solve?
 What questions the model is supposed to answer?
2. Define the input and output variables of the model
 The source of inputs
 Outputs a model needs to create
3. Who are the users?
 Who will use the model and how often it will be used?
 Developing a model for others will involve more works
4. Understand the financial and mathematical aspects of the model
 Computer cannot do any thinking!
 The program needs to complete the calculations required in order to generate
outputs
Steps in creating a financial model
4. Design the model
 Start with a simple model
 Excel or VBA? Or both?
 Is user interface required?
5. Create the spreadsheets or write the VBA codes
 This is what we are going to learn in this course
 We will see many examples shortly
6. Test the model
 Almost no model works correctly the first time it is used
 Refine the model and DEBUG
 It takes time and experience to build a good model
Steps in creating a financial model
7. Protect the model
 Protect the model against accidental or unauthorized changes
8. Document the model
 Information about what the program does, how it is structured, what
assumptions are build into the model.
 Others can efficiently and effectively change the model is necessary.
9. Update the model as necessary
 Changes in inputs, calculations and output required
 Check the documentation in the program
Excel formulas

 A formula in Excel is simply a statement made up of


‘operands’ and ‘operators’.

 In the example, there are two ‘operands’, values in A3 and


B3.

 The operators are addition (+), subtraction (-),


multiplication (*), division (/), and exponents (^).
Excel cell references: Relative vs
absolute
 In Excel, a cell reference is a relative reference by default. This means that the
reference is a relative to the location of the cell.
 For example, when you refer to cell A2 from cell C2, you are referring to a cell
that is two columns to the left in the same row. When you copy a formula that
contains a relative cell reference, that reference in the formula will change
accordingly.
 Make a cell reference absolute by preceding the columns and row with a dollar
sign ($).
 When copy the formula with absolute cell reference, that reference in the
formula will stay the same
Excel functions – Types

 Excel built-in functions


 These are the functions that reside in the main Excel application
 Such as SUM(), AVERAGE() etc.
 Functions from ‘add-in’ packages such as the ‘Analysis Toolpak’
 These functions come from add-in packages and are only available in Excel when
the particular add-in is installed
 Most commonly used add-in package in Excel is the Analysis Toolpak
 VBA functions
 These are the functions that reside in VBA and can only be used in VBA codes
 VBA user-defined functions
 These are the functions that are written in VBA but can be used in Excel.
Excel functions – Function procedures

 In Excel, the function procedure performs a task and then returns control to
the calling code; When it returns control, it also returns a value to the calling
code
 A function procedure can take arguments, such as a constants, variables, or
expressions, which are passed to it by the calling code.
 For example: PV(rate, nper, pmt, fv, type)
 rate, nper, pmt, fv and type are the function’s ‘parameters’ or ‘arguments’
 The function (i.e., in this example, PV()) receives the ‘passed’ values and then
perform the task
Excel functions – Function procedures

 Most of the functions in Excel require some inputs (arguments) in order to


calculate correctly
 For example, to use SUM function, you need to give a series of numbers to add up
 SUM(number1, number2,…)
 Any inputs you give to a function is called an argument
 Some functions don’t require any arguments
 For example, NOW() function return us the current date and time
 Some functions have both required and optional arguments
 For example, PMT(rate, Nper, PV, FV, Type)
 We need to understand which arguments are required for a given function
Excel functions – Function procedures
 Type in any cell a function, click the “fx” beside the formula bar, the function
arguments window will pop up. This tells you the arguments needed for the
function. Arguments in bold are compulsory, whereas the rest are optional.
Excel functions

 Financial functions
 Date functions
 Statistical functions
 Conditional functions
 Regression functions
 Logical functions
 Matrices and Array functions
 Other functions
Financial functions – PV function

 PV(rate, nper, pmt, [fv], [type]) function calculates the


present value of an annuity that pays an amount pmt per
period for nper number of periods at an interest rate of rate
per period.
 An additional payment of [fv] can be specified after the last
annuity payment (If omitted, assumed to be zero).
 [type] represents when the payments are due. If type = 0, all
payments are assumed to be made at the end of each
period. If type = 1, payments are assumed to be made in
advance (Default is zero).
Financial functions – PV function
 Note that Excel uses the clumsy convention that amounts
lent (borrowed) are negative (positive) while their present
value is positive (negative).
 For example, a $2500 deposit to the bank would be
represented by the argument -2500 for pmt if you are the
depositor, and by the argument +2500 for pmt if you are the
bank
 Example
 PV(10%, 3, 0, -1000) = $1,000/1.13 = $751.31
 PV(10%, 3, -100) = $100/1.1 + $100/1.12 + 100/1.13 = $248.69
 PV(10%, 3, -100, 0, 1) = $100 + $100/1.1 + 100/1.12 = $273.55
Financial functions – FV function

 FV(rate, nper, pmt, [pv], [type]) function calculates


the future value of an annuity and works in a similar
fashion to the PV function, except that pv represents an
additional amount at time zero, if any.

 Example
 FV(10%, 3, 0, -1000) = $1000*1.13 = $1,331
 FV(10%, 3, -100) = $100*1.12 + $100*1.1 + 100 = $331
 FV(10%, 3, -100, 0, 1) = $100*1.13 + $100*1.12 + 100*1.1 =
$364.10
Financial functions – PMT function

 PMT(rate, nper, pv, [fv], [type]) function calculates


the annuity amount per period given the present value
of all future payments pv and other parameters as
defined in the PV() function.

 Example
 PMT(10%, 3, -248.69) = $100
 PMT(10%, 3, -273.55, 0, 1) = $100

 Exercise 1
Financial functions – NPV function

 The NPV(rate, value1, [value2], …) function calculates


the net present value of a series of future cash flows.
 value1 is the first value(s) representing cash flows
 [value2] is the second value(s) representing cash flows
(optional)
 Future cash flows are assumed to occur at equally spaced
periods while the period discount rate is given by rate.
 Each future cash flow can be entered separately or as a
range of values.
 BUT, values must be equally spaced in time, occur at the end of each
period, and must be in chronological order
Financial functions – NPV function

 The first cash flow is assumed to be 1-period away.

 Therefore, the value returned by this function is not the


same as the net present value commonly defined in
Finance which assumes that the initial investment occurs
today.
Financial functions – NPV function
A B C D E F G
1 EXCEL'S NPV FUNCTION
2 Discount rate 10%
3
Present
4 Year Cash flow value
5 0 -100.00 -100.00 <-- =B5/(1+$B$2)^A5
6 1 35.00 31.82 Computing the PV
7 2 33.00 27.27 of each of the cash
8 3 34.00 25.54 flows separately.
9 4 25.00 17.08
10 5 16.00 9.93
11
Present value Two ways of calculating the
12 of future cash 111.65 <-- =SUM(C6:C10) present value of the future
13 flows 111.65 <-- =NPV(B2,B6:B10) cash flows.
14 Net present value 11.65 <-- =B5+NPV(B2,B6:B10)
15
16 This is the correct (finance) value of the
17 NPV: Includes the initial cash flow at
18 time 0.
19
Financial functions
 Exercise 2

 Note: NPV function ignores blank cells – See Example 2B


Financial functions – IRR function
 IRR(values, [guess]) function calculates the internal rate of return
given a set of cash flows contained in values.
 An initial guess is optional and can also be supplied.
 Note:
 IRR function takes values from an array or a range .
 The first cash flow should be negative
 Be aware that it is possible to have either no IRR or more than one IRR.
 Example
 IRR({-200;100;100})= 0%
 IRR({-200;150;200}, 10%)= 44.3%
 Note: values enclosed in { } and separated by semi-colons are from an
“array” or a “range”
Financial functions – Exercise 3
Finding IRR using NPV Profile method
Financial functions – Exercise 3
Finding IRR using Data Table
Date-related functions

 Dates in Excel are stored as a date serial number


that represents the number of days since 1 Jan 1900
(unless the 1904 date system is set as default).
 01 Jan 1900 is serial number 1; 01 July 2006 is serial
number 38,899 (38,899 days after 01/01/1900); 01 Jan
2008 is serial number 39,448 (39,448 days after
01/01/1900).
 Applications in Finance often require some use of
date functions.
 Dates can be added, subtracted, and included in other
calculations
Date-related functions

 Date format – The default US format puts month ahead


of day (e.g. 1/7/2006 instead of /1/2006 to represent 7
Jan 2006). To avoid any confusion, we can use either
alphabet months or a custom cell format. Under the
‘Format cells’ menu, choose ‘Custom’ at the bottom. We
can use the following conventions:
 d/m/yy -> 1/7/2006
 dd/mm/yy -> 01/07/06
 d mmm yy -> 1 Jul 06
 dd mmmm yyyy -> 01 July 2006
 Dd mmm ‘yy -> 01 July ‘06
Date-related functions
 Excel has a whole set of time and date functions
 Now( ) – reads the computer clock and represents the date and the
time
 Today( ) – reads the computer’s clock and prints the date.
 Date(yyyy, mm, dd) gives the date entered.
 Weekday gives the day of the week
 Month gives the month of a specified date
 Weeknum gives the week of a specified date
 Day gives the day of a specified date

 Exercise 4
Date-related functions
 The EDATE(start_date, months) and EOMONTH(start_date, months)
functions can be useful in some financial applications. The
EDATE(start_date, months) function returns the same day of the month
after a specified number of months. The EOMONTH(start_date, months)
function returns the last day of any given month.
 These two functions are convenient in constructing payment schedules or
financial time series.
 Examples:
 EDATE(TODAY(),3) returns today’s day in 3 months’ time;
 EDATE(“29 Jul 06”,3) returns 29 Oct 2006;
 EDATE(“29 Jul 06”,-1) returns 29 Jun 2006;
 EOMONTH(TODAY(),0) returns the last day of the current month;
 EOMONTH((“29 Jul 06”,13) returns 31 Aug 2007;
 EOMONTH((“29 Jul 06”,-3) returns 30 Apr 2006.
Date-related functions
 The DATE(year, month, day) function provides a more general approach to
manipulate dates in Excel. It can be used in conjunction with the YEAR(),
MONTH(), and DAY() functions to develop more complex functions such as the
EDATE() and EOMONTH() functions discussed above.
 DATE(2006,7,11) returns the date serial number for 11 July 2006;
 YEAR(“11 Jul 06”) or YEAR(DATE(2006,7,11)) returns 2006;
 MONTH(“11 Jul 06”) or MONTH(DATE(2006,7,11)) returns 7;
 DAY(“11 Jul 06”) or DAY(DATE(2006,7,11)) returns 11;
 DATE(YEAR(TODAY()),MONTH(TODAY())+1, DAY(TODAY())) returns 11 Aug 2006.

 DATEDIF(start_date, end_date, unit) function computes the difference


between two dates
 Exercise 5
Logical functions
 IF(condition, [value_if_true], [value_if_false]) function allows you to put
in conditional statements. It can perform a logical test and return one value
for a TRUE result, and another for a FALSE results
 Example: IF(A1<100, 3%, 5%); IF(A2>=50, “PASS”, “FAIL”)

 IF function can be “nested”. A “nested IF” refers to a formula where at least


one IF function is nested inside another to test for more conditions and return
more possible results.
 Each IF statement needs to be carefully “nested” inside another so that the logic
flows correctly.
 Example: IF(A1<100, 3%, IF(A1<200, 5%, 7%))

 Exercise 6
Logical functions
 OR(logical1, [logical2], …) function returns either the logical value TRUE
or FALSE. If any condition inside OR( ) function is TRUE, it returns TRUE. If
all the conditions inside OR( ) function is false, it returns FALSE.
 Example:
 To test if the value in A1 OR the value in B1 is greater than 50 (=OR(A1>50,
B1>50))

 AND(logical1, [logical2], …) also returns either the logical values TRUE or


FALSE. If all the conditions inside AND( ) function is TRUE, it returns TRUE.
If any condition inside AND( ) is FALSE, it returns FALSE.
 Example:
 To test if the value in A1 is greater than 0, and less than 5 (=AND(A1>0, A1<5))
Logical functions
 OR( ) and AND( ) functions can be used to simplify the IF( ) function:
 IF(OR(A1>50, B1>50), “PASS”, “FAIL”)
 IF(AND(A1>0, A1<5), “Approved”, “Rejected”)
 Combining AND( ) with OR( ) function
 AND(A1>100, OR(B1=“complete”, B1=“pending”)) – how do you interpret this
formula?

 NOT(logical) function returns the opposite of a given logical or Boolean


value. When given TRUE, this function returns FALSE. When given FALSE,
this function returns TRUE. This function is used to reverse a logical value
 Example:
 Return the reverse when cell A1 is blank. (=NOT(ISBLANK(A1))
Logical functions
 Logical AND  Logical NOT
 False AND false = ?  Not(True) = ?
 False AND true = ?  Not(False) = ?
 True AND false = ?
 True AND true = ?

 Logical OR
 False OR false = ?
 False OR true = ?
 True OR false = ?
 True OR true = ?
Logical functions
 (1=1 AND 2=2) = ?
 (1=1 AND 1=2) = ?
 (1=1 OR 1=2) = ?
 (1=1 OR 1=2 OR 3=3 OR 4=4) = ?
 (1=1 AND 1=2 AND 3=3 AND 4=4) = ?
 (1=1 AND (2=2 OR 1=2)) = ?
 (1=1 AND ((2=2 AND 3=3) OR (1=3 OR 1=2)) = ?
 NOT(1=1 AND ((1=3 OR 1=1) AND (1=3 AND 1=2)) = ?

 Try these in EXCEL (practice writing syntax)


Logical functions
 COUNTIF(range, criteria) function counts cells in a range that meet a
single criteria (condition). This function can be used to count cells
that contain dates, numbers and text.
 Example:
 COUNTIF(A:A, “Victoria”) – counts the number of cells in column A that
contains the text “Victoria”

 COUNTIFS(range1, criteria1, [range2], [criteria2], …) functions


returns the count of cells that meet one or more criteria.
 Example:
 COUNTIFS(A:A, “Victoria”, B:B, “NSW”) – counts the records that fulfil
both criterions of “Victoria” in column A and “NSW” in column B.
Logical functions
 SUMIF(range, criteria, [sum range]) function returns the sum of cells that meet a
single condition. Criteria can be applied to dates, numbers and text.
 Example:
 SUMIF(A:A, “>100”) – sums the figures in column A if the figure is greater than 100.
 SUMIF(A:A, “Victoria”, B:B) – sums the figures in column B if their corresponding cells in
column A contain the text “Victoria”.

 SUMIFS(sum range, range1, criteria1, [range2], [criteria2], …) function sums


cells that meet one or more criteria.
 Example:
 SUMIFS(A:A, B:B, “RED”, C:C, “TX”) – sums the figures in column A if their corresponding
cells in column B contain the text “RED” and column C contains the text “TX”.

 Exercise 8
Table lookup functions
 VLOOKUP(lookup_value, table_range, return_column, [match_type])
looks up data in a table organized vertically.
 Lookup values must appear in the first column of the table passed into
VLOOKUP
 Example:
 Suppose we have a list of dates in ’A1:A200’ and the corresponding daily
closing prices of a particular stock in ‘B1:B200’, the VLOOKUP() function can
be used to extract the closing prices for some specified dates, say, in
‘C1:C10’. VLOOKUP(C1,$A$1:$B$200,2,0) returns the closing price
corresponding to the date in C1.
 Note that if an approximate match is specified (value 1 or true for match
type), the data table must be sorted in an ascending order, and the largest
value that is less than the specified lookup value is returned if an exact
match (value 0 or false for match type), is not found.
 Exercise 9 (A) and (B)
Table lookup functions
 HLOOKUP(lookup_value, table_range, return_row,
[match_type]) function works in a similar fashion for a
data table that has a horizontal orientation.
 Lookup values appear in the first row of the table
 Similar to VLOOKUP( ) function, HLOOKUP( ) supports
approximate and exact matching.
 Exercise 9(C)
Table lookup functions
 INDEX(array, row_number, column_number) returns the
value at a given position in a range or array. It extracts the
value from a specified row and column in a worksheet range
or data table.
 Example: If the data range is in $A$1:$D$100,
INDEX($A$1:$D$100, 5, 4) returns the value contained in the
Cell D5 (i.e. the cell in the 5th row and the 4th column of
the data range).
 The INDEX() function alone is not helpful since we generally
do not know the location (row and column numbers) of the
target value in the data table. However, we can use the
Excel MATCH() function in conjunction with the INDEX()
function to locate the target value.
Table lookup functions
 MATCH(lookup_array, row_ or column_range, [match_type])
returns the position of the matched ‘value’ within a ‘row or
column range’.
 If ‘match type’ is set to 0, Excel looks for an exact match.
Values in the row or column can be unsorted in this case.
 If ‘match type’ is set to 1 (default value), Excel looks for an
approximate match (next smallest). MATCH() returns the position
of the largest value in the range that is less than or equal to the
specific value. In this case, values in the comparison range must be
sorted in an ascending order.
 Exercise 10(A)
Table lookup functions
 Consider a dataset such as the one below:

Date ABC JKL XYZ


1-Aug-05 $2.5 $5.6 $9.6
1-Sep-05 $2.1 $5.7 $9.5
1-Oct-05 $2.2 $5.8 $9.4
1-Nov-05 $2.3 $5.9 $9.3

 Suppose that the dates are in a column range named ‘dates’ and the
stock codes are in a row range named ‘codes’. The prices are in a
range named ‘data’. (To assign a name to any worksheet range, simply
select the range to be named and type the name in the ‘name box’
next to the ‘formula bar’. The following formula returns the stock
price ($9.4) for XYZ on 1 Oct 2005:
=Index(data, match(date(2005,10,1),dates,0), match(“xyz”,codes,0))
 See Exercise 10(B)
Table lookup functions
 OFFSET(start_range, row_offset, column_offset, [row_size],
[col_size]) returns a range with a dimension of ‘row_size’ rows by
‘col_size’ columns.
 The returned range will start at ‘row_offset’ number of rows and
‘column_offset’ number of columns away from the start of the ‘start
range’ often known as reference cell/range.
 The ‘start_range’ can be a single cell, in which case the returned
range is also a single cell when the last two arguments in the function
are omitted.
 Note: If ‘row_size’ and ‘col_size’ are omitted, the returned range will
have the same dimension at the ‘start_range’.
Table lookup functions
 Examples:
 OFFSET(A1, 1, 2) returns the value in C2
 OFFSET(A1, 1, 2, 1, 2) returns the value in C2:D2
 OFFSET(B2, -1, -1) returns the value in A1
 OFFSET(A1:B2, 1, 1) returns the value in B2:C3
 OFFSET(A1, 1, 1, 2, 2) returns the value in B2:C3

 Note: press Ctrl + Shift + Enter to generate multiple results (in the
selected range)
Table lookup functions

 We can use the OFFSET( ) function, instead of INDEX and MATCH, to


extract share prices using the same example discussed earlier.

Date ABC JKL XYZ


1-Aug-05 $2.5 $5.6 $9.6
1-Sep-05 $2.1 $5.7 $9.5
1-Oct-05 $2.2 $5.8 $9.4
1-Nov-05 $2.3 $5.9 $9.3

 See Exercise 10(B) and (C)


Copyright statement for items made
available via MUSO
Copyright © (2019). NOT FOR RESALE. All materials produced for this
course of study are reproduced under Part VB of the Copyright Act 1968,
or with permission of the copyright owner or under terms of database
agreements. These materials are protected by copyright. Monash
students are permitted to use these materials for personal study and
research only. Use of these materials for any other purposes, including
copying or resale, without express permission of the copyright owner,
may infringe copyright. The copyright owner may take action against you
for infringement.

You might also like