how to evaluate a string in excel

2013-12-01

azim58 - how to evaluate a string in excel


how to evaluate a string in excel
how to evaluate text as a function in excel

First press alt+F11 to open the code editor (source
http://office.microsoft.com/en-us/excel-help/create-custom-functions-in-exc
el-2007-HA010218996.aspx)
Click Insert->Module
Paste this ev code (source:
http://superuser.com/questions/253353/excel-function-that-evaluates-a-strin
g-as-if-it-were-a-formula)

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

Close the editor
start using the ev function like normal in the excel worksheet


Note that macro enabled excel files need to be saved as an xlsm file.
When these files are opened, macros might be disabled by default, and you
may have to click to enable them on the warning message at the top of the
screen.