My initial issue with calculating the line items for a financial
statement based on a set of business rules and constraints was solved
by writing array functions for the spreadsheet. The only remaining
drawback is that array functions require the user to select the
destination cells, which is fine for the financial statements where
the number of cells are known, but will not be acceptable when the
functions need to return values from a database that can have any
number of rows and columns.
I found one solution that relied on a bit of trickery that was
dependent on intimate knowledge of Excel's operations and a speedy computer so
the user wouldn't notice the multiple iterations it required to create the
results and a DLL add-in.