I'm looking for something similar to the solution posted here:
Excel function that evaluates a string as if it were a formula?
Problem is this does not seem to work with a function in there.
This is the function in that thread as submitted by chris neilsen:
Function ev(r As Range) As Variant
ev = Evaluate(r.Value)
End Function
Here is an example of a string I would like to turn into a formula:
=(INDEX(DataV,1,4)/INDEX(DataV,2,4))*100
DataV is a name within the spreadsheet.
I'm not sure how to do it, maybe I'll figure it out, right now it's looking like I probably won't unless I read a lot more about VBA.
Any help is appreciated.
Evaluate()
can handle only VBA expressions, and not Excel worksheet functions likeINDEX()
. If you're expecting a specific pattern (e.g.,INDEX(something)/INDEX(something)
), you could write code to parse it and emulate the worksheet functions with VBA functions. But I have no idea how to do a general solution.