This page describes some of the really important details of developing the UDF and the parallel model. If you understand some of the key items you can then implement the concepts using the more comprehensive template model. On this page we begin by illustrating a couple of very simple case. The different examples illustrate how you can read in variables; make some arithmetic calculations to mimic the circular reference calculations; and output the results back to excel.
Reading, Arithmetic and Writing
Any program that you write whether in Excel, C++, Fortran, VBA or Python has inputs, some kind of process and outputs. In working with Hedieh we have recognized that being really flexible with reading and writing are essential. In terms of the Arithmetic, the idea is to just copy what you are doing in excel.
Simple Parallel Model Case
Reading and Writing Variables
I work through a simple example with fees in project finance or interest expense in corporate finance. In these examples, I show how you should read in the variables. This is fine for small applications.
The UDF must read a lot of variables and write out the variables in an efficient manner. Excel has a limit of reading ____ characters into the UDF. If you have a complex circular reference problem, there will be two problems
Note in the example below that the read_data is not defined as a particular type of an array.
Function UDF_test(read_data) Column_test = read_data.Columns.Count
For i = 1 To Column_test
read_data_test(i) = read_data(i)
Next iUDF_output_test UDF_test = output_test End Function