solve equation written in another cell?

mabubakerali

New Member
Joined
Feb 23, 2016
Messages
29
I have some math problem written in others cell and i want its answer to appear in other cell

Example:
in cell A2 i have 2*3*(5+4) and i want its answer to be appeared in B2
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
mabubakerali,

How about something like this?



Excel 2007
AB
1
22*3*(5+4)54
Sheet1
Cell Formulas
RangeFormula
B2=Eval(A2)




The Function in cell B2, copied down:
=Eval(A2)



How to install the User Defined Function:

1. Open up your workbook
2. Get into VB Editor (Press Alt+F11)
3. Insert a new module (Insert > Module)
4. Copy and Paste in your code (given below)
5. Get out of VBA (Press Alt+Q)
6. Save as a macro-enabled workbook

The function is installed and ready to use as shown in the example above.

Rich (BB code):
Function Eval(Ref As String)
' hiker95, 04/03/3017, ME998908
' https://www.mrexcel.com/forum/excel-questions/998908-solve-equation-written-another-cell.html
' excel - How to turn a string formula into a "real" formula - Stack Overflow
' If A2 contains "2*3*(5+4)" without the " characters.
' In B2 type in "=Eval(A2)" withoue the " characters.
' B2 would display "54" without the " characters.
Application.Volatile
Eval = Evaluate(Ref)
End Function

Then follow in instructions in the Function.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,309
Messages
6,130,001
Members
449,552
Latest member
8073662045

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top