Use formula as a string

62 Views Asked by At

I one cell I have to use several different formula depending on certains case. I another sheet named Static, I wrote a Matrix of formulas in TEXT for all the cases. My matrix have Criteria1 in rows Criteria2 in columns So with INDEX/MATCH i will get the text formula for every scenario Criteria1/Criteria2.

Now I want to Evaluate this formula in text. I did a custom function in VBA

Function Evalue(ByVal str As String)
Application.Volatile
Evalue = Evaluate(str)
End Function

It works when the function is in one block like SUM CONCATENATE etc... but not when there operation of function + -

1

There are 1 best solutions below

0
On

Your UDF works for me........in A1 enter the text string:

sum(B2:B5)+sum(C4:C9)

in another cell:

=Evalue(A1) displays the correct value.