Forum Discussion
Manishexcel
Oct 25, 2023Copper Contributor
How to convert texted formula into real formula
Hi
Anyone can help me convert the text formula into a real formula? i.e. in cell A1 there is a formula in text =4+2. now I want output as 6 in cell D3.
- NikolinoDEGold Contributor
To convert a texted formula into a real formula in Excel, you can use the EVALUATE function, which allows you to evaluate a formula stored as text. Please note that the EVALUATE function is not a built-in Excel function, so you would need to create a custom VBA function for this purpose.
Here are the steps to create a custom VBA function for this:
- Press ALT + F11 to open the Visual Basic for Applications (VBA) editor.
- Click Insert and then Module to insert a new module.
- In the module, paste the following VBA code:
Vba code:
Function EvaluateFormula(FormulaText As String) Application.Volatile EvaluateFormula = Evaluate(FormulaText) End Function
- Close the VBA editor.
Now, you can use the EvaluateFormula function to convert texted formulas into real formulas. In your example:
- In cell A1, you have the texted formula =4+2.
- In cell D3, you can enter the following formula to get the result:
=EvaluateFormula(A1)
Cell D3 will now display the result of the formula in cell A1, which is 6.
Please note that using custom VBA functions requires enabling macros in your Excel settings.
The text was created with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and like it!
This will help all forum participants.
- ManishexcelCopper Contributor
- SanthoshKunderIron Contributor
Manishexcel -Please check this . Create a named formula and add =EVALUATE(Link the cell you want to evaluate)
Was the answer useful? Mark as best response and like it!
This will help all forum participants.