CHAPTER 6
Functions for Financial Modelling

In this chapter, we will introduce the most useful functions commonly used in financial modelling. Whilst there are hundreds of functions that can be used in a model, I have attempted to list only the ones you are most likely to come across, and that you will find most useful when building models. Please don't stop here, though! There are many more wonderful Excel functions that you will find useful in your financial modelling and business analysis.

AGGREGATION FUNCTIONS

COUNTIF, SUMIF, COUNTIFS, and SUMIFS are very handy functions to know for modelling and are basic knowledge once you start learning DAX, the formula language for Power Pivot. They add or count ranges of data, and count amongst some of my favourite, most frequently used functions.

COUNTIF

COUNTIF is used to count the cells that match specified criteria. For example, let's say you have sold $6,160 worth of different products on a particular day, as shown in Figure 6.1. You can create this sheet yourself or a template can be found, along with the accompanying models to the rest of the screenshots in this book, at www.plumsolutions.com.au/book.

A spreadsheet with 2 tables. The top table has columns for product (column A), customer (column B), and sales (column C). Cell C14 is selected with a value of $6,160. The formula =SUM(C2:C13) is indicated in the formula bar.

FIGURE 6.1 Sales List

You'd like to know how many (in terms of number of products) you've sold of each product: books, CDs, and DVDs. Follow these six steps:

  1. In cell B18, use the Insert Function dialog box to find the COUNTIF function. (Simply begin typing images( and then Control+A, or hit the fx symbol next to the formula bar.)
  2. Highlight the product names in column A for the range, and the word “Book” in cell A18 for the criteria. Do not type in the word “Book”, as this is poor modelling practice. It needs to be linked to the input cell so that we can then copy down the formula.
  3. Your Insert Function dialog box should look like Figure 6.2.
    A COUNTIF Insert Function dialog box with Range set to $A$2:$A$13 and Criteria set to A18. OK and Cancel buttons are located at the bottom-right corner.

    FIGURE 6.2 COUNTIF Insert Function Dialog Box

  4. Press OK. The answer is 5. Your formula should look like images.
  5. Change your formula to use absolute referencing as follows: images and copy the formula down the range. You don't want absolute referencing on the criteria, because it needs to change its row references to CD and DVD as you copy down the formula.

    As a shortcut, highlighting A2:A13 in the formula bar and pressing F4 will set absolute references $BA$2:$A$13. Remember that each time you press F4 it will scroll through the various absolute, relative, or mixed cell referencing options.

  6. Copy the formula down, and add a total at the bottom. Your sheet should now look something like Figure 6.3.
A spreadsheet with 2 tables. The bottom table has columns for summary, count number, and sales. Cell B18 is selected with a value of 5. The formula =COUNTIF($A$2:$A$13,A18) is indicated in the formula bar.

FIGURE 6.3 Completed COUNTIF Function

SUMIF

SUMIF is similar to COUNTIF but it sums rather than counts the values of cells in a range that meet given criteria. SUMIF can be used in place of a PivotTable, and doing so is preferable as it uses less memory and (most importantly) because SUMIF formulas are live links. PivotTables do not update automatically, which can cause errors in models if not refreshed correctly. Therefore, although quicker to build, PivotTables are sometimes avoided in favour of a SUMIF function in financial modelling.

  1. Let's say that you'd like to know how much (in terms of dollar value) you've sold of each product: books, CDs, and DVDs.
  2. Select cell C18. Find the SUMIF Insert Function dialog box or start typing images(. Because there are several fields required for this function, I'd recommend you use the Insert Function dialog box, as it's easier to find your way through the function.
  3. The items you are adding together go in the Range field, the criteria you are looking for in that range go in the Criteria field, and the numbers you want to sum together go in the Sum_range field.
  4. Your Insert Function dialog box should look like Figure 6.4.
    A SUMIF Insert Function dialog box with Range set to $A$2:$A$13, Criteria set to A18, and Sum_range set to $C$2:$C$13. OK and Cancel buttons are located at the bottom-right corner.

    FIGURE 6.4 SUMIF Insert Function Dialog Box

  5. Press OK. The answer is 2,430. Your formula should be images.
  6. Add in the absolute referencing, and copy the formula down the range. Your formula should be images. You don't need absolute referencing on the criteria (A18), because it needs to change its reference as you copy down the formula.
  7. Add a total. Your sheet should now look like Figure 6.5.
A spreadsheet with 2 tables. The bottom table has columns for summary, count number, and sales. Cell C18 is selected with a value of $2,430. The formula =SUMIF($A$2:$A$13,A18,$C$2:$C$13) is indicated in the formula bar.

FIGURE 6.5 Completed SUMIF Function

We've now got a summary report at the bottom, showing us how much we have sold in terms of number and dollar value.

Be careful. If your Range and your Sum_range don't match up, your result will be wrong. For example, images will give you an incorrect result without warning! This is a very easy mistake to make, and quite common in financial modelling. You can see in Figure 6.6 that the totals are not the same, because the SUMIF function is picking up the incorrect range. This is the same for COUNTIF functions, but it is not a problem with the SUMIFS, as the formula will return an error and therefore you will notice the error straight away, unlike the SUMIF function.

A spreadsheet with 2 tables. The bottom table has columns for summary, count number, and sales. Cell C18 is selected with an indicated formula of =SUMIF($A:$2:$A$13,A18,$C$1:$C$13).

FIGURE 6.6 Incorrect SUMIF Calculation

Additional Exercise: PivotTable versus SUMIF

  1. Create a PivotTable in cell G3 that will give you exactly the same result as the SUMIF function. Your PivotTable should look like this:
    Row Labels Sum of Sales $
    DVD $1,970
    CD $1,760
    Book $2,430
    Grand Total $6,160

    See the section “Building a PivotTable” in Chapter 8 for instructions if you don't know how to build a PivotTable.

  2. Change one of your values in column C. What happens to the PivotTable? What happens to the SUMIF function?

    You'll notice that the SUMIF formula will change, but the PivotTable does not. This is why the use of PivotTables is not recommended in pure financial models: because PivotTables do not update automatically. See the section “Using PivotTables in Financial Models” in Chapter 8 for greater detail.

AVERAGEIF

The AVERAGEIF function will average values in the specified range that match specified criteria. This is similar to SUMIF.

  1. Let's say that you'd like to know the average in dollar terms of each product sold. Select cell D18. Find the AVERAGEIF Insert Function dialog box or start typing images.
  2. The items you are interrogating go in the Range field, the criteria you are looking for in that range go in the Criteria field, and the numbers you want to average go in the Average_range field.
  3. Press OK. The answer is 486. Your formula should be
    equation
  4. Use absolute referencing, and copy the formula down the range. Your formula should be
    equation

You don't need absolute referencing on the criteria (A18), because it needs to change its reference as you copy down the column.

COUNTIFS

COUNTIFS (along with similar functions such as SUMIFS and AVERAGEIFS) is a relatively new function that was introduced in later versions of Excel. COUNTIFS applies criteria to cells across multiple ranges and counts the number of times all criteria are met. For instance, COUNTIFS could answer how many of each product had been sold to a particular customer.

  1. In row 16, create a filter cell to show which customer we want to show in our summary. So, in cell B16, enter the value Jenny. By linking the COUNTIFS function to this cell, we can change it in the future if we want to.
  2. In cell B18, use the Insert Function dialog box and find the COUNTIFS function, or simply begin typing images if you prefer. If you are using the Insert Function dialog box, it should look like Figure 6.7.
    COUNTIFS dialog box with Criteria_range1 set to $A$2:$A$13, Criteria1 set to A18, Criteria_range2 set to $B$2:$B$13, and Criteria2 set to $B$16. OK and Cancel buttons are located at the bottom-right corner.

    FIGURE 6.7 COUNTIFS Dialog Box

    As you can see, we are invited to keep adding more ranges and criteria to the function COUNTIFS, which was not possible in COUNTIF. Use absolute references for all ranges in your formula, with the exception of Criteria1 in cell A18. The reference to the word “Book” will change to “CD” and “DVD” as the formula is copied down.

  3. The formula should be
    equation

    The result should look like Figure 6.8. The completed version of this exercise can be found, along with the accompanying models to the rest of the screenshots in this book, at www.plumsolutions.com.au/book.

A spreadsheet with 2 tables. The bottom table has columns for summary and count number. Cell B18 is selected having a value of 1. The formula =COUNTIFS($A$2:$A$13,A18,$B$2:$B$13,$B$16) is indicated in the formula bar.

FIGURE 6.8 Completed COUNTIFS Function

SUMIFS

Like the COUNTIFS function, the SUMIFS function applies criteria to cells across multiple ranges and sums specified columns for which criteria are met. For instance, SUMIF tallied up the value of all products, whereas SUMIFS could add up only those purchased by Jenny.

  1. In cell C18, use the Insert Function dialog box and find the SUMIFS function, or simply begin typing images. Match Criteria_range1 (column A) with a value that appears in the range (the value “Book” in cell A18). Similarly, match Criteria_range2 (column B) with a value that appears in the range (the value “Jenny” in cell B16).
  2. The result in cell C18 will be $660 and you can copy it down the range to the result shown in Figure 6.9.
  3. The formula should be
    equation
A SUMIFS Function dialog box, with a spreadsheet with 2 tables at the background. Cell C18 is selected. The formula =SUMIFS($C$2:$C$13,$A$2:$A$13,A18,$B$2:$B$13,$B$16) is indicated in the formula bar.

FIGURE 6.9 Completed SUMIFS Function

As you can see, we are able to append one or more ranges and criteria to the function SUMIFS in the form Criteria_range, Criteria which was not possible in SUMIF. When using the SUMIFS function, we can appreciate the value of using the Insert Function dialog box, as it helps to see which criteria match which criteria range.

AVERAGEIFS

AVERAGEIF averages the value of all products, whereas we could use AVERAGEIFS in a similar way to average only those products purchased by Jenny.

  1. In cell D18, use the Insert Function dialog box and find the AVERAGEIFS function, or simply begin typing images. Enter in the relevant fields to achieve the result in Figure 6.10.
    AVERAGEIRS Insert Function dialog box, with a spreadsheet with 2 tables at the background. Cell D18 is selected. The formula =AVERAGEIFS($C$2:$C$13,$A$2:$A$13,A18,$B$2:$B$2:$B$13,$B$16) is indicated in the formula bar.

    FIGURE 6.10 AVERAGEIFS Insert Function Dialog Box

    As with COUNTIFS and SUMIFS, the AVERAGEIFS function also allows you to append one or more additional criteria to it in the form Criteria_range, Criteria.

  2. The formula should look like this:
    equation

    As can be expected, the result of this formula will be $660, as there is only one instance of sales that were made to Jenny. Now copy the formula down to cells D19 and D20. D20 returns an error, because Jenny did not buy any DVDs, so we need to use the IFERROR function to suppress this error. Go back to cell D18 and put the IFERROR function around your formula. The formula should look like this:

    equation

Then copy the formula down the range. Cell D20 should now show a zero instead of the #DIV/0! error.

To make this table more complete, we need to put a total in cell D21; however, neither the total of the range ($1,540) nor the average of the range ($513) makes sense. In cell B21, we are showing the total number of purchases by Jenny, and then in cell C21, we are showing the total amount of her purchases. Therefore, it makes sense to show the average of all purchases by Jenny in cell D21, which is $807. This cannot be done by copying the function down, so we need to create a new AVERAGEIF function, as shown in Figure 6.12. The formula which should look like this:

equation
A spreadsheet with 2 tables. The bottom table has columns for summary, count number, sales, and average. Cell D21 is selected. The formula =AVERAGEIFS($C$2:$C$13,$B$2:$B$13,$B$16) is indicated in the formula bar.

FIGURE 6.12 Completed Filtered Sales Report

Now, try changing the word “Jenny” in cell B16 to “Faisal” and watch the numbers change.

Filtering IFS Functions by a Variable Value    Note that instead of filtering to show one customer, we could, for example, show only those products that exceed $50. This is not particularly easy using IFS functions (i.e., SUMIFS, COUNTIFS, and AVERAGEIFS), but it is possible.

Let's remove the word “Jenny” and instead add the minimum $50, and change the label to show that the cell now contains only sales that are greater than $50, as shown in Figure 6.13. Note that we are now showing the filter in column C, because it lines up better with the sales amount, which is also in column C. We can now change the original COUNTIFS function to only aggregate the values greater than $50. It is an idiosyncrasy of all these IFS functions, however, that we cannot easily link when using the greater than (>) or less than (<) symbols. The function will force us to use inverted commas, and enter the filter value directly into the function, rather than linking it to an individual cell on the worksheet. Your formula in cell B18 will look like this:

equation
A spreadsheet with 2 tables. The bottom table has columns for summary, count number, and sales. Cell C18 is selected and contains the formula =SUMIFS($C$2:$C$13,$A$2:$A$13,A18,$C$13,“>”&$C$16).

FIGURE 6.13 SUMIFS Function with a Minimum Filter

This is not very good financial modelling practice, however. Any decent modeller would want to allow the user to change the filter minimum value. We therefore need to use a tricky workaround involving the handy ampersand (&) symbol. We'll need to replace images with the phrase images instead, and therefore the minimum filter will change according to the value in cell C16. Your formula in cell B18 should now look like this:

equation

Copy it down and then try the same technique with the SUMIFS function. The solution for the SUMIFS is shown in Figure 6.13.

Similarly, the AVERAGEIFS function can be completed in the same way and should look like the solution shown in Figure 6.14. As in the last example, the formula to calculate the total for the Average needs to be the average for all Sales greater than $50.

A spreadsheet with 2 tables. The bottom table has columns for 4 columns. Cell D18 is selected and contains the formula =AVERAGEIFS($C$2:$C$13,$A$2:$A$13,A18,$C$2:$C$13,“>”&$C$16).

FIGURE 6.14 AVERAGEIFS Function with a Minimum Filter

Note that dates can also be used as input criteria for these IFS functions.

LOOKUP FUNCTIONS

LOOKUP functions are very often used in financial modelling and analysis—sometimes a little too often, in my opinion. They are useful to know, but sometimes another function (such as an INDEX/MATCH nested function, as described in the next section) would create a more robust solution.

VLOOKUP

VLOOKUP stands for “Vertical Lookup”. It can be used anytime you have a list of data with the key field in the leftmost column, and it is by far the most commonly used form of LOOKUP formula. It's a favourite amongst Excel users, but it's not the most robust of functions as we'll soon see.

Let's say you have a shopping price list like in Figure 6.16. You can create this sheet yourself or a template can be found, along with the accompanying models to the rest of the screenshots in this book, at www.plumsolutions.com.au/book.

In cell C12, we'd like to find out how much it will cost to buy four oranges, using a VLOOKUP.

How to Create a VLOOKUP    The following is an 11-step process for creating a VLOOKUP:

  1. Find and select the VLOOKUP function. Using the Insert Function dialog box is probably going to be the easiest for VLOOKUPs, as there are four parameters it needs.
  2. The first parameter is the criteria we are testing, in this case, the word oranges, so enter B12 in the first field.
  3. The next parameter is the table, which contains the data you want to reference. This is where it gets tricky. The criteria you are looking for must always be in the far left-hand column of the data table you are referencing in the table array. So, in this case, the data we are referencing will be the range B7:C10. Figure 6.15 is what your Insert Function dialog box should look like so far.
    VLOOKUP Insert Function dialog box with Lookup_value set to B12 and Table_array set to B7:C10. OK and Cancel buttons are at the bottom-right corner.

    FIGURE 6.15 VLOOKUP Insert Function Dialog Box

  4. Now, if you were going to copy this formula down the page, you would have to use absolute referencing for the table array, or use a named range. Let's create a named range here.
  5. Press Escape to cancel out of the Insert Function dialog box and create a named range for the whole table. Highlight the range B7:C10 and type over the name box in the top left-hand corner of your screen with the word FruitList, and press Enter. We can now use this in the VLOOKUP.

    Now that we have used a named range, we won't have to worry about absolute referencing in our VLOOKUP formula. See Figure 6.16.

    A spreadsheet displaying a table indicating fruit price list. The listed fruits are apples, oranges, pears, and bananas with prices of $0.80, $0.60, $1.00, and $1.20. “4 Oranges” is indicated in row 12.

    FIGURE 6.16 Creating a Named Range

  6. Go back into the VLOOKUP Insert Function dialog box again, re-reference the lookup value to B12, and either select the table array in the second field box or simply type in FruitList. Make sure you have spelt it the same way as your named range! If you can't remember what you called it, use the F3 shortcut as shown in Figure 6.17.
    A Paste Name dialog box and a VLOOKUP Insert Function dialog box, with a spreadsheet at the back ground having a two-column table. Cell C12 is selected. The formula =VLOOKUP(B12) is indicated in the formula bar.

    FIGURE 6.17 Using the F3 Shortcut to Paste Name into a Formula

  7. The third field, called Col_index_num, tells Excel in which column the value is found. We need to tell the function which column in the table array we want it to return. In this case, we want it to tell us the price. So, counting from the far left-hand side of the table array (starting in column B), we want it to return to the second column. So, we enter a number Col_index_num field in the Col_index_num field.
  8. The optional fourth parameter tells Excel if a close match is okay. If you want an exact match, enter zero; otherwise, leave it blank. You may also enter TRUE or FALSE, but typing a zero or leaving it blank is quicker. Click OK to complete the formula.
  9. The Insert Function dialog box should look like Figure 6.18 and the formula should now be
    equation
    A VLOOKUP Insert Function dialog box with a spreadsheet at the background. Cell C12 is selected. The formula =VLOOKUP(B12,Fruitlist,2,0) is indicated in the formula bar.

    FIGURE 6.18 Completed VLOOKUP Function

  10. Now, try changing the word oranges to apples. The price should change.
  11. Last, we need to multiply the price by the number of items we are purchasing. Change your formula to
    equation

#N/A Errors in VLOOKUPs    While this example worked out perfectly, when most people use VLOOKUP, that they are usually matching up lists that came from different sources. When lists come from different sources, there can always be subtle differences that make the lists hard to match. This means you will get a #N/A error if the VLOOKUP function cannot find a match. Here are two examples of what can go wrong and how to correct the error.

Example 1. One list has dashes, for example, and the other list does not. The first time that you try the VLOOKUP, you will get #N/A errors. To remove the dashes with a formula, use a find and replace. Replace with nothing (i.e., leave the field blank). Your data will now match and the formula works.

Example 2. One list has a trailing blank space after the entry. This one is subtle because you can't see it with the naked eye, but it is very common. In fact, I've spent many happy hours searching for an invisible space! When you initially enter the formula, you will find all of the answers are #N/A errors. You know for sure that the values are in the list and everything looks okay with the formula.

One easy way to check is to move to the cell with the lookup value. Press F2 to put the cell in edit mode and you can see that the cursor is located one space away from the final letter. This indicates that there is a trailing space in the entry.

One way to solve the problem is to use the TRIM function. Entering images as part of your VLOOKUP formula will remove leading spaces and trailing spaces, and will replace any internal double spaces with a single space. In this case, TRIM works perfectly to remove the trailing space. The formula would look something like this:

equation

Breaking a VLOOKUP    If you have created a VLOOKUP in a model such as the one above, this should work well—until someone enters or deletes a column in your source data! With a formula such as images, it specifically asks for the second column, so it will not work if someone inserts a column within the FruitList range. This is because your required column becomes the third column, but the VLOOKUP is asking for the second.

VLOOKUPs and HLOOKUPs are not very robust formulas—you can see how easy they are to break! For this reason, try some of the alternatives below to make your LOOKUP functions more robust; otherwise, use another function or protect your model so that users cannot insert or delete rows or columns.

Improving VLOOKUPs with MATCH    The best way around this is to make the 2 in your VLOOKUP a formula instead of a hardcoded number. One way of doing this is to nest the VLOOKUP with a MATCH function. In the following eight steps, we will create the MATCH formula in a separate cell and then replace the 2 with the MATCH formula.

  1. Using the VLOOKUP example above, test the problem by inserting or deleting a column in our sheet. You will see that the value in your VLOOKUP is now incorrect.
  2. Now go to another spare cell, say cell C3, and create a MATCH formula that will find the word Price in the range B6:C6 and tell us its position in the range.
  3. Your Insert Function dialog box should look like Figure 6.19.
    MATCH Function dialog box with Lookup_value set to $C$6, Lookup_array set to $B$6:$C$6, and Match_type set to 0. OK and Cancel buttons are located at the bottom-right corner.

    FIGURE 6.19 MATCH Function Dialog Box

  4. By putting a 0 in the Match_type range, you are asking it to return you an exact match instead of a close match.
  5. When you hit OK, your formula should be images and the result should be 2.
  6. Go into the MATCH formula bar, highlight the entire formula (except for the = sign), and press Control+C to copy it. Hit Enter, or Escape. Now, go back to your original VLOOKUP, and replace the 2 in your VLOOKUP formula with this entire MATCH formula by highlighting the 2 within the formula and pasting the MATCH formula over it by pressing Control+V. Hit Enter.
  7. Your formula should look like this:
    equation
  8. Test that this works, by inserting or deleting a column. You can now clear the formula in cell C3, as this is no longer necessary.

Another way of making a LOOKUP formula more robust would be to use the COLUMN function for a VLOOKUP or ROW function for an HLOOKUP instead of MATCH. This will automatically return the range's column or row reference. Using this, the formula instead would be

equation

(The -1 is required because the range is starting from column B.)

HLOOKUP (Horizontal Lookup)

HLOOKUP works in exactly the same way as VLOOKUP, except that the data is arranged horizontally instead of vertically. See Figures 6.20 and 6.21 for examples.

A spreadsheet displaying a table with 3 columns for worst, base, and best and 2 rows for cups per day and rent. Cell B7 is selected. The formula =HLOOKUP(A1,$B$3:$D$5,2,0) is indicated in the formula bar.

FIGURE 6.20 Use of the HLOOKUP Function

HLOOKUP Insert Function dialog box with Lookup_value set to A1, Table_array set to $B$3:$D$5, Row_index_num set to 2, and Range_lookup set to 0. OK and Cancel buttons are at the bottom-right corner.

FIGURE 6.21 HLOOKUP Insert Function Dialog Box

HLOOKUP is subject to exactly the same issues as the VLOOKUP and works in exactly the same way, except for the orientation. If your source data in the range is orientated vertically, use the VLOOKUP, and if it is horizontal, use the HLOOKUP.

LOOKUP Function

The LOOKUP function is much simpler than either the VLOOKUP or the HLOOKUP, and it has the added advantage of being able to have the results column or row either to the left or right of the criteria column or row—a huge advantage. However, the data must be sorted in alphabetical order or it won't work. This does limit its usage significantly, and it is for this reason that it is far less popular than the VLOOKUP or HLOOKUP formulas.

It's worth knowing how it works, though, so here's a brief example. Let's say you have a tiered pricing structure, as shown in Figure 6.23. You can create this sheet yourself, or a template can be found along with the accompanying models to the rest of the screenshots in this book at www.plumsolutions.com.au/book.

  1. Select LOOKUP from the Insert Function dialog box.
  2. There are two types; choose the first option, as shown in Figure 6.22.
    A Select Arguments dialog box with lookup_value,lookup_vector,result_vector option being selected. OK and Cancel buttons are located at the bottom-right corner.

    FIGURE 6.22 LOOKUP Function Option

  3. Similar to an HLOOKUP or VLOOKUP, the criteria being tested go in the first field.
  4. The column (or row) containing the criteria goes in the second field, and then the column (or row) containing the result goes in the last field. See Figure 6.23.
    A LOOKUP Insert Function dialog box, with a spreadsheet at the background having 2 tables. Cell B3 is selected. The formula =LOOKUP(A3,$E$3:$E$7,$G$3:$G$7) is indicated in the formula bar.

    FIGURE 6.23 LOOKUP Insert Function Dialog Box

  5. Copy the LOOKUP function down and multiply the price by the total amount to complete the pricing table, as shown in Figure 6.24.
    A spreadsheet displaying 2 tables. The table at the left has columns for number items, price per item, and total price. At the right is a pricing table. Cell C3 is selected. The formula =B3*A3 is indicated in the formula bar.

    FIGURE 6.24 Completed Pricing Calculation

Note that this works exactly the same whether the data is shown vertically or horizontally. Importantly, unlike a VLOOKUP or HLOOKUP, it does not matter whether the result data is to the left or right, above or below the lookup data.

However, you would use a LOOKUP only for numerical values where the numbers are sorted and you want a close match, not an exact match. You would not use a LOOKUP function for text, as shown in the last fruit shopping list VLOOKUP example, because it will only return a close match, and this is dangerous. This makes the LOOKUP function almost useless in many cases where a LOOKUP is required. The only time a modeller would use a LOOKUP is when he specifically wants a close match. See Table 6.1 for the advantages of the different LOOKUP functions just described.

TABLE 6.1 Advantages and Disadvantages of LOOKUP Functions

Function Advantages Disadvantages
VLOOKUP
  • Data does not need to be sorted alphabetically as long as you use 0 or FALSE in the last field.
  • The column number is hardcoded, so if a column is inserted, it can mess up the formula. (You can use a MATCH formula to fix this.)
  • The column containing the results must be to the right-hand side of the column containing the lookup criteria.
HLOOKUP
  • Data does not need to be sorted alphabetically as long as you use 0 or FALSE in the last field.
  • The row number is hardcoded, so if a row is inserted, it can mess up the formula. (You can use a MATCH formula to fix this.)
  • The row containing the results must be below the row containing the lookup criteria.
LOOKUP
  • The column/row number is not hardcoded.
  • It does not matter where the columns or rows are in relation to each other.
  • Data must be sorted or it will give the wrong result.

NESTING INDEX AND MATCH

As described in “Linking to External Files” in Chapter 4, robust formulas, such as a nested formula using a combination of an INDEX and a MATCH, used with named ranges, will make the link a lot less likely to break and cause problems in models.

Using INDEX and MATCH to Create a More Robust Formula

Let's say that you are referencing a table in another file. Your co-worker keeps inserting and deleting rows and columns. The VLOOKUP solution as previously described may work, but with large tables, an INDEX and MATCH formula combination will be more efficient.

Figure 6.25 contains the source data, showing we need to pick up the staff amenities costs for Geelong. You can create this sheet yourself or a template can be found, along with the accompanying models to the rest of the screenshots in this book, at www.plumsolutions.com.au/book.

A spreadsheet displaying a table with columns for Campbelltown, Melbourne, Sydney, Parramatta, Geelong, Brisbane, Toowoomba, and Perth. Cell F5 is selected with a value of $23,021. Total are indicated in row 9.

FIGURE 6.25 Sample Data

You could simply reference the cell F5, using the formula images, but this will not help you if your file is closed, and someone else changes the referenced table. Let's say your co-worker inserts a column while your model is closed. When you open your file again, it will still reference F5, but Geelong has moved to column G, so the formula in your model will be wrong!

By using a combination of an INDEX and MATCH formula, we will be able, in 15 steps, to specify the exact coordinates of the required value, even if its position in the table changes.

  1. In cell B12, insert the word Geelong, and in cell A13, insert the phrase Staff Amenities. These cells will become input variables that we will link our formula to.
  2. Now let's find the coordinates of the required data. Start by creating a MATCH formula in a spare cell that will find the word Geelong and tell us its position in the range of city names.
  3. Your formula should be images, and the result should be 6. Note that you could type the word Geelong directly into the formula, but linking it is considered best practice in financial modelling.
  4. Now do the same thing for the expense types. In another spare cell, create a MATCH formula that will find the phrase Staff Amenities and tell us its position in the range of expense types.
  5. Your formula should be images, and the result should be 5.
  6. Now create the INDEX formula that will return the value that you specify. Note that when you use the Insert Function dialog box, it will ask you which argument list you wish to use. Select the first one. See Figure 6.26.
    A Select Arguments dialog box with array,row_num,column_num option being selected. OK and Cancel buttons are located at the bottom-right corner.

    FIGURE 6.26 INDEX Function Options

  7. Once you are in the Insert Function dialog box, enter the array that is the whole range of data, starting from cell A1. Then hardcode in the row number (5 in this case) and the column number (6 in this case). See Figure 6.27.
    Image described by caption and surrounding text.

    FIGURE 6.27 INDEX Insert Function Dialog Box

  8. Add the absolute referencing, so your formula should be images, and the result should be $23,021.
  9. This formula will work fine, as long as no one inserts or deletes rows or columns. We know that hardcoded numbers are not good financial modelling practice and so in order to make it completely robust, we need to replace the 5 and 6 with the results of the MATCH formulas. We are going to turn this into a nested formula, just like we did in the last section, where we nested the VLOOKUP and MATCH functions.
  10. Go back into the first MATCH formula bar (the one that returns a 6), highlight the whole thing (except the “=” sign), and press Control+C.
  11. Go into the INDEX formula and replace the column reference with this formula. Highlight the 6 and press Control+V.
  12. Now do the same for the row reference. Go into the second MATCH formula bar, highlight the whole thing (except the “=” sign), and press Control+C.
  13. Go into the INDEX formula and replace the row reference with this formula. Highlight the 5 and press Control+V.
  14. Don't forget to add in some absolute referencing. Your formula should now look like this:
    equation
  15. Test the robustness of your formula by inserting or deleting rows or columns. You can now cut this formula to another file, and it will work in the same way.

In Figure 6.28, we can see that named ranges have been inserted into the original data, and used in the formula, which has been cut and pasted to a separate file. Even if the data file is changed while the report file is closed, the formulas will still remain accurate.

2 Separated workbooks, each having a table. The workbook at the left has a formula =INDEX(data,MATCH(A13,Exp_Names,0),MATCH(B12,City_Names,0)) indicated in the formula bar.

FIGURE 6.28 Completed INDEX Function Using Named Ranges in Separate Workbooks

OFFSET FUNCTION

The OFFSET function, in my opinion, is less useful than the other functions we have covered so far, as it can be tricky to build and is complex to audit. However, it can be handy in certain situations, and many financial modellers are fond of including it in their models, therefore you will be likely to come across it and need to know how to decipher it.

OFFSET is used to return the address of a cell or a range of cells through the use of a reference cell and is generally used in order to stagger (or offset) a series of values by a variable amount. For example, if you want to delay a project by a certain number of months, but want the number of months to be variable, the OFFSET function will move the value by the number of months that is specified in the model.

To give a very simple example, let's say, in the data shown in Figure 6.29, that you wanted to pick up the value in cell B3, which is located one column across and two rows down from cell A1.

Example data with cells A1, A2, A3, A4, B1, B2, B3, B4, C1, C2, C3, and C4 having the values of 45, 24, 13, 2, 36, 75, 54, 33, 76, 65, 2, and 87, respectively. Cell B3 is an active cell.

FIGURE 6.29 Example Data

Using the OFFSET Insert Function dialog box, the reference point given is cell A1, the offset rows are 2, and offset columns are 1, as shown in Figure 6.30.

OFFSET Insert Function dialog box with Reference set to A1, Rows set to 2, and Cols set to 1. A spreadsheet is at the background with selected cell A6. The formula =OFFSET(A1,2,1) is indicated in the formula bar.

FIGURE 6.30 OFFSET Insert Function Dialog Box

Don't worry about the height and width for now (this is for when you want the result to be a range, rather than a single cell. For an example of using an OFFSET in a range, see “Dynamic Named Ranges” in Chapter 12.) Your formula will be images, and the result given should be 54.

This is picking up the cell one column to the right, and two rows below the reference cell. If you wanted to pick up a cell above or to the left of the cell, you would have used a negative offset number for the rows and columns (e.g. -2 instead of 2).

Using an OFFSET to Model Cash Flow

So now that you know how to do an OFFSET function, let's see how it's used in a more practical context. Let's say that you have monthly sales data, but the terms of payment are one month, as shown in Figure 6.31. This means the cash is received one month after the sale is made.

A spreadsheet having cell C5 being selected. The formula =OFFSET(C ,,-$B$ ) is indicated is the formula bar. OFFSET Insert Function dialog box displays Reference set to C4 and Cols set to −$B$1.

FIGURE 6.31 Calculating a Dynamic Cash Flow Using the OFFSET Function

You can create this sheet yourself or a template can be found, along with the accompanying models to the rest of the screenshots in this book, at www.plumsolutions.com.au/book.

Let's create a Cash Receipts line in row 5 using the OFFSET function, which will delay the cash receipts by the number in cell B1. We have indicated that this number can be changed by formatting the cell as an input using the Styles menu.

  1. Start in cell C5 and create an OFFSET function that uses cell C4 as a reference point and offsets the number of columns by the number of months in cell B1.
  2. Leave rows blank, as you do not wish to move rows.
  3. Make the offset number of columns a negative number, because you wish to return the cell to the left, not the right.
  4. Your Insert Function dialog box should look like Figure 6.31, and the formula in cell C5 should be images.
  5. Copy this formula across the row.

Nesting OFFSET and COLUMN Formulas

The formula that we have created works when the terms are one month, but if you change the number of months in cell B1 to 2, it will pick up the word Sales in cell A4.

Copy the formula all the way across the row, and B5 returns a #REF! error value, as shown in Figure 6.32. This is a very common problem when using the OFFSET function; we need to edit the formula now to make this model more robust.

A spreadsheet displaying a table with 2 rows for sales and cash receipts. Cell B5 is selected with text “#REF!” indicated. The formula =OFFSET(B4,,−$B$1) is indicated in the formula bar.

FIGURE 6.32 OFFSET Function with Error and Text Values

One method is to suppress the errors and text. Note that we have three possible value types being returned by this OFFSET:

  1. Error (in cell B5)
  2. Text (in cell C5)
  3. Number (in the rest of the cells in row 5)

If we suppress only the error using the IFERROR function, then this will allow the text. We could create a complex nested function that would suppress both the error and the text, like this:

equation

But a simpler way would be to return the value only in the case of a number (hence, specifying the value we want, not the values we don't want!). Your formula should look like this, as shown in Figure 6.33:

equation
A spreadsheet displaying a table with 2 rows for sales and cash receipts. Cell B5 is selected having the value of $0. The formula =IF(ISNUMBER(OFFSET(B4,,−$B$1)),OFFSET(B4,,−$B$1),0) is indicated in the formula bar.

FIGURE 6.33 Completed Dynamic Cash Flow Using a Nested OFFSET Formula

Test the formula by changing the value in cell B1 and check that the result is what you expect. If you are expecting no delay in cash receipts, you can enter a zero in cell B1, and the formula will still work.

Alternatively, you could also nest a COLUMN function to give a similar result. A COLUMN function will return the column reference of the formula. For example, COLUMN(B3) returns the value 2.

We need to add a formula in front of our OFFSET function to say that if the number of months in cell B1 is greater than the column position, it should return a zero. Your formula would look like this:

equation

See the sheet named “Fig 6.33a” in the supplementary Excel files for this chapter for a working demonstration in Excel.

REGRESSION ANALYSIS

If you highlight a range of cells in either a column or a row and then drag down or across using the mouse, Excel will use linear regression to forecast what the expected outcome will be. This is fine for a quick piece of analysis, but for a financial model, it's important to show exactly where the numbers came from, so using an auditable function is much better practice.

Using a FORECAST or TREND Function

The FORECAST function in Excel predicts or forecasts data based on historical data, using the linear trend. These functions are a simple way of performing regression analysis in Excel and are useful to include in forecasting models. The TREND function almost always gives the exact same result (but uses the least-squares method instead of the linear trend), so for our purposes, the two can be used interchangeably.

Select the FORECAST (or TREND) function from the Insert Function dialog box.

Basically:

  • X is the date or number for which you want the numbers to be forecast.
  • Known_ys is the known historical data.
  • Known_xs is the known historical dates or numbers.

Let's say, for example, that you have the following historical data available, and you need to provide a forecast for July 2020. You can create this sheet yourself or a template can be found, along with the accompanying models to the rest of the screenshots in this book, at www.plumsolutions.com.au/book.

Date Sales
Jan-20 650
Feb-20 660
Mar-20 680
Apr-20 670
May-20 700
Jun-20 690
Jul-20
Aug-20
Sep-20
Oct-20
Nov-20
Dec-20

If we were to quickly chart these numbers, we could add a linear trend line to visually see what we expect the forecast to look like. Create the chart by highlighting all the data and then selecting Line Chart from the Insert tab on the ribbon. To create the linear trend line, right-click on the series and select Add Trendline. See Figure 6.34.

A line chart with a right-click menu being displayed. The right-click menu displays the options Delete, Reset to Match Style, Change Series Chart Type, Select Data, Add Trendline (selected), Format Data Series, etc.

FIGURE 6.34 Inserting a Linear Trend Line

We can see from the trajectory of the trend line that, based on historical data, the sales in July 2020 should be somewhere between 700 and 710. The formula tells us the slope, which is what the FORECAST function uses to calculate the projections. See Figure 6.35.

A line chart displaying a zigzag solid line along with an ascending dotted line.

FIGURE 6.35 Linear Trend Line

This is exactly how the FORECAST function calculates forecasts. It looks at the historical relationship between the X-axis and the Y-axis, and projects based on these numbers.

  1. To create the FORECAST function, select cell B8.
  2. Bring up the images Insert Function dialog box. The inputs for our formula fields will be:
    • X: A8 (Jul 20) as the date for which we want to forecast.
    • Known_y's: B2:B7 (650 to 690) as the historical data we know already.
    • Known_x's: A2:A7 (Jan 20 to Jun 20) as the corresponding years for the numbers we know already.
  3. Your Insert Function dialog box should look something like Figure 6.36.
    FORECAST Insert Function dialog box displaying X set to A8, Known_ys set to $B$2:$B$7, and Known_xs $A$2:$A$7. OK and Cancel buttons are located at the bottom-right corner.

    FIGURE 6.36 FORECAST Insert Function Dialog Box

  4. The forecast sales for July 20 is 706, and the line chart that you created earlier will show forecasted values that match the trend line exactly, as shown in Figure 6.37.
    A spreadsheet displaying a table with columns for date and sales (left) and a line chart (right). Cell B8 having the value of 706 is selected. The formula =FORECAST(A8,$B$2:$B$7,$A$2:$A$7) is indicated in the formula bar.

    FIGURE 6.37 Completed Line Chart Showing Results of FORECAST

Creating a Forecast with the Forecast Sheet Tool

A new tool, introduced in Excel 2016, was the Forecast Sheet. By selecting the data and using the tool, it automatically creates the forecast for you, without having to build the functions as described in the previous section.

To try it out, select the historical data or click within the table and, as shown in Figure 6.38, on the Data tab, in the Forecast section, select the Forecast Sheet button. This will bring up the Create Forecast Worksheet dialog box showing a preview of what the chart will look like. Expand the options button in the bottom left-hand corner of the chart, and here you can change some of the options such as the chart type, confidence interval, range, and seasonality.

A Create Forecast Worksheet dialog box, with a spreadsheet at the background displaying Forecast Sheet button being encircled in the Forecast panel of the Data tab. The spreadsheet also displays a highlighted table.

FIGURE 6.38 Select the Forecast Sheet Button to Bring Up the Create Forecast Worksheet Dialog Box

Press OK, and a new sheet is created with the chart, and new formulas have automatically been created as shown in Figure 6.39.

A completed forecast sheet with FORECAST.ETS function. A line chart with 3 ascending curves is observed at the bottom. The formula =FORECAST.ETS(A8,$B$2:$B$7,$A$2:$A$7,1,1) is indicated in the formula bar.

FIGURE 6.39 Completed Forecast Sheet with FORECAST.ETS Function

Note that the FORECAST.ETS function is not available in previous versions of Excel, so you should only use this tool if the model users are on Excel 2016 or later.

CHOOSE FUNCTION

The CHOOSE function returns a value from a list of values based on a given position.

For example, let's say you want to pick up the second value in the following list of data in Figure 6.40.

CHOOSE Insert Function dialog box with Index_num, Value1, Value2, Value3, and Value4 set to 2, A1, A2, A3, and A4, respectively. The formula =CHOOSE(2,A1,A2,A4,A5,A6,A7) is indicated in the formula bar.

FIGURE 6.40 CHOOSE Insert Function Dialog Box

  1. Type out the list of days, starting with Sunday.
  2. Select cell A9. Go into the Insert Function dialog box and select CHOOSE.
  3. Index_num is the value that you want the formula to return. Enter 2 in this field.
  4. Enter the values from which you want the formula to choose. Note that you can hardcode these, or use a reference the way that we have done here. See Figure 6.38.
  5. Hit OK, and your formula should be
    equation

Using a Nested CHOOSE Formula with Dates

Let's say you'd like to be able to enter in any date and have a formula that tells you, in words, the day of the week it is.

  1. Go to cell B9 and enter your date. This could be your birth date, or you could create a formula with today's date by typing images. Every time you open the model, it will show the current date. Note that images will show the date and the time.
  2. The formula images will return the day of the week as a number, with Sunday being the first day of the week. Therefore, Sunday=1, Monday=2, and so on.
  3. Go back to your previous formula in cell A9, and turn it into a nested formula by replacing the hardcoded 2 with the WEEKDAY formula.
  4. Your formula should be:
    equation

Now, each time you open the model, the formula in cell A9 will show the day of the week. See the next section for more date options.

WORKING WITH DATES

Excel treats dates and times as numbers, which means they can be computed mathematically. For example, you can subtract two dates to find the number of days in between. This feature is invaluable in financial modelling, as a very large proportion of financial models are time-series based.

You can add some number of days to a date by using simple formulas. Since Excel stores dates as a number of days, you can change the date by including the date in a formula. For example, to add seven days to 1 Jul 2022 in C3, use images, which gives 8 Jul 2022, and hence a weekly cash flow report. See Figure 6.41.

A spreadsheet displaying a table of weekly cash flow statement. Cell C3 is being selected. The formula =B3+7 is indicated in the formula bar.

FIGURE 6.41 Using a Formula to Calculate Dates

Handy Functions

Many financial models require specific dates or sections of dates for analysis. Excel has a fantastic collection of functions to isolate various parts of dates and calculate special dates like the last day of the month. Given below are some of the more commonly used handy date functions in Excel.

  • images. This function gives today's date, whenever you open the model.
  • images. This function gives the exact date and time, whenever you open the model.
  • images. This function gives you the last date of the month, with reference to any date. The snapshot in Figure 6.42 shows how this formula works.
    A spreadsheet displaying various dates under project start date, month 1, month 2, month 3, month 4, month 5, and month 6. Cell B2 is selected with the date 31-Aug-22. The formula =EOMONTH(A2,1) is indicated in the formula bar.

    FIGURE 6.42 Using the EOMONTH Function

    EOMONTH is an extremely useful function because it will always take you to the last day of the month, regardless of how many days it contains. In Figure 6.42, we have a project start date of 6 July 2022 in A2. The last date of the next month is 31 August 2022, which is represented in B2 and can be copied across the row.

    The alternative way of doing a variable start date would be to use formula images, and copy it across. But this is not very accurate, and if you have interest calculations running from the dates, for example, the calculations will not be exactly correct.

    The other benefit of using the EOMONTH function is that it handles leap years very well. In Figure 6.43, if we have a February start day, and want to show six monthly milestones, you can see that by using the EOMONTH function, it will always give us the last day of the month. The year 2020 is a leap year, so cell C3 gives us 29 February 2020, whereas cell E3 gives us 28 February 2021, as 2021 is not a leap year.

    A spreadsheet displaying various dates under project start date, 6 month milestone, 12 month milestone, etc. Cell B3 is selected. The formula =EOMONTH($A$3,B1) is indicated in the formula bar.

    FIGURE 6.43 The EOMONTH Function Calculates a Leap Year Correctly

    While finding the last date of the month is the standard output of the EOMONTH function, with some improvisation you can also get the first day of the month. Since Excel treats dates as numbers, EOMONTH()+1 will give you the first day of the next month if this is required in your model.

  • images. This function gives you the day number in the week corresponding to the date specified. In Figure 6.44 you have the dates corresponding to 6 July 2022 through to 9 July 2022. 9 July 2022 returns a 7 because it is the last day of the week, a Saturday.
    A spreadsheet displaying a table with dates of July 6, July 7, July 8, and July 9, 2022 having weekday of 4, 5, 6, and 7, respectively. Cell B2 is selected. The formula =WEEKDAY(A2) is indicated in the formula bar.

    FIGURE 6.44 The WEEKDAY Function Returns the Day of the Week

    In your financial model, you may have to make some decisions based on the day of the week, and in such cases, the WEEKDAY function can be a useful filter criterion. For example, trading or stock prices are not shown on the weekends, so you would skip those days for certain calculations.

  • images. This function is used to identify the year in a specified date. If your model needs to use the year in the date for a particular calculation or analysis, this function can help you build the necessary logic. Note that the YEAR function does not help if your fiscal year does not match the calendar year. For example, in Australia, the financial year ends at the end of June, so if you need to return a fiscal year (e.g., 2020/21), you need to create a table showing which dates fall in each financial year, and then use a formula such as a VLOOKUP function to return the value.
  • images. This is another very similar function that returns the month number in the date.

    These functions are particularly useful for summarising and collating raw data. For example, we can use the MONTH function to identify the month, which can then be used as the criteria in a chart, PivotTable, or a SUMIF formula to summarise the raw data into the required format. In Figure 6.45, we have used a MONTH function in column B to automatically pick up the month number of the date. This has then been used as a range in a SUMIF function in column G to aggregate the data, which can then be shown on a column chart. You can create this sheet yourself or a template can be found, along with the accompanying models to the rest of the screenshots in this book, at www.plumsolutions.com.au/book.

    A spreadsheet displaying 2 tables and a bar graph. The bar graph has bars for July, August, September, October, November, and December. The formula =SUMIF($B$2:$B$28,E2,$C$2:$C$28) is indicated in the formula bar.

    FIGURE 6.45 The MONTH Function Used to Aggregate Data

  • images. This returns the day in the date. As evident, this is very similar to the MONTH and YEAR function. Note that this is different from the images function, which will return the day of the week. images will return the day of the month. For example, as shown in Figure 6.46, on 6 July 2022 the images function will return a 6, rather than a 4 as shown previously when using the WEEKDAY function in Figure 6.44.
A spreadsheet displaying a table with columns for date and day. Cell B2 is selected. The formula =DAY(A2) is indicated in the formula bar.

FIGURE 6.46 Using a DAY Function to Return the Calendar Day of the Month

Note that for all three functions MONTH, YEAR, and DAY, the input must be in a valid date format. Without proper input, the desired results cannot be returned.

Date Format Dilemma

Two of the most popular standards used in the world today are the dd/mm/yy (UK) and the mm/dd/yy (US) formats. Depending on the regional relevance of the information, the first two numbers could mean the month or the date. Your financial model must eliminate any such ambiguity, particularly if the model is working across several different regions. It is, therefore, best practice to format dates as 5 June 2021 instead of 5/6/21. This way there is no chance of it being interpreted erroneously as 6 May 2021.

Long and Short Date Formatting

A shortcut exists on the Home tab that allows you to very quickly change the date format on any cell from the Number ribbon, as shown in Figure 6.47.

A spreadsheet with expanded Number Format drop down list. The options displayed are General, Number, Currency, Accounting, Short Date, Long Date (selected), Time, Percentage, Fraction, etc.

FIGURE 6.47 Shortcut Date Formatting Drop-Down

In the drop-down menu, you should see both the options Short Date and Long Date. (Note that this may differ depending on your regional settings.) The samples for both are shown in the drop-down itself for easy understanding. While you could use any format in your calculations, you can eliminate confusion by sticking to long date format for any information that requires user interaction.

The short and long dates are not the only formats that Excel provides; you can choose from a much wider range of formats by clicking on the dialog box launcher in the Number ribbon, or by selecting More Number Formats shown at the bottom of the drop-down menu in Figure 6.47.

This brings up the Format Cells dialog box, which you can use to change the way the date appears. In Excel for Mac, the Format Cells dialog box can be found by selecting Format—Cells from the toolbar, or use the shortcut Command+1.

Note that in all versions of Excel, the Format Cells dialog box can be found by right-clicking on the cell and selecting Format Cells.

See the section “Custom Formatting” in Chapter 7 for greater detail on how to create different formats.

FINANCIAL PROJECT EVALUATION FUNCTIONS

Financial functions are designed to save Excel users time when calculating long and complicated formulas such as interest repayments, depreciation, or net present value (NPV). They can be created manually, and if you have studied business or finance at university level, you will have had to create these calculations the long way or using a financial calculator. The predefined function in Excel saves time and makes it much easier to carry out commonly used financial calculations.

There are three financial functions that are commonly used to assess a business case or any series of cash flows: NPV, internal rate of return (IRR), and payback period. There are predefined functions in Excel for calculating NPV and IRR, but there is not one for payback period. For methods on how to calculate a payback period manually, see the section “How to Calculate a Payback Period” in Chapter 9.

Net Present Value

NPV is the value of the expected future cash flows from an investment, expressed in today's dollars. The investor specifies a target rate of return (the cost of capital) for investing capital; it is an opportunity cost concept. Investors have the choice of investing in a project, or putting their funds elsewhere, so they determine the hurdle rate or the amount they want to get back from the project.

The general rule (and the one you would have studied in your university finance textbooks) for considering the investment is: If the NPV is greater than zero, the investment should be accepted; if the NPV is negative, it should be rejected. A positive NPV means the investor can expect to earn a rate of return greater than the required return rate for such an investment. However, from a financial modelling perspective, the decision-making process is much more complicated than a deal or no-deal situation. It really depends on the scenario and sensitivity analysis from the financial model to test whether or not the project should go ahead. Large companies often have policies regarding the standard cost of capital or how long the payback period can be before it is rejected.

What Cost of Capital Should We Use?    How much time is spent calculating the cost of capital really depends on how detailed your modelling is. Many models will simply use a nominated amount and document this as an assumption. This nominated cost of capital could be anything between, say, 6 and 15 percent (although sometimes higher), and it can fluctuate depending on the perceived risk of the project. We may decide to use a very high required rate of return for a risky project, to compensate for the risk taken.

However, instead of simply nominating a cost of capital amount, as we will do in the example in Figure 6.48, you may decide to calculate the weighted average cost of capital (WACC). This calculation takes into account the mixture and rates of debt and equity in the company and is, therefore, a much more accurate way of evaluating the expected rate of return for a project. For greater detail on how to calculate the WACC, see the section “Weighted Average Cost of Capital (WACC)” in Chapter 9.

A spreadsheet displaying a table with values of cost cap and NPV indicated in cells B4 and B5, respectively. Cell B5 is selected. The formula =NPV(B4,B2:F2) is indicated in the formula bar.

FIGURE 6.48 Using the NPV Function

What is Wrong with the NPV Function?    Note that a key assumption of the NPV function is that the cash flows occur at the end of the period, whereas in reality, they will probably occur unevenly throughout the year, with a large portion of costs spent closer to the beginning of the period. In the example shown below, we have included the initial investment in the first year. If, however, we know that a large initial investment will be made prior to the start of the project, then this should be included in year 0, and added to the NPV calculation like this: images.

Internal Rate of Return

IRR equates the present value of the cash inflows and the present value of the cash outflows. The decision rule, in this case, is: If the IRR is greater than or equal to the investor's required rate of return, the investment should be accepted; otherwise, it should be rejected.

Comparing IRR with the Risk Factor    Knowing about the IRR is of little use unless you can make decisions using it. To do that, you must compare the IRR with the risk factor.

There are two possible outcomes when you compare the IRR with risk.

  1. The projected returns from the investment are greater than the risk. In other words, the returns from the investment are high enough to justify the risk of the investment. This is a positive recommendation to invest.
  2. The projected returns from the investment are less than the risk. In other words, the returns from the investment are not high enough to justify the risk of the investment. This is a negative recommendation, cautioning against investment.

Like NPV, IRR uses all three criteria—returns, risk, and time—in its evaluation, and for this reason, many managers find it an easy, accurate, and dependable tool to use.

Using NPV and IRR to Make Decisions    Just because the NPV is positive, and our IRR is greater than our required rate of return, does not necessarily mean that we should go ahead with the project! Blindly accepting the output of a model is a dangerous business. As we know, a model is only as good as the assumptions that go into it, and if we have included aggressively optimistic assumptions in our model, of course, the NPV will look good—but this does not mean the project will do well!

All financial models should be subjected to, at minimum, a base-case, best-case, and worst-case scenario, which are used to evaluate the sensitivity of outputs to changes in inputs. The NPV, IRR, and payback period, which are calculated by the model, should be used as decision-making factors and not the ultimate deciding factors of the fate of the project.

The Problem with IRR    There are a few issues with the IRR function that the modeller needs to be aware of.

Sometimes the IRR function in Excel can produce multiple results. Every time the cash flows change sign (i.e., from negative to positive or from positive to negative), the formula will create another solution. This is why it is a good idea to insert a guessed amount—especially if the sign of the cash flows is not consistent.

Take the following set of cash flows in Figure 6.50 as an example.

A spreadsheet having a table displaying values in cells B2:H2. The value of IRR (13.5%) is indicated in cell B4. The formula =IRR(B2:H2) is indicated in the formula bar.

FIGURE 6.50 IRR Calculation with Multiple Results

If we use the ordinary IRR function without using the guess [entered as images], we get a result of 13 percent. However, because there are several negative returns in this series of cash flows, there are multiple results. If you enter the following guesses, different IRRs will be returned:

  • images gives a result of 13 percent.
  • images gives a result of 6 percent.
  • images gives a result of 25 percent.
  • images gives a result of 481 percent.

Which one is correct? They all are! There are several valid IRRs. Excel goes through an iterative process and comes up with the first solution it finds, which does not necessarily give you the result you want. This is why it's important to use the guess. If the guess is omitted, IRR is assumed to be 10 percent because this is close to a usual rate of return.

Another issue with the IRR is that the way the IRR function calculates in Excel, it assumes that cash generated during the investment period will be reinvested at the rate that has been calculated by the IRR. If the project is generating a lot of cash, the IRR calculation can overstate the financial benefits substantially, which is something that needs to be considered and possibly manually manipulated in the calculations.

We don't normally make any changes to the calculations to account for these problems, but it's important to be aware of these issues when calculating the IRR.

What Difference Does an X Make? XNPV and XIRR    The NPV formula assumes that the values entered into the formula are annual, are in chronological order, and occur at the end of the period.

XNPV and XIRR are relatively new functions introduced for Excel 2007 that offer more flexibility, as you can specify exactly when the payments occur.

XNPV allows you to enter payments that occur at varying intervals, not necessarily in chronological order (although the first payment must still be shown first), and occur at any time. Therefore, it is a much more flexible and useful function. Also, because it does not assume that the payments occur at the end of the period, the XNPV formula will be more accurate.

Be careful when comparing the NPV and XNPV functions, as the NPV assumes the current period (the date we are in right now) is a full year prior to the first cash amount and therefore discounts the first amount back by a full 12 percent (or whatever the nominated discount rate is). If this is not the case, you need to exclude the first period from the function, and add it in separately, like this: images.

The XNPV function, however, assumes that the current date is the date of the first cash flow, so, in the example shown in Figure 6.51, the current date is assumed to be 1 June 2021. Therefore, the first cash amount is not discounted at all. IRR and XIRR have the same issue. This is quite misleading, as most people naturally assume that the functions, being slight variations on the same formula, work in a similar way, but the way they treat the first cash amount is quite different!

A spreadsheet displaying values of profit or loss in cells B2:G2. The values of cost cap, XNPV, and XIRR are indicated in cells B4, B5, and B6, respectively. The formula =XNPV(B4,B2:G2,B1:G1) is indicated in the formula bar.

FIGURE 6.51 XNPV Function

LOAN CALCULATIONS

Calculating debt is an important part of many financial models, and understanding the theory behind how loan repayments are calculated will help in financial modelling. The way that interest, principal, and periodic payments are calculated can be complicated, and fortunately for us, Excel has many useful functions that make calculating loans a lot easier. However, you should still have a basic understanding of how loan calculations work.

Loan-Interest Calculation Method

Interest on loans can be calculated using either the simple interest method or the compound interest method. The simple interest method charges the same amount of interest each year, but under the compound interest method, the interest is added to the loan, thereby increasing the loan amount each year. From the moment at which the interest is added to the loan, it charges interest on itself, increasing the interest on a compounding basis. The compound interest method is by far the most commonly used method, and in the examples in this chapter we assume that the interest is compounding.

When evaluating a loan, you may also need to consider the compounding frequency. If the interest is added to the loan on a daily basis, this would actually make the loan interest payments much higher than if it were added monthly or annually. Most loans are normally calculated on a daily basis, and this means the interest rate actually charged is higher.

Note that the PMT function shown further on, if calculated on an annual basis, does not compound the interest. You will need to convert the interest rate from a nominal or effective rate before using it in the calculation.

Nominal and Effective Interest Rates    We are used to seeing interest rates expressed as an annual rate (e.g., an interest rate of 12 percent means that we are charged 12 percent per year). However, this is only the nominal rate, and this does not mean that we are charged 1 percent per month. In fact, if the interest is calculated daily, we are charged 12 percent divided by 365, or 0.33 percent on the first day of the loan. This amount is added to the principal, so on day two, we are actually paying interest on the interest from the previous day. I know this sounds trivial, but it can make a big difference to your calculations on a large debt.

Loan Repayment According to an Amortisation Schedule

The most common form of calculating loan repayments is to apply an amortisation schedule. Regular repayments of equal value made over the term of the loan are used to pay both the interest charged as well as a portion of the principal amount. With each repayment, an amount equal to the value of the interest charged for the period is applied first to the interest portion, and the remainder of the repayment is then set off against the principal. In this way, the principal decreases after each repayment and the interest calculated for the next period will, therefore, be less, as it is calculated on a smaller principal amount.

To calculate the amount of the equal repayments to be made, the interest rate, the principal amount, and the term of the loan must be known. As interest rates are usually subject to change, the monthly repayment will often have to be revised during the course of the loan.

If you need to calculate the repayments in longhand using the amortisation method, the following formula is used:

equation

where

i = the interest rate per annum, which must be divided by the number of repayment periods per annum (e.g., 12 if payments are made monthly)
n = the number of repayment periods (e.g., 24 if the loan is for a period of 2 years and repayments are made monthly)

Excel Amortisation Functions    Whilst it's good to know the theory of how the repayments are calculated, fortunately, Excel offers several loan calculation functions that can easily be included in financial models. The following are some of the most common functions available in Excel for loan-related calculations.

  • PMT. This is the very basic function that calculates the fixed amount you need to pay at regular intervals to repay the loan along with fixed interest. The syntax for PMT is PMT(rate, number of payments, principal amount, final amount, type). In this syntax, the following applies:
    • Rate. This is the fixed interest rate for the loan period.
    • Number of repayments. This is the number of instalments within which you want to repay the loan.
    • Principal amount. Amount of original loan (no interest included).
    • Final amount. The total amount at the end of all the instalments. This is not a mandatory field and the default value is set to zero.
    • Type. This determines when the payment needs to be made. The default value is zero, which means at the end of the period; one means at the start of the period.

    In Figure 6.52, we have a loan of $1 million repaid over a 10-year period (annually) at 8 percent interest rate. You can create this sheet yourself or a template can be found, along with the accompanying models to the rest of the screenshots in this book, at www.plumsolutions.com.au/book.

    A loan template displaying loan amounting $1,000,000 with interest rate of 8% and term of 10 years. A table is at the bottom with 10 columns and 3 rows for annual repayment, interest only, and principal only.

    FIGURE 6.52 Loan Template

    In cell B11, the PMT function can calculate the fixed payment amount payable each year, which in this case is $149,029. The Insert Function dialog box should look like Figure 6.53.

    PMT Insert Function dialog box with Rate set to $B$6, Nper set to $B$7, and Pv set to $B$5. OK and Cancel buttons are located at the bottom-right corner.

    FIGURE 6.53 PMT Insert Function Dialog Box

  • IPMT. The IPMT function is complementary to the PMT function. While PMT calculates the entire repayment instalment amount, IPMT gives the interest component of the instalment. Like PMT, this is calculated for a fixed principal and interest rate for a given duration of time. The syntax for IPMT is IPMT(rate, period, number of payments, principal amount, final amount, type), where the following applies:
    • Rate. This is the fixed interest rate for the loan period.
    • Period. This is the period for which the interest amount needs to be calculated. For the first period (week, month, year, etc.) this would be 1, and for subsequent periods it will increase as 2, 3, 4, and so on.
    • Number of repayments. This is the number of instalments within which you want to repay the loan.
    • Principal amount. Amount of original loan (no interest included).
    • Final amount. The total amount at the end of all the instalments. This is not a mandatory field and the default value is set to zero.
    • Type. This determines when the payment needs to be made. The default value is zero, which means at the end of the period; one means at the start of the period.

    In Figure 6.54, C10 represents the period that changes in the formula, while all other parameters are fixed references to the loan amount.

    Similar image as in Figure 6.52 with the table at the bottom having indicated values. The formula =−IPMT($B$6,C10,$B$7,$BE$5) is indicated in the formula bar.

    FIGURE 6.54 IPMT Function

  • PPMT. This is another complementary function to the PMT function. PPMT is similar to IPMT, but it returns the other component of the instalment: principal amount. The syntax for PPMT is PPMT(rate, period, number of payments, principal amount, final amount, type). In this syntax, the following applies:
    • Rate. This is the fixed interest rate for the loan period.
    • Period. This is the period for which the interest amount needs to be calculated. For the first period (week, month, year, etc.) this would be 1, and for subsequent periods it will increase as 2, 3, 4, and so on.
    • Number of repayments. This is the number of instalments within which you want to repay the loan.
    • Principal amount. Amount of original loan (no interest included).
    • Final amount. The total amount at the end of all the instalments. This is not a mandatory field and the default value is set to zero.
    • Type. This determines when the payment needs to be made. The default value is zero, which means at the end of the period; one means at the start of the period.

    In Figure 6.54, C10 again represents the period that changes in the formula, while all other parameters are fixed references to the loan amount. All three completed functions can be seen in Figure 6.55.

    Similar image as in Figure 6.53 with cells B11, B12, and B13 displaying formulas of =−PMT($B$6,$B$7,$B$5), =−IPMT($B$6,B10,$B$7,$B$5), and =−PPMT($B$6,B10,$B$7,$8$5), respectively.

    FIGURE 6.55 Loan with Completed PMT, IPMT, and PPMT Functions

Why Does the Interest Amount Decrease on a Fixed Interest Rate?

When using an amortisation schedule for loan repayment calculations, the initial interest amounts are high, but with each period the interest amount goes down and the principal amount increases. This is reflected in Figure 6.56, which is a stacked column chart based on the results in Figure 6.55.

Stacked column chart of loan repayments over ten years having solid and shaded bars representing principal only and interest only, respectively. A table with 10 column and 2 rows is at the bottom.

FIGURE 6.56 Principal (PPMT) and Interest (IPMT) Components of Loan Repayments over 10 Years

Looking at the graph, the calculations may initially seem incorrect, since the interest rate is constant but the interest amount is decreasing. This can be better understood by delving into the actual amounts. The original principal amount was $1 million and the interest was calculated on this principal amount as $80,000. The rest of the instalment ($69,029) went towards repaying the principal.

In the second year, the principal amount was reduced by the first instalment ($69,029 went towards the principal). This means that the new principal is $1 million less the first instalment, which is $930,971. Due to the reduced principal amount, the net interest amount is reduced. However, to maintain the constant instalment amount, the principal amount is increased. Extrapolating this calculation, it is evident that as the period number increases, the unpaid principal amount decreases, and so does the interest amount. However, the principal amount being repaid increases to maintain constant repayment instalments.

SUMMARY

In this chapter, we have covered a few of the important aggregation, lookup, referencing, date, and finance functions that, at minimum, are important for a financial modeller to know. As we know, however, there is a lot more to being a good financial modeller than knowing hundreds of different Excel functions! The most challenging part is to know when to use these functions in your modelling. When faced with a problem, creating a modelling solution that contains the most appropriate tools and functions is the task faced by the financial modeller. Usually, there are several different possible tools that can be used, and the one that is the most concise, yet easiest to follow, will be the best solution.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.240.119