Suppose I have a text string like "11+5" or even "=11+5" stored in a cell. Is there a function in Excel that will allow me to actually evaluate that string as if it were a formula?

This would be helpful for another project where I would like to be able to write 'dynamic' formulas in Excel.

link|improve this question

excel had this EVALUATE() function that does exactly this. That was a long time ago though, and i am not too sure about the new excel. Will poke around and see if i can find something equiv. – aCuria Mar 5 '11 at 1:12
that function sounds familiar, but I certainly can't find it in Excel2007, which is what I'm currently using. – drapkin11 Mar 5 '11 at 1:15
I cant find it either =/ – aCuria Mar 5 '11 at 1:17
feedback

1 Answer

up vote 2 down vote accepted

EVALUATE is available in vba in all current versions

You can include it in you vba code, or wrap it into a simple udf to make it available as a worksheet function

Function ev(r As Range) As Variant
    ev = Evaluate(r.Value)
End Function

It basically treats the value of the passed parameter as an excel formula, same as if it were entered in a cell

"11+5" and "=11+5" will produce the same result

link|improve this answer
I forgot all about user-defined functions in Excel -thanks. – drapkin11 Mar 5 '11 at 3:21
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.