You are on page 1of 7


discussions, stats, and author profiles for this publication at:

Solving the Economic Models by Using the

Tools of Excel and VBA Language

Conference Paper · September 2014


0 528

2 authors, including:

Marcela Hallova
Slovak University of Agriculture in Nitra - Slovenska posnohospodarska univerzita v Nitre


All content following this page was uploaded by Marcela Hallova on 05 May 2015.

The user has requested enhancement of the downloaded file. All in-text references underlined in blue are added to the original document
and are linked to publications on ResearchGate, letting you access and read them immediately.
Solving the Economic Models by Using the Tools of Excel
and VBA Language
Marcela HALLOVA1


Slovak University of Agriculture in Nitra, Faculty of Economics and Management,

Department of Informatics1,2

Tr. A. Hlinku 2, 949 76 Nitra


Models in economics have the wide range of forms including graphs, diagrams, and
mathematical models. Economists use these models in different purposes; it depends on
many factors such as what type of raw data they have or how they can represent the data.
Appropriate tool, which is available to all and is a very comprehensive, is Microsoft Excel.
This availability eliminates the task of seeking funding for the purchase and support of
specialized software packages. In addition, spreadsheet software is relatively easy to use,
and its flexibility makes it useful in many different courses at all levels of the traditional
economics curriculum. Spreadsheet programs may be used to assist with such core learning
activities as exploring and analysing data, estimating and plotting regression lines, solving
complex systems of equations numerically, creating large tables of simulation data, solving
optimization problems or conducting statistical analysis. In combination with Visual Basic for
Applications (VBA) we can create economic models that can serve as study materials for
students of economic schools and help them understand the essence of economic processes
taking place in enterprises.
This paper uses spreadsheet software to explore some chosen economic models. The
paper also illustrates how spreadsheets can make some advanced topics more accessible to
students, thereby helping to bridge the gap between undergraduate and graduate education
in economics.

Key words:
Economic models, Microsoft Excel, Visual Basic for Applications

The basis of the economic prosperity of the state is particularly well-functioning
enterprises. For a thriving enterprise is essential to know economic processes, which taking
place in enterprise. Knowledge about the functioning of enterprises provides many
educational materials, whether in book form or an electronic form. But often is very difficult
for students to understand some economic models. According definition (Kaewsuwan, 2002)
a model is a simple description of a system which used for explaining how something works
or calculating what might happen. Key word in this definition is simple, and Excel and VBA
can make economic models simple for students. Spreadsheets help make the concepts more
accessible while allowing students to explore the ideas in more depth (Cahill & Kosicki,
2000). Visual Basic for Applications is a computer programming language developed by
Microsoft which allows the development of user-defined functions and the automation of
certain processes and calculations. Visual Basic for Applications is a standard feature of
Microsoft Office products. In this paper will be explained IS-LM model with Excel. The IS-LM
model (Investment Saving-Liquidity Preference Money Supply) is a macroeconomic tool that
demonstrates the relationship between interest rates and real output, in the goods and
services market and the money market. The intersection of the IS and LM curves is the
“general equilibrium” where there is simultaneous equilibrium in both markets (Gordon,
2009). IS-LM model has an extension. It is a Mundell-Fleming model. This model is a close
relative of the IS-LM model. Both models assume that the price level is fixed and then show
what causes short-run fluctuations in aggregate income. The key difference is that IS-LM
model assumes a closed economy, whereas the Mundell-Fleming model assumes an open
economy (Flodén, 2010).
Methodological part of this paper will be explaining of chosen model on theoretical base
and then application of this theory to Excel. Writing spreadsheet applications does take
considerable time and effort. While it is often easy to show someone how to perform a
certain operation, writing the sequence of commands can be difficult. The result will be a
complete model created in Excel, where it will be possible to change the values, so that the
student can see the model from different viewpoints. Also this model will be explained step
by step. In combination with elements of VBA model will operate by pressing one key.

Methodology and explanation of the IS-LM model

As was mentioned above, the IS-LM model is a business cycle model based on the
assumption that there are barriers to the instantaneous adjustment of nominal prices.
Typically the price level is fixed and lies above the general market clearing value. The
excessive price level leads to an excess supply of goods. The set-up of the typical IS-LM
begins by directly specifying relationships among aggregate variables, i.e. between
aggregated production, consumption, investment, government spending, money supply… In
a simple version of the IS-LM model these relationships are static. The model is described by
two equations containing two endogenous variables, namely real income and interest rate.
Under normal assumptions, there is only one solution, which, when graphic representation is
located at the intersection of these curves:

(IS) Y = C(Y-T) + I(r,Y) + G (1)

(LM) M/P = L(Y,i) (2)

r=i-ᴨ (3)

In a closed economy, the equilibrium condition in the market for goods is that production (Y)
is equal to the demand for goods, which is the sum of consumption, investment and public
spending. In an open economy, the equilibrium condition in the market for goods is that
production (Y), is equal to the demand for goods, which is the sum of consumption,
investment, public spending and net exports. This relationship is called IS.
The LM curve represents the relationship between liquidity and money. In a closed economy,
the interest rate is determined by the equilibrium of supply and demand for money:
considering M the amount of money offered, Y real income and I real interest rate, being L
the demand for money, which is function of I and Y. It is a similar in an open economy. In IS-
LM model at any point of these curves the equilibrium condition in the corresponding market
is true, but only at the point where the two curves intersect, both equilibrium conditions are
The model is graphically illustrative and mathematically simple to demonstrate the
possibilities of Excel and VBA language, however, is sufficient. In the model we will work with
real macroeconomic indicators for the Slovak Republic in 2013. Situation in Slovakia is
shown in table 1.
Tab. 1 Indicators of the Slovak Republic
Symbol Indicator Value
Y GDP 72134.10 mil €
C Consumption 47400.93 mil €
T Taxes 25925,80 mil €
I Investment 12531.70 mil €
G Government consumption 13526.40 mil €
M M2 monetary aggregate 45916.00 mil €
P Consumer Price Index 163,9
i Interest rate 3,31

The first step to calculate is entering all parameters into excels worksheet. In terms of
greater clarity, it is better to assign a single number numeric format. The next step is
programming the functions of calculating the IS curve and the LM curve. Excel contains a lot
of functions and also offers the possibility to program your own custom functions through
VBA. VBA, which stands for Visual Basic for Applications, is a programming language
developed by Microsoft. Imagine an intelligent robot that knows all about Excel. This robot
can read instructions, and it can also operate Excel very fast and accurately. When you want
the robot to do something in Excel, you write up a set of robot instructions by using special
codes. Before you can start with the programming you need to display a new tab at the top of
the screen called Developer. This tab is in the Customize Ribbon tab of Excel Options dialog

Pic. 1 Developer tab in Excel 2010

You can automate almost anything you do in Excel. Automating a task by using VBA
offers several advantages:
• Excel always executes the task in exactly the same way.
• Excel performs the task much faster than you can do it manually.
• If user is a good macro programmer, Excel always performs the task without errors.
• If user set things up properly, someone who doesn’t know anything about Excel can
perform the task.
But VBA has some disadvantages too:
• User must know how to write programs in VBA.
• Other people who need to use your VBA programs must have their own copies of
• Sometimes, things go wrong. In other words, you can’t blindly assume that your VBA
program will always work correctly under all circumstances.
• VBA is a moving target. Microsoft is continually upgrading Excel. Even though
Microsoft puts great effort into compatibility between versions, you may discover that
the VBA code you’ve written doesn’t work properly with older versions or with a
future version of Excel.

Now, you must open the Visual Basic for Applications Editor (VBE) by clicking on Visual
Basic icon or via shortcut ALT+F11. The VBE is a separate application where you write and
edit your VBA macros. It is the environment you use to create, modify, and manage Office
macros. A macro commonly consists of code starting with the keyword Sub and ending with
the keywords End Sub. Firstly you must insert a new Module. A module contains one or
more macros or subroutines. In the new module must be entered the following code for the
first function called IScurve:

Function IScurve(Optional Consumption As Double, Optional Investment As Double,

Optional Government_consumption As Double)
IScurve = Consumption + Investment + Government_consumption
End Function

Second function is called LMcurve, and the code is following:

Function LMcurve(Monetary_aggregate As Double, Consumer_Price_Index As

Double) As Variant
If Consumer_Price_Index = 0 Then
LMcurve = CVErr(xlErrDiv0)
LMcurve = Monetary_aggregate / Consumer_Price_Index
End If
End Function

This function includes the possibility that the Consumer Price Index is zero and thus function
alerts the user with an error message.

Dialog boxes of both functions shown Pic. 2

Pic. 2 Dialog boxes of IScurve and LMcurve functions

If we denote planned expenditure in the economy E = C + I + G, and further let I, G, T

are fixed. Then E = C + I + G = C(Y-T) + I + G. Because consumption C is an increasing
function of disposable income Y - T, as well as the planned spending in the economy E is an
increasing function of total income Y. Y represents a totally revenues, and hence the actual
expenditure of the economy, and therefore the economy is in equilibrium Y = E. Verification
of balance can be done in Excel using the IF function in the form:


Also may be useful simple custom function that after entering the cell which is verified say
user if model is in balance or not. Code of this function is as follows:

Function SayIt(txt)
Application.Speech.Speak txt, True
End Function

Values may change at any time and the whole model will be recalculated accordingly. It is
important to save the file to have these functions for use in other files. If you stored one or
more macros in a workbook, the file must be saved as a “macro-enabled” file type. In other
words, the file must be saved with an XLSM extension rather than the normal XLSX
extension. But firstly is important to understand macro security. The reason is that VBA is a
powerful language – so powerful that it’s possible to create a macro that can do serious
damage to user’s computer. A macro can delete files, send information to other computers,
and even destroy Windows so that you can’t even start your system.

This paper offers no evidence that the use of spreadsheet software increases student
learning in economics, the applications suggest to us that spreadsheets may be able to help
instructors delve more deeply into traditional topics or tackle more advanced topics. Cause
that we cannot yet judge whether this application and other planned applications result in
improved learning outcomes is that research takes place at the moment. This is also the
reason why the model is not yet fully complete. The model will be expanded to Mundell-
Fleming model. Also everything will be in graphic design. Excel together with VBA is very
powerful tool and its potential will continue to grow. The survey results will be published in
other articles and other scientific publications.

Barilla, J., Simr, P., Sýkorová, K. (2010.) Microsoft Excel 2010 Podrobná užívateľská
príručka. Computer Press, a.s., Brno. ISBN 978-80-251-3031-5.
Cahill, M., Kosicki, G. (2000). Exploring economic models using Excel. Southern Economic
Journal, Volume 66, Issue 3, DOI: 10.2307/1061439.
Cornell, P. Managing macros with the Visual Basic Editor. Retrieved September 20, 2014
Dellas, H., Schmidheiny, K., Wälti, M. (2005). Teaching Economics with the Computer.
Retrieved August 12, 2014 from
Flodén, M. (2010). The Open Economy Revisited: The Mundell-Fleming Model and the
Exchange-Rate Regime. Retrieved September 15, 2014 from
Gordon, Robert J. (2009). Macroeconomics (Eleventh ed.). Boston: Pearson Addison
Wesley. ISBN 9780321552075.
Kaewsuwan, S. (2002). Importance of Models in Economics. BBA 2 SS 2002.
Kaul, A. (2013). VBA On Error Statement – Handling Errors in Excel Macros. Retrieved
September 21, 2014 from
Páleník, V. a kol. (2011). Možnosti modelovania zmien ekonomiky Slovenskej republiky so
zreteľom na fungovanie v Európskej menovej únii. Retrieved September 15, 2014 from
Policonomics – Economics made simple. IS-LM model. Retrieved September 15, 2014 from
Policonomics – Economics made simple. IS-LM-BP model. Retrieved September 15, 2014
Roman, S. (2002). Writing Excel Macros with VBA, 2nd Edition. O’Reilly, June 2002. ISBN 0-
Visual Basic for Applications. (2014). Retrieved August 12, 2014 from
Walkenbach, J. (2013). Excel VBA Programming For Dummies, 3rd Edition. John Wiley &
Sons, Inc. Hoboken, NJ. ISBN 978-1-118-49174-4.

View publication stats