Forum Discussion
COMMAND TO RUN A FORMULA?
Good afternoon, Excel gurus! I am trying to "assemble" a formula and am wondering if there is a way to create a formula that tells Excel to run the formula in the last cell where it's a finished product. I've attached my spreadsheet for reference, but here's a quick version of what I'm trying to do:
Beginning of formula: IF($A$7= [in CELL B1]
Middle section: 4*3 [in CELL B2]
End of the formula: ,50,99) [in CELL B3]
When I type the formula into cell E1, I receive the correct answer:
=IF($A$7=4*3,50,99) returns the correct answer of 50.
When I enter this formula into cell E2, it returns the correct formula WITHOUT THE LEADING EQUAL SIGN: =B1&B2&B3 returns IF($A$7=4*3,50,99).
How do I write the formula so that Excel knows to "run" the formula in cell E2?
Thank you!
Ronna
- Haytham AmairahSilver Contributor
Hi Ronna,
You need to a special solution to calculate this formula string IF($A$7=4*3,50,99).
My suggestion is to use the following custom function that I wrote in VBA and save in the workbook in a new VBA module to be able to use it in the worksheet.
Function Eval(range)
Dim r
r = Evaluate("=" & range)
Eval = r
End FunctionHowever, I've updated the workbook you attached with this function, so please find it below.
Regards,
Haytham
- Deleted
Thank you very much, Haytham! I appreciate you sending me the updated workbook so I could see your code in action.
Ronna