ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts....

112
ADVANCED FUNCTIONS (EXCEL)

Transcript of ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts....

Page 1: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

ADVANCED FUNCTIONS (EXCEL)

Page 2: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Agenda

• Introduction and Context in Advanced Functions for Modeling

• Models with Advanced formulas and tools

– Modeling Using Named Ranges

– Revenue Matching (Index Match)

– Credit Transition Analysis (Array Functions and Lookups)

– Portfolio Analysis (SumProduct)

– Generating Scenarios (Offset function)

– Building Flexible & Growing Models (Offset, Index)

– Consolidating revenues from different sheets (Indirect)

– Valuation of Startup in e-commerce (Goal Seek)

– Synergy Modeling (Solver)

– Deferred Taxes and Loss Carried Forward (Max, Min)

Page 3: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Named Ranges as Methodology for Modeling

• P&L Information for a company is given

• Create a model, using Named Ranges Use Par-Modeling-Named-Ranges

Page 4: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Define Named Ranges for various items

Just like we can define names for

individual cells, we can define ranges

Numbers for all the years can be

calculated at one shot:

Ctrl + Enter

Page 5: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Define all named ranges

Define Range Names for all important line

Items

Page 6: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Case: Selecting the relevant Revenue

• Revenue figures for GE are given with the

following details

– Quarter wise

– Product wise

– Region wise

• The arrangement of the data cannot be changed

• The management might need to select a

particular revenue figure

Use Par-Rev-Matching

Page 7: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Define Names for Ranges and Match

Define Range Names

Use the Match function to Get the position of

Mont, Region and Division

Page 8: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Use Index to Get the relevant Value

Page 9: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Case: Credit Rating for Your Bond Portfolio

• For all the bonds, the following information is provided

– Starting ratings at the beginning of year 1

– Probability of transitioning to other rating at the end of year 1

• You have invested in a portfolio

– What is the probability that these bonds would be rated BBB+ of below at the

end of Year 2?

Rating Transition Matrix

Your Portfolio

Use Par-Credit-

Rating-Transition

Page 10: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Use Matrix Multiplication to get to “n” Year Default Transition Matrix

To start with create the 2 year transition matrix - If

A is the rating transition matrix for 1 year, A2

would be the transition matrix for 2 years

For Matrix Multiplication, use

CTRL + SHIFT + ENTER

Page 11: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

A^2 gives the two year Transition Matrix

Page 12: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Use Vlookup or a combination of Index and Match to look for relevant

Prob

Page 13: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Case: Portfolio Analysis

• Alice is a trader in the Indian Market and

has entered in the trades indicated below:

• Analysis is required for:

Use Par-Stock-Portfolio

Page 14: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Using Sumproduct

SumProduct Multiplies corresponding cells in two

cells. It can act on conditions as well

Page 15: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Using Sumproduct with a condition

-- Indicates conditions in SumProduct

Page 16: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Case: Creating Flexible Models for Scenarios

• Company DeltaTheta is planning for business

plan for board presentation

– The management believes that it is living in

uncertain times

– Presenting just one scenario to the

management would not make sense

– They want to present various cases (based on

the economic conditions to the board

• A flexible model needs to be created,

– With a single switch the board should be able

to change the scenario and see the results

Product A

Growth

Product

B

Growth

COGS

as % of

Sales

Tax Rate

Best Case Scenario 40% 50% 30% 28%

Moderate Case

Scenario 20% 30% 40% 30%

Worst Case Scenario 5% 10% 50% 32%

Use Par-Scenarios

Page 17: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Using Offset function to select a scenario

Use the offset function to choose the relevant

scenario

Model can be linked to the selected scenario

numbers

Page 18: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Case on Flexible Model Generation

• Most of the models that we have created, require the number of years of the model to be pre-known.

If the model creation needs flexibility

– The number of years of cash generation is not known before hand

• A Real estate Project is undertaken:

– The asset bought at USD 1000 Mio

– The years of operations can be 4 or 5 or 6

– Post that the project is sold

Use Par-Flexi-Model-IRR

Page 19: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Creating a flexible NPV, IRR model using Offset

• Offset function in excel returns a reference to a range that is offset a number of rows and

columns from another range or cell Offset(range, rows, columns, height, width)

– Range is the starting range from which the offset will be applied

– Rows is the number of rows to apply as the offset to the range

– Columns is the number of columns to apply as the offset to the range

– Height is the number of rows that you want the returned range to be

– Width is the number of columns that you want the returned range to be

• Offset function can be used to generate dynamic ranges in the NPV and the IRR function

Offset function used to create

dynamic range

Count function to count the

number of years of ops

Page 20: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Creating a flexible NPV, IRR model using Index

Dynamic Range can be created using

the Index Function

Page 21: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Case: Consolidating Revenues

– Pattern in Sheet Names (Dmonth: For example, Djan, Dfeb, etc)

• Need to consolidate the revenues in a single sheet

Use Par-Consolidate-Indirect

Page 22: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Find the Name of the Sheet and Use Indirect Function to Generate

Reference

Use the Pattern in the Sheet name and the

columns to generate the Names and Reference

names

Use the Indirect function to generate the actual

reference to the sheet and the Range

Page 23: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Find the Sales Number and Clean

Use Index and Indirect to find the relevant Sales

Use Iferror to remove the errors

Page 24: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Get the Consolidated Revenues

Page 25: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Case on Goal in Valuation

• FK Mart is a startup in the e-commerce space and is looking for a valuation of USD 10 Mio in the next

Year.

• The CEO had a meeting with the VCs and the following direction emerged from the discussion

– VCs are very bullish on the space

– You have no revenues right now

– It is difficult to enter into this space. But if you can penetrate the market, it would be great!

– Typically VCs ready to give a valuation of 10x the revenues

• The CEO had a discussion with the SEM guy

– We need to “buy traffic”

– A typical conversion rate in our space is 5%

– We are selling at an average price of USD 300

– I think if we can get sufficient “footfalls” on our site, it would get the job done

– I have also found that if we send targeted ads on google, we can convert 0.5% of the impressions to be

clicked

– Google charges a bomb: USD 0.85 per click!

• CEO has to meet the board to get an approval for the funds to get the ad budget

– How many impressions are needed?

– What should be the budget for the advertisements?Use Par-Valuation-ecom-Startup

Page 26: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Getting the Basic Model in Place

Based on the Assumptions, generate

the complete model

We need to get the valuation to USD

10 Mio

Page 27: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Goal Seek to the Goal

Goal Seek to the relevant Goal

Page 28: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Case on Synergy

• We have two product offerings:

• FRM Material

– In the form of books

– Detailed material with 300+ pages

– Requires huge upfront cost

– Printing cost is low as it is plain vanilla printing

• VisualizeFRM

– Innovative charts

– Summarized material

– Upfront cost is lower

– Printing cost is high

• There is a synergy in the two products

– If 1 unit of FRM Material is sold, the cost of VisualizeFRM goes

down by 1 unit and vice versa

• What would be the breakeven point of sales?

• How many units need to be sold so that product wise also, they

breakeven?

Use Par-Solver-Synergy

Page 29: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Formulating the Problem

Revenue = Price x Vol

Variable Cost (VFRM) =

Cost (VFRM) x Units (VFRM) – Synergy Benefit x Units (FRM Mat)

Total cost = Fixed Cost + Var. Cost

Profit = Rev - Costs

Page 30: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Optimizing for Break Even Point

Activate Solver

Update with Objective Function and

Variables

Page 31: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Problems and Constraints

Overall Breakeven, but not

productwise

Add constraints of individual

product breakeven

Page 32: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Deferred Tax and Loss Carried Forward

• Deferred Taxes are created due to differences in method of calculation of depreciation for book

accounting and for income tax accounting

– For example, Straight Line Method (SLM) is used for calculating book profit while Written Down Value

(WDV) / Double Depreciation Method (DDM) is adopted for calculating taxable income, leading to creation

of deferred tax assets in the initial years

• Carry Forward Losses are created if a company can enjoy benefit of netting off historical losses

against future taxable incomes

• Both these concepts can be incorporated into an integrated financial model using simple steps as

shown in the following slides

Use Par-Loss Carry Forward

Page 33: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Deferred Tax and Loss Carried Forward

• We begin by inputting assumptions on Asset Value and Asset Life, and calculate the PBT as per book

accounting

• Next, we calculate net blocks as per book accounting, by calculating the year-wise depreciation as

per SLM

• Finally, we calculate net blocks as per income tax accounting, by calculating the year-wise

depreciation as per DDM /WDV

We input the assumptions on

Asset Value, Asset Life and

Tax Rates

We calculate the Net Block as

per book accounting using

Depreciation as per SLM

We then calculate the Net

Block as per Income Tax using

depreciation as per DDM

Page 34: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Deferred Tax and Loss Carried Forward

• We calculate the taxable income which is equal to higher of 0 and PBT arrived at, using depreciation

as per DDM

• Then, we calculate the unabsorbed loss which is equal to absolute value of any negative PBT arrived

at, using depreciation as per DDM

• We calculate the amount of carried forward loss to be utilized this year, by taking the minimum of that

year’s taxable income and last year’s cumulative loss carried forward

Taxable Income is higher of 0 or the

value calculated above

We calculate Unabsorbed loss as

absolute value of any negative PBT

arrived as per Income Tax, wherever

applicable

Cumulative Losses from previous

years are netted off against any

current year profits to the extent

possible

We add Depreciation as per books

and deduct Depreciation as per

Income Tax to PBT as per books

Page 35: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Deferred Tax and Loss Carried Forward

• Cumulative Loss Carried Forward is calculated as Cumulative Unabsorbed Loss minus Cumulatively

Utilized Loss

• Then, Taxable Income is calculated as Taxable Income minus any Carried Forward Loss to be Utilized

that year

• Finally, Actual Tax Paid is calculated as % Tax Rate multiplied by Actual Taxable Income

Actual Taxable Income is Taxable

Income earlier calculated minus any

portion of Loss Carried Forward to

be Utilized this year

Cumulative Loss Carried Forward is

Cumulative Unabsorbed Loss minus

Cumulatively Utilized Loss Carried Forward

Actual Tax Paid is Effective

Tax Rate multiplied by Actual

Taxable Income

Page 36: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Showing results to users again require creation of dashboards and

charts. Building flexibility requires advanced excel features

• Macros can also be used to build flexibility in the output format as well

Flexibility in showing results

Dashboards

Page 37: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Automation of repetitive tasks in applications

• Most applications would require the task to be done for multiple iterations

– For example formatting charts, etc.

– For simple routine tasks, Macros can be recorded and used

Training a Robot

Using a Robot

Page 38: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

… Automation of repetitive tasks in applications

• Most applications would require the task to be done for multiple iterations

– VBE can be used to programmatically perform routine tasks repetitively for complex calculations

Programmatically performing

routine tasks in applications

Page 39: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Agenda

• Introduction to Macros & Advanced Application Building in Excel

– Introduction and context

• Key Concepts in Macros

• Macros as recorded Robots!

• Designing application to gather user data

– Implementing user forms in Excel Macros

– Linking forms to excel cells

– Building flexible Charts in Excel

• Understanding VBA

– Understanding the relevant language constructs

• Advanced Financial Applications

– Breaking circular loops

– Monte Carlo Simulation

– Advanced Scenario Generation

– Gathering Online Price Data

– Optional (Invoking Solver, Binomial Trees, Excel2PPT

• Debugging VBA code

Page 40: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

What are Macros?

• A macro is a set of computer instructions

– A mini-computer program

– Activated by an event

– That tells the computer what to do

Macros are like Robots!!

Create

Graphical User Interface (GUI)

Automate

Routine Tasks by Recording

Automate

Routine Tasks by Programming

Page 41: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Steps in Using Macros

• Typically the first level of Macro can be created by Recording the macro

• A little bit of understanding of VB can help improve the usability multi-fold

Train the Robot Use the Robot Retrain Reuse

The Robot is as good as you have trained it!

Page 42: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Enabling the Use of Macros 1

2

3

4

Page 43: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Setting the right security Level

• Macros are dangerous snippets of code and can be built with malicious intent

• Macros need to be enabled for the application to run properly

Page 44: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Introducing the VBA EnvironmentCode

Window

Project

Explorer

Run and Control

Commands

Use Alt + F11 to get the window

Page 45: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Agenda

• Introduction to Macros & Advanced Application Building in Excel

– Introduction and context

• Key Concepts in Macros

• Macros as recorded Robots!

• Designing application to gather user data

– Implementing user forms in Excel Macros

– Linking forms to excel cells

– Building flexible Charts in Excel

• Understanding VBA

– Understanding the relevant language constructs

• Advanced Financial Applications

– Breaking circular loops

– Monte Carlo Simulation

– Advanced Scenario Generation

– Gathering Online Price Data

– Optional (Invoking Solver, Binomial Trees, Excel2PPT

• Debugging VBA code

Page 46: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Training the Robot – Recording a Macro

• Name the macro

• Shortcut key - fill in a letter in the available space

– Allows you to run the macro by holding down the CTRL

key and pressing the chosen letter on the keyboard

• Description

– Description of the macroRemember to Stop the recording!

Page 47: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Using the Robot – Using Macros

• Use the Run Macro or shortcut key assigned to run the macro

Use CopyMe-MacroRecording.xlsm

Page 48: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Your first Recorded Macro

Page 49: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

So what‟s inside the Macro?

Use Alt + F11 to see what Excel writes inside

Page 50: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

If we had used relative references?

Relative Referencing works like

cell referencing without “$”

Page 51: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

So what‟s in the code now?

Internally uses the offset function

Page 52: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Simple Example - Automatically format charts in Excel

• Unformatted “default” chart in Excel

– Format it once and record for further use Use Chart-Recording-Macro

Page 53: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Create a New Macro – FormatChart

• Create a new macro

– Record the steps performed to update the chart as per the standards required

Page 54: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Record all steps in the macro

• Record all steps performed to change the formatting and stop the recording

Page 55: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Select the new chart to be formatted and run

• Select the new chart that has to be formatted

– Run the macro

Page 56: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

The macro would automatically make the formatting consistent

• With a single keystroke you can format your charts

– For example B, CTRL + q is the key

Page 57: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Automatically generated Macros are not very robust

• Even small changes in the expected step would

cause the macro to throw errors

– Need to understand the code

– Slight modifications in the code can make the

macros much more robust

Page 58: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Agenda

• Introduction to Macros & Advanced Application Building in Excel

– Introduction and context

• Key Concepts in Macros

• Macros as recorded Robots!

• Designing application to gather user data

– Implementing user forms in Excel Macros

– Linking forms to excel cells

– Building flexible Charts in Excel

• Understanding VBA

– Understanding the relevant language constructs

• Advanced Financial Applications

– Breaking circular loops

– Monte Carlo Simulation

– Advanced Scenario Generation

– Gathering Online Price Data

– Optional (Invoking Solver, Binomial Trees, Excel2PPT

• Debugging VBA code

Page 59: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Form Controls and Active X controls

ActiveX Controls Form Controls

Toolbar Control Toolbox Forms

Macro code

storage

In the code module for

the SheetIn any standard VBA module

Macro name

Corresponds to the

control name (e.g.,

CommandButton1_Clic

k)

Any name you specify.

Correspond to... UserForm controls Dialog Sheet controls

CustomizationExtensive, using the

Properties boxMinimal

Respond to

eventsYes Click or Change events only

Inserting Design Mode Normal

Assigning

Macros

No Arbitrary Macro

Can be assignedMacros can be assigned

Page 60: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Creating a Model for CAPM

To Select: Right Click!

Using Form Controls

Limitation: A +ve #

To Covert to %age

To Link to a cell

Use CAPM-GUI

Page 61: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Playing with the changes

A Linear Transformation to

generate desired output

Different Controls can be

used for different user inputs

Link to the cell

Custom Format

Page 62: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Formatting the Scroll Bars

Select all scroll bars by click

and ctrl key

Page 63: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Linking the Model

Based on the User Inputs,

Generate the return Expectation

Page 64: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Creating Flexible Charts

Create the Chart Based on the Data

Use Q_FlexiChart

Page 65: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Create Decision controls and link to cells

Page 66: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Linking Data to decision

If the appropriate series is selected,

show the ratio, else hide

Change linkage to new block

Page 67: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Agenda

• Introduction to Macros & Advanced Application Building in Excel

– Introduction and context

• Key Concepts in Macros

• Macros as recorded Robots!

• Designing application to gather user data

– Implementing user forms in Excel Macros

– Linking forms to excel cells

– Building flexible Charts in Excel

• Understanding VBA

– Understanding the relevant language constructs

• Advanced Financial Applications

– Breaking circular loops

– Monte Carlo Simulation

– Advanced Scenario Generation

– Gathering Online Price Data

– Optional (Invoking Solver, Binomial Trees, Excel2PPT

• Debugging VBA code

Page 68: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Basics of VBA – Introduction to Sub and Function

• VBA procedure

– Set of instructions given to the “Robot” to execute

– Perform tasks such as calculating equations,

analyzing data, communicating with excel/ databases,

etc.

– Block structured as a Sub or Function

• Constructed from statements

– Declaration (Robot’s memory)

– Assignment statements (What is put in that memory)

– Execution (What actions to perform)

• Procedures are typed and stored in a Module/

worksheet

• Functions/ Sub are run line by line from beginning to

end

• VBA has two types of procedures

– Sub (A subroutine, which performs a small task for

you!)

– Function procedures (It performs some tasks and

returns a value to you)

Page 69: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Basics of VBA – Introduction to Variables

• Variables are like buckets

– Hold content for you

– The contents of the variables can change

– Actually variables are areas allocated by the

computer memory to hold data

– Each variable has a

• Name

• Type

• In VBA to Declare a new variable (Dim is the

keyword)

– Dim myPassword As String

– Dim firstNum As Integer

– Dim aLargeNumber As Double

• Variables can be used to store data

– myPassword = “whatever”

– firstNum = 10

etc

Page 70: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Basics of VBA – First Input Output

• Display message boxes in a MS Excel worksheet

– MsgBox(Prompt, Style Value,Title)

• Different options on style to show the number of buttons

Use Name-Echo

Page 71: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Basics of VBA – Reading from Sheet

• Simple Syntax

– Variable = Cells(i, j)

– Variable = Range(“Name”)

Use Name-Echo

Page 72: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Basics of VBA – Looping functions in VBA

• For repetitive work, VBA has looping functions

– Much more powerful than direct formulas

– For-Next loop

Use Function-Randbetween

Page 73: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Basics of VBA – Calling Excel Functions in VBA

• Syntax

– Application.worksheetfunction.Whatever function

Page 74: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Basics of VBA – Objects

• VBA object is a thing (just like English “Object” and has

– Functions

– Properties

– Data

• For example,

– Excel Worksheet

– Cells

– Ranges

– font

– Command button

• Range Object

– Range(“myName”)

– Square brackets [] like this: [A10] refers to Range(“A1″)

– Can refer to a list:Range(myArray) refers to whatever address

is stored in myArray variable.

– The address to the range can be formed on the fly as well

Use Function-Randbetween

Page 75: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Agenda

• Introduction to Macros & Advanced Application Building in Excel

– Introduction and context

• Key Concepts in Macros

• Macros as recorded Robots!

• Designing application to gather user data

– Implementing user forms in Excel Macros

– Linking forms to excel cells

– Building flexible Charts in Excel

• Understanding VBA

– Understanding the relevant language constructs

• Advanced Financial Applications

– Breaking circular loops

– Monte Carlo Simulation

– Advanced Scenario Generation

– Gathering Online Price Data

– Optional (Invoking Solver, Binomial Trees, Excel2PPT

• Debugging VBA code

Page 76: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

IDC: Breaking Circular Loops

Because of circular

dependencies, the sheet can

enter into inconsistent state

Use Q_IDC

Page 77: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

IDC: Basic Algorithm

The Copy & Paste Special has to

be repeated again and again. This

can be achieved by Recording

Page 78: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

IDC: Recording the Macro

Has to be done “Intelligently” to be

used later

Page 79: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

IDC: Macro by Recording

The Macro is able to copy and

paste special the values once

Page 80: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

IDC: Editing (with for loop) for the desired results

For Loop to run it

multiple times

Page 81: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Monte Carlo Simulation (MCS)

• There is a fair amount of uncertainty and risk involved with estimating the future value of

figures or amounts due to the wide variety of potential outcomes.

– Monte Carlo simulation (MCS) is one technique that helps to reduce the uncertainty involved in

estimating future outcomes.

• MCS can be applied to complex, non-linear models or used to evaluate the accuracy and

performance of other models.

– risk management,

– portfolio management,

– pricing derivatives,

– strategic planning,

– project planning,

– cost modeling and other fields.

Technique that converts uncertainties in input variables of a model into probability distributions

Combining the distributions and randomly selecting values from them, it recalculates the simulated

model many times and brings out the probability of the output.

Page 82: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

MCS: Frequently Used Distributions for MC

• Normal/Gaussian Distribution

– where the mean and the standard deviation are given and the mean represents the most

probable value of the variable. It is symmetrical around the mean and is not bounded

• Lognormal Distribution

– Appropriate for a variable ranging from zero to infinity, with positive skewness and with normally

distributed natural logarithm

• Triangular Distribution

– With fixed minimum and maximum values. It is bounded by the minimum and maximum values

and can be either symmetrical (the most probable value = mean = median) or asymmetrical.

• Uniform Distribution

– Contrast to the triangular distribution, the likelihood of occurrence of the values between the

minimum and maximum is the same.

• Exponential Distribution

– Used to illustrate the time between independent occurrences, provided the rate of occurrences is

known.

Page 83: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

MCS: Probabilistic Growth in Price and Volume

• Assumptions

– Initial Price and Volume of Material Sold

– Mean Growth and the Std Deviations

• Generating the Probability Distribution of

Price and Volume Growth

– Rand() Generates Uniform Random

– Normsinv() to generate in normal form

• Use the probabilistic price and volume to

project the revenues

Use Q_MCS

Page 84: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

MCS: Implementing Monte Carlo Simulation

• The process of projecting revenues is to be repeated “n” number of times. This can be achieved with

the help of a Macro

1. Variable Declaration2. Emptying the Vars &

Cells

3. For Loop to run the

simulation „n‟ times4. Calculating Average

Page 85: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

MCS: Interpreting the Output

The Progress Bar Implemented

with “Rept()” formula

Page 86: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Agenda

• Introduction to Macros & Advanced Application Building in Excel

– Introduction and context

• Key Concepts in Macros

• Macros as recorded Robots!

• Designing application to gather user data

– Implementing user forms in Excel Macros

– Linking forms to excel cells

– Building flexible Charts in Excel

• Understanding VBA

– Understanding the relevant language constructs

• Advanced Financial Applications

– Breaking circular loops

– Monte Carlo Simulation

– Advanced Scenario Generation

– Gathering Online Price Data

– Optional (Invoking Solver, Binomial Trees, Excel2PPT

• Debugging VBA code

Page 87: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Debugging VBA Code

Breakpoint to Pause the Running Robot

Full Toolbox in VBE to debug the Code

Page 88: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Debugging VBA Code

Highlight Indicates “Paused Robot”

Tooltip Indicates Current Value

Page 89: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Debugging VBA Code

Add Watch to keep observing the Variable

Page 90: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Project Finance (Excel)

Page 91: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Agenda

• Key Concepts in Project Finance Modeling

– Understanding Project Finance

– Quarterly to Yearly Revenue Conversion using Date functions

– Interest During Construction (IDC)

– Cash Flow Waterfall

Page 92: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Characteristics of Project Finance

• Project Finance is the financing of

– often long-term, industrial projects

– Increasingly those which provide public services or infrastructure

– Based upon complex financial and contractual structures commonly involving many legal entities

• Project Finance debt is often termed as "non-recourse"

– Typically secured by the project assets and the core project contracts

• The cash flows from the project

– Come only after the project is fully complete (takes more than a single financial year for completion)

– are usually the sole means of repayment of the borrowed funds

• Separate Entity and SPV Status

– Risk of the transaction is generally measured by the creditworthiness of the project itself rather than that

of its owners (Sponsors).

• Two main types of Project Financing

– Greenfield – a fresh start

– Brownfield – expansion of an existing project

Page 93: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Characteristics of Project Finance

• Multiple parties involved

– Sponsors

– Contractors

– Suppliers

– Governments

– Global financiers,

• From inception of an idea to Financial Close, a Project Finance deal can take years to negotiate

• All about identifying risks, allocating them appropriately and ensuring that the responsible parties are

adequately incentivized to manage their risks efficiently

– Construction time, costs & specification

– Operational cost, reliability

– Supply reliability, quality, cost

– Off-take volume, price

– Politicial environment, war, local hostility, currency inconvertibility

– Socio-environmental responsibilities

Page 94: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Risks & Mitigants

• Funding Risk

– Identification of sources for equity contribution.

– Stipulation for minimum upfront equity contribution.

– Disbursement only after financial tie-up for the project.

• Regulatory Risk

– All major statutory approvals including MoEF and forest clearance stipulated as a pre - disbursement

condition

– Concession agreement is reviewed commercially and risks identified

– Suitable undertakings/guarantees are obtained from sponsors to negate any adverse affect of concession

provisions

– Financing of projects on time-tested concession formats approved by the Planning Commission

• Land Acquisition Risk

– Minimum land acquisition stipulated as a pre-disbursement clause

– Projects in sensitive states avoided

– Land acquisition is the responsibility of Concession Authority

– Compensation is paid by the authority on account of any adverse delay

• Market Risk

– Independent consultant appointed by Lenders to conduct market potential/ traffic study

– Project funding is structured based on cashflow projections to ensure smooth Debt servicing

Page 95: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Risks & Mitigants

• Execution Risk

– Contracts for Civil works/Procurement of equipment on a fixed time fixed price basis.

– Contracts to be finalized before any disbursement

– Reputation of EPC contractor considered

– Suitable provisions for Liquidated damages/ penalty are incorporated in contract documents.

• Technology Risk

– Projects based on proven technology are financed

– Recourse stipulated in case of emerging technologies

• Explicit Political Risks

– Most concession agreements / licenses have clear provisions classifying political risks into 2 categories:

• Direct Political and Indirect Political

• Mitigation mechanisms including compensation is specified in the agreement itself

• Implicit Political Risk

– Policy Risk: Change in policies towards infrastructure like tax sops, concession agreements, grant policies

– Revenue/Toll Rate Risk: Change in toll rates

– Regime Change Risk

– Change in Applicable Laws / Tax Laws

– Cross Border Governing Law Enforcement Risk

– Concession Agreements / Licenses govern all aspects of projects under a contract based system and

governments honor signed contracts

Page 96: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Key Stakeholders

SPV

SPONSORS

HOST

GOVERNMENT

EXPERTS

PROFESSIONALS

GUARANTORS

PURCHASER SUPPLIER

OPERATOR

EPC CONTRACTOR

LENDERS

INSURERS

Page 97: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Contractual Arrangements to Mitigate Risk

Parties Agreements Mitigation mechanisms

Project Sponsors: Shareholders Agreement/Share

Subscription Agreement, Sponsor

Support Undertakings, Corporate

Guarantees.

They bear the risks of project design, construction, completion,

operation, and maintenance and repayment to the lenders. The

cost overrun risk is also borne by the sponsors.

Customers Off-take Agreements When there are only a few potential customers for the project’s

output, revenue risk is likely to be transferred to those customers

by means of a long-term sales contract.

Contracts may include: take-or-pay clause, minimum throughput

agreement, tolling contract etc. The risk of payments is mitigated

through a proper payment security mechanism.

Government/

Statutory

Authorities

Concession/Implementation

Agreements

When a government grants a concession to a project company,

there will be a Concession Agreement that gives the company the

right to build and operate the project facility. Concession

agreement may require the government to construct supporting

facilities such as access roads, contains non-compete condition

etc.

Construction

Contractors

EPC Agreement The risk of project construction is mitigated to the construction

contractors by entering into a fixed time fixed price contract with

them and the contract adequately providing for liquidated

damages (penalties) in case of delay in construction.

Page 98: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Assumptions

Page 99: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Monthly Statements

Page 100: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Conditional Formatting

Assumptions EPC ScheduleMonthly & Yearly Statement

Page 101: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Yearly Statement

Page 102: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Concept of Interest During Construction (IDC)

• When an asset is developed, and there is a considerable period between the start of a project and its

completion, the interest costs related to the construction are generally included in the cost of the

asset, that is, the interest cost is capitalized

• The capitalization period ends when the asset is ready for use

• While modeling in excel, Interest During Construction (IDC) introduces a circular loop into the sheet

due to the circular references explained below (1-2-3-4)

– Equity and Grant commitments can be either a specific amount, or a certain percentage of the total

project funds required (that is, a fixed percentage in the capital structure)

Equity

Grant

Debt

Total Funding

Project Specific

Cost Items

Interest Expense

on Debt Raised

(IDC)

Total Project Cost

Interest Expense is Calculated

on Outstanding Debt

Total Funding is made

equal to Total Project Cost

Total Project Cost

includes Interest During

Construction (IDC)Debt Amount is

made equal to the

Funding Gap

1

2

3

4

Page 103: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Incorporating IDC in a Project Financing Worksheet

• We begin by inputting the project cost assumptions and the equity and grant commitments during the

period of construction

• Next, we put the formula for total project cost (as sum of all project cost elements, including IDC)

• Total Funding is made equal to the total project cost, by referencing it to corresponding cell

• Debt to be raised is calculated as the funding gap in the project, after factoring equity and grant

commitments

Total Project Cost

includes Interest During

Construction (IDC)

Debt to be Raised is

equal to the Funding Gap

in Project Financing

Total Project Fund is

equal to the Project Cost

Requirement

Page 104: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Incorporating IDC in a Project Financing Worksheet

• We calculate the equity and grant commitments during the years of construction from the assumptions

• Then, we calculate the total project cost which is the sum of all project cost elements and the Interest

During Construction (IDC). Note that IDC cells are left blank at this point, as they are yet ot be

calculated

• The Total Fund requirement is made equal to the Total Project Cost requirement

• Finally, the Debt to be Raised is made equal to the Funding Gap in that particular year

Initially Promoter Equity is deployed in the

debt equity ratio. Grant is infused only

after Promoter Equity is fully deployed.

Total Funding

Requirement is made

equal to Total Project Cost

Each of the Project Cost

Items are calculated from

the cost assumptions

Total Project Cost

includes Interest During

Construction (IDC)

Page 105: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Incorporating IDC in a Project Financing Worksheet

• The Interest During Construction (IDC) is calculated by multiplying interest rate on the outstanding

debt component and fed to corresponding cost element in project cost schedule

• The sum of all the IDCs in each of the years of construction is then linked to the total IDC under

Project Cost break-up.

IDC is calculated and fed into

corresponding row under

project cost schedule

Total IDC is made equal to

sum of all IDC in each of the

years of construction

Page 106: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Escrow Arrangement

Escrow Arrangement During

Construction / Operation –

Waterfall Mechanism

Insurers

Revenue Proceeds

Statutory bodies

O&M Contractor

Lenders

DSRA/MMR

SPV Co.

Escrow Bank

Fuel Supplier

EPC Contractors

Govt. Bodies

Sponsors

Claims

Taxes

O & M Expenses

Debt

Servicing

Shortfall in DSR

Balance Surplus

Fuel Expenses*

Contract Payments

Shortfall

• Escrow Mechanism is critical to the

monitoring & enforcement functions of the

lenders.

• All Cash Inflows and Outflows are through

the Escrow A/c. Outflows are permitted

under agreed appropriation of cash in the

escrow account.

• All Reserves are maintained as sub-

accounts within the escrow account.

*NA for Road projects

Page 107: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Charting with Excel – modeling revenue recognition

• Percentage of completion method

– Used when project’s cost and revenue can be

reliably estimated

– Revenue, expense, and therefore profit, are

recognized based on the percentage completed

– Case: An Infrastructure company has undertaken

a project of completing a bridge, construction work

for which is going to continue for the 5 years, and

expected revenue earned at the end of five years

is Rs. 1,000,000,000

• The co. is expecting to build 10%, 25%, 25%, 25%

and 15% in each of the years

• Completed contract method

– Revenue is recognized at the completion as a

bullet

0

100

200

300

400

500

600

700

800

900

1000

1 2 3 4 5

Reven

ue R

eco

gn

ized

Year

Revenue Recognition (%age Completed)

0

100

200

300

400

500

600

700

800

900

1000

1 2 3 4 5R

even

ue R

eco

gn

ized

Year

Revenue Recognition (Completed Contract)

Create Excel Models and Graphs to gain expertise in formulas and graphs

Page 108: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Cash Distribution and Tranches

• ABC Investments and PQR Developers enter into a JV to develop and operate a project having the

following characteristics

– Initial Investments: INR 50 Mn

• ABC Investment: INR 45 Mn

• PQR Investment: INR 5 Mn

– Project to be sold at the end of 5th Year (Net Profit from Sale: INR 75 Mn)

– Cash Flow from Operations as shown in table

• Terms and Conditions from Tranching of operating income

– ABC will receive 5% non-cumulative preferred return on invested equity (Shortfall not carried over)

– After that, PQR will receive 5% non-cumulative preferred return on invested equity

– Remaining cash flow from operations to be split 50-50

• Terms and Conditions from Tranching of Sale of asset

– ABC to receive sufficient capital to earn a min IRR of 12%

– After that PQR receives its invested capital

– Remaining cash to be split 50-50

Page 109: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Total Cash generated in the project can be calculated

Page 110: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Cash Flow Tranches

ABC cash generation is given

a priority over PQR cash

To ensure that ABC gets min IRR

or 12%, goal seek can be used

Page 111: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build

Cash Flow Tranches

Cash is distributed as per the

schedule decided

IRRs are as per the risk

undertaken

Page 112: ADVANCED FUNCTIONS (EXCEL) - Quant Financeqcfinance.in/VBA Combined Resources.pdf · charts. Building flexibility requires advanced excel features • Macros can also be used to build