PDA

View Full Version : Solved: Teacher needs help in evaluating some simple math text equations



Sam62
07-19-2009, 12:28 PM
Mdmackillop and P45cal were so nice to help me with my other problem, I thought I would try again.

I have a column of 400+ math equations in text format like these:
2+2=?
2+10=?
2 x 2=?
12 x 11=?
6 / 2=?
12 / 12 =?
6 - 4=?
3 - -4=?
12 / -3=?
I would like VBA routine that will go down a column M, evaluate the text and place the answer in col U. If if is possible, it might be nice to find the text to evaluate in a string of characters such as "What is the value of =14x14 in the chart?" I placed an equals sign to identify where the equation starts (maybe another way is better but also how to determine the last number to use in the equation?) I assume that spaces can be in or out between numbers and signs.

Although not needed for the above, I would not be disappointed if it could also handle one like this : "What is the value of this equation: (4+3)/2 -3x4?"

I have spent several hours searching for a simpler routine then the ones if found that were for "Complex Formulas" such as trig functions.
thanks

rbrhodes
07-19-2009, 08:16 PM
Hi Sam,

Here's a stab at it. Should handle anything except 2 equations in one sentence. See notes on spare sheet and comments in code.

Sam62
07-20-2009, 11:13 PM
Thank you very much it - works perfectly