How to convert texted formula into real formula

Copper Contributor

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.

3 Replies

@Manishexcel 

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:

  1. Press ALT + F11 to open the Visual Basic for Applications (VBA) editor.
  2. Click Insert and then Module to insert a new module.
  3. In the module, paste the following VBA code:

Vba code:

Function EvaluateFormula(FormulaText As String)
    Application.Volatile
    EvaluateFormula = Evaluate(FormulaText)
End Function
  1. 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.

@NikolinoDE 

 

Thank you for the solution.

Is there any other way to do the same without VBA?

@Manishexcel -Please check this . Create a named formula and add =EVALUATE(Link the cell you want to evaluate)

 

SanthoshKunder_0-1698302078411.png

 

Was the answer useful? Mark as best response and like it!

This will help all forum participants.