In Excel, how do I perform math using different cells

A1=5 A2=+ A3=5 B1=23 B2=/ B3=3 ... ...

In column 4, I need to execute the 5 + 5, 23 / 3, etc.. automatically. The operand changes though. I have about 50K math problems that I need to evaluate. So how do I use the symbol in column 2 to actually perform that given problem.

-

@Tom Collins's solution is great, but if you wanted to use just Excel and no VBA, you can use an EVALUATE function in Excel, but not in the way you would expect. It's not a regular worksheet function.

You'll need two helper columns, one to contain the concatenated formula, and one to display the final result.

In D1 you'd have

``````=A1&B1&C1
``````

This will compress the separate formula pieces into one cell. You then need a range name to convert it into an evaluated format.

On Excel 2007 / 2010, go the Formulas tab and Define Name. In name you can use Answer, and in Refers To enter the formula

``````=EVALUATE(Sheet1!\$D1)
``````

Then in E1, you can enter

``````=Answer
``````

and drag down.

-

Excel has an Evaluate function in VBA. You can use a function like the one below to pass the cell values to it.

``````Function Eval(R As Range)
Dim S As String
Dim C As Range
For Each C In R.Cells
S = S & C.Value
Next
Eval = Evaluate(S)
End Function
``````

So, in A4 you'll have =Eval(A1:A3)

-