I know that there Excel has a built in macro calle EVALUATE() which can treat string as formula so I created a User Defined Function evalu() to call the macro.
To demonstrate how it works, please see figure1.Please Login or Register to view this content.
I named two columns, "Price" and "t". At E3 and F3 I enter the formula I want as text.
Supposing an array formula like "{=evalu(E3)} would work like calculating Price*t on every row.
Figure 1
Indeed the evalu() function works, plx see figure2. However for formula with reference functions like INDEX, OFFSET, VLOOKUP (column F). The UDF evalu return only the first item (2) . It would have worked if I enter "=index(price, t)" for each row on Column F so I am sure the formula is just fine.HTML Code:
Figure2
It seems that when the formula string (F3) contains INDEX, the evaluate() macro/ UDF evalu doesn't know to return an array of result.HTML Code:
I once thought of modifying the UDF so that it first calculate the result somewhere else and then return back o the function but EXCEL UDF cannot alter any cells other than the cell that called it (caller).
Doesn't anyone know how to modified the UDf so that it would return the array of result?
It is essential to use the UDF here because I am building a generic pricing worksheets and there are like 100 columns of variables which formulae differs by products. The last solution I can think of is writng a macro then copy the formula string down everytime a formula is changed. However this is not cool
Bookmarks