Convert text containing numbers and simple arithmatic (+-*/) to value

J

James L.McMuray

Is there a function that handles simple arithmatic text
strings and gives the resultant value as a number?

value(text) works for simple numbers, ie. No arithmatic

I want to process the string "2*3*4+5*8+2" to yield the
number 54
 
F

Frank Kabel

Hi
you may use the following user defined function:
Public Function eval_it(eval_str)
eval_it = Application.Evaluate(eval_str)
End Function

use is in your example like
=eval_it("=" & A1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top