Consulting

Results 1 to 3 of 3

Thread: Solved: Teacher needs help in evaluating some simple math text equations

  1. #1

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

    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

  2. #2
    VBAX Expert
    Joined
    Feb 2005
    Location
    Nanaimo, British Columbia, Cananda
    Posts
    568
    Location
    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.
    Cheers,

    dr

    "Questions, help and advice for free, small projects by donation. large projects by quote"

    http:\\www.ExcelVBA.joellerabu.com

  3. #3
    Thank you very much it - works perfectly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •