Approach 1: Embedding the Solution
To build a model like the live version of the HOS it is necessary to have a closed form solution to the system. It is not necessary to solve explicitly for every endogenous variable, but you must be able to express all endogenous variables in terms of either parameters and exogenous variables or other endogenous variables which are in closed form. Excel can take care of the substitutions. Hence, we start with the first order conditions that comprise the model, and solve the system. We then write the parameters, exogenous variables and endogenous variables in the order in which they are determined (Gilbert, 2009, shows the full working for the HOS model). When we are at this stage, the model can be built in Excel by following three steps:
Step 1: Lay Out the Model
Step 2: Fill in the Cells
Step 3: Creating Graphics
Step 1: Lay Out the Model
For the utility maximization problem, we think of each cell as representing a model element, and assign a cell for each parameter (the consumption shares and utility scalar), exogenous variable (PX, PY and M) and endogenous variable (CX, CY and U). The layout is arbitrary. Here we have assigned grey cells for endogenous variables (B3, C3 and B9) and white cells for parameters (B11, C11 and B13) and exogenous variables (B5, C5 and B7):