# cell value as operator in a formula in another cell



## Judo Tom

Hello,

I it possible to use the cell value of one cell to be the operator in the formula of another cell?

ie a1 = 5
    a2 = *
    a3 = 2


wish it worked like this
c1 = a1&a2&a3  would yield 10  but it does not it returns 5*2

entering:
="="&a1&a2&a3  yield =5*2  as a text string  is there a way to convert that text string to a formula???

any help would be greatly appreciated... I did try searching but was unable to find anything

Thanks


----------



## Von Pookie

Perhaps with VBA, but I don't think you can do that with a formula.


----------



## Von Pookie

I just tried this macro, and it gave me the desired result of 10.



		Code:
__


Sub test()

Num1 = Range("A1").Value
Oper = Range("A2").Value
Num2 = Range("A3").Value

Range("C1").Value = "=" & Num1 & Oper & Num2

End Sub


It may not be quite what you're looking for, but it's a start I guess.

Hope it helps,


----------



## just_jon

You could do something like --Book1GHIJ20621*22323=6*32418Sheet3

Which requires the morefunc add-in. However, read Tushar's comments in the below link

http://216.92.17.166/board2/viewtopic.php?t=64500[/b]


----------



## Judo Tom

Thanks guys I am going to use the Eval function in the morefunc add in

I appreciate the help!!!


----------



## kristian97

If you are googling for the answer 17 years after this original post, here it is:

https://www.myonlinetraininghub.com/excel-factor-12-secret-evaluate-function

It does not require any add-ins or VBA code. However you must save the workbook as macros enabled workbook .xlsm.

In case that there is better solution for this problem feel free to add it here for people googling it.


----------



## IrmaIsfot

Since I did not find any "simple" solution, I use nestled IFs.
With the OP values:
a1 = 5
a2 = *
a3 = 2

=IF(A2="+";A1+A3;IF(A2="-";A1-A3;IF(A2="*";A1*A3;A1/A3)))


----------

