5 Ways To Evaluate Text As Formula In Excel

Intro

Evaluating text as a formula in Excel can be a game-changer for many users. It allows you to treat text strings as mathematical expressions, making it easier to perform calculations and manipulate data. In this article, we'll explore five ways to evaluate text as a formula in Excel, along with practical examples and tips to help you get the most out of this powerful feature.

Excel Formulas

Understanding the Evaluate Formula Feature

Before we dive into the five ways to evaluate text as a formula, it's essential to understand the Evaluate Formula feature in Excel. This feature allows you to see how a formula is being evaluated, step by step. To access this feature, go to the Formulas tab in the ribbon, click on Evaluate Formula, and then select Evaluate.

Method 1: Using the EVALUATE FORMULA Feature

The first method to evaluate text as a formula is by using the Evaluate Formula feature. This feature is available in the Formulas tab in the ribbon. To use this feature, follow these steps:

  • Select the cell that contains the text string you want to evaluate.
  • Go to the Formulas tab in the ribbon.
  • Click on Evaluate Formula.
  • Select Evaluate.
  • The Evaluate Formula dialog box will appear, showing the step-by-step evaluation of the formula.

For example, let's say you have a text string in cell A1 that reads: =2+2*3. To evaluate this text string as a formula, select cell A1, go to the Formulas tab, click on Evaluate Formula, and then select Evaluate. The Evaluate Formula dialog box will show the step-by-step evaluation of the formula, which in this case would be:

=2+2*3 =2+6 =8

Excel Evaluate Formula

Method 2: Using the INDIRECT Function

The second method to evaluate text as a formula is by using the INDIRECT function. The INDIRECT function converts a text string into a cell reference. To use this function, follow these steps:

  • Select the cell where you want to display the result of the formula.
  • Type the formula: =INDIRECT(A1), where A1 is the cell that contains the text string you want to evaluate.
  • Press Enter to display the result.

For example, let's say you have a text string in cell A1 that reads: =SUM(B1:B10). To evaluate this text string as a formula, select cell B11, type the formula: =INDIRECT(A1), and then press Enter. The result of the formula will be displayed in cell B11.

Excel Indirect Function

Method 3: Using the EVALUATE Function (Excel 365 and Later)

The third method to evaluate text as a formula is by using the EVALUATE function, which is available in Excel 365 and later versions. The EVALUATE function converts a text string into a formula and returns the result. To use this function, follow these steps:

  • Select the cell where you want to display the result of the formula.
  • Type the formula: =EVALUATE(A1), where A1 is the cell that contains the text string you want to evaluate.
  • Press Enter to display the result.

For example, let's say you have a text string in cell A1 that reads: =2+2*3. To evaluate this text string as a formula, select cell B1, type the formula: =EVALUATE(A1), and then press Enter. The result of the formula will be displayed in cell B1.

Excel Evaluate Function

Method 4: Using VBA Macros

The fourth method to evaluate text as a formula is by using VBA macros. VBA macros allow you to create custom functions and automate tasks in Excel. To use this method, follow these steps:

  • Open the Visual Basic Editor by pressing Alt + F11 or by navigating to Developer > Visual Basic.
  • Create a new module by clicking Insert > Module.
  • Paste the following code into the module:
Function EvaluateText(strText As String) As Variant
    EvaluateText = Evaluate(strText)
End Function
  • Save the module by clicking File > Save.
  • Return to the Excel worksheet and select the cell where you want to display the result of the formula.
  • Type the formula: =EvaluateText(A1), where A1 is the cell that contains the text string you want to evaluate.
  • Press Enter to display the result.

For example, let's say you have a text string in cell A1 that reads: =2+2*3. To evaluate this text string as a formula, select cell B1, type the formula: =EvaluateText(A1), and then press Enter. The result of the formula will be displayed in cell B1.

Excel VBA Macros

Method 5: Using Power Query

The fifth method to evaluate text as a formula is by using Power Query. Power Query is a powerful data manipulation tool in Excel that allows you to create custom functions and automate tasks. To use this method, follow these steps:

  • Select the cell where you want to display the result of the formula.
  • Go to the Data tab in the ribbon.
  • Click on New Query.
  • Select From Other Sources > Blank Query.
  • Paste the following code into the Query Editor:
let
    strText = "2+2*3",
    result = Text.Evaluate(strText)
in
    result
  • Click on Close & Load to load the result into the Excel worksheet.

For example, let's say you have a text string in cell A1 that reads: =2+2*3. To evaluate this text string as a formula, select cell B1, go to the Data tab, click on New Query, select From Other Sources > Blank Query, paste the code into the Query Editor, and then click on Close & Load. The result of the formula will be displayed in cell B1.

Excel Power Query

Gallery of Excel Formulas

Conclusion

Evaluating text as a formula in Excel can be a powerful tool for automating tasks and manipulating data. By using the methods outlined in this article, you can unlock the full potential of Excel and take your productivity to the next level. Whether you're a beginner or an advanced user, we hope this article has provided you with the knowledge and skills to evaluate text as a formula in Excel.

We'd love to hear from you! Share your experiences and tips for evaluating text as a formula in the comments below.

Jonny Richards

Love Minecraft, my world is there. At VALPO, you can save as a template and then reuse that template wherever you want.