I spend quite a lot of time playing with simple economic models in Excel to help me understand things better. The basic idea is to investigate how your model behaves when you change one or more of the parameters. Recently I’ve been using the user interface controls in Excel to provide a way to manipulate models interactively, and then visualise what’s going on graphically. I found this is a really good way for understanding the behaviour of a model. To explain how to make a model like this, let’s just use the simplest possible demand and supply model as an example, like this:
Demand: Q = A - P
Supply: Q = CP
In this model there are two parameters, A and C. As every first-year economics student knows, we can solve these two equations to get the market quantity Q* and price P*. This model is pretty boring but it’s sufficient to illustrate how to make an interactive model in Excel. What we’re interested in is how Q* and P* change if we changed A and C. We can calculate that pretty easily, but it might help to visualise what’s going on in the model by plotting the demand and supply curves. So that’s what I want to do in Excel.
Step 1: Set up the parameter inputs
Create the following in a blank worksheet:

The ‘Value’ column gives the values of the two parameters that we’ll use for simulating the model. The ‘Min’ and ‘Max’ columns give the minimum and maximum possible values of each parameter that we’ll allow. For this example, zero is a natural minimum, but there’s no natural maximum, so I just chose 10 arbitrarily. I’ll talk about the ‘Count’ column later.
Step 2: Simulate the model
We want to plot demand and supply, so we need to plug different values of P into the demand and supply equations and plot the values of Q that we get. So set up some columns that calculate the quantity demanded and quantity supplied for different values of P, say between zero and 10, in steps of 0.1, or something like that. I haven’t shown the whole thing here, but my values of P go up to 10. For each P, the value in the QD column is calculated from the demand equation, and the value in the QS column is calculated from the supply equation.
I also added a couple of cells to calculate the equilibrium price and quantity, since it will be nice to show exactly the equilibrium point where demand and supply cross on our graphical display of this model. A little algebra tells us that P* = A/(C + 1) and Q* = AC/(C + 1).


Step 3: The secret sauce — adding a user interface

What we really want to do with this model is see how demand and supply (and the equilibrium) change when we change A and C. We could do this by just typing different values into the cells that contain these parameters. But instead of that, let’s use a simple user interface to control them. It’ll be much more fun and pleasant than typing endless values. So make sure the controls toolbar is showing (turn it on from the View menu if necessary). Then click the scrollbar icon, and draw some scrollbars next to the parameter inputs for our model, like this:

Now we’re going to connect these scrollbars to the two parameters so that we can control the values of the parameters by using the scrollbars. Right-click on the first scrollbar and choose Properties. In the box that pops up, enter F3 in the ‘Linked cell’ field (or whatever cell you put the ‘Count’ for the demand intercept) and change ‘Max’ to 100. Repeat for the second scrollbar and link it to the ‘Count’ for the supply slope (cell F4 in my example).

What this does is allows each scrollbar to represent values between 0 and 100. If the bar is in the left most position it represents 0 and if it’s at the right most position it represents 100. Half-way represents 50, and so on. Now we just need to turn this into a value for our parameters. For the demand intercept, for example, we’ve set the minimum and maximum possible values at 0 and 10. So if the scrollbar is half-way, we want the demand parameter to be 5. So just use a formula in the ‘Value’ cell for the demand intercept. It should be the minimum value plus the difference between the maximum and minimum values, multiplied by ‘Count’ divided by 100. In my example, the demand intercept is calculated as D3 + (E3 - D3)*F3/100.
Step 4: Add a graph
Insert an X-Y (scatter) graph into the worksheet and use it to graph the simulated demand and supply data (don’t forget we usually put price on the vertical axis!). Make the graph pretty, and add a single data point to represent the equilibrium. I’ve also generated other data series to give horizontal and vertical dashed lines to highlight the equilibrium price and quantity.

And that’s all there is to it. Now you can play with those scrollbars (don’t forget to turn off ‘design mode’ first by clicking the button that I showed above). As you move the scrollbars, you can watch the demand and supply curves shift and the equilibrium move too. It might not seem like much for such a simple example as this, but the same technique can be easily applied to more complex models. I find that moving the scrollbars and watching how a graphical representation of my model changes in response really helps me to see what’s going on inside the model. It also helps to point out things that you might miss by just thinking about the model in abstract terms alone.
You can download the spreadsheet that I made for this example here.