How to Evaluate Text Expressions in Excel Formulas
Question details
The user wants to calculate the mathematical result of a text string containing numbers and operators (e.g., '1/3*1/5+7/10') within a spreadsheet.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Converting a string of text that represents a mathematical equation into an actual numeric result for data analysis or reporting.
- Observed behavior
- Excel does not calculate equations formatted as text directly within standard cells without utilizing legacy macro functions or VBA.
Ensure your text strings contain valid mathematical operators (+, -, *, /) and numeric values. Note that the legacy EVALUATE function relies on Excel 4.0 Macros, meaning your workbook will ultimately need to be saved as a Macro-Enabled Workbook (.xlsm).
Evaluate Text Expressions Using Name Manager
Use Excel's Name Manager to define a custom named formula that leverages the legacy EVALUATE function to parse and calculate text equations.
The EVALUATE function is an old Excel 4.0 Macro function. It cannot be typed directly into a cell like standard functions (e.g., SUM or AVERAGE). Instead, it must be routed through the Name Manager to function correctly on your worksheet.
Click on the cell where you want the calculated result of your text expression to appear.
Navigate to the 'Formulas' tab on the Excel ribbon, then click 'Name Manager'. In the dialog box that appears, click the 'New' button.
In the 'Name' field, type a recognizable name without spaces, such as 'CalculateText'.
In the 'Refers to' field at the bottom, type the formula =EVALUATE(B2), replacing 'B2' with the relative cell reference that contains your text expression. Click 'OK' and close the Name Manager.
Go back to your selected target cell, type =CalculateText, and press Enter. The cell will now display the calculated mathematical result of the text string.
Create a Custom Function with VBA
Write a brief VBA script to create a User Defined Function (UDF) that can evaluate text expressions directly in any cell.
Evaluate Formulas Easily with WPS Spreadsheet
WPS Office provides powerful spreadsheet capabilities, fully supporting complex formula evaluations, Name Manager configurations, and VBA macros to help you calculate text expressions seamlessly.
- 1. Open your Document in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the text expressions.
- 2. Access the Name Manager: Go to the 'Formulas' tab on the top ribbon and select 'Name Manager'.
- 3. Create an EVALUATE Reference: Click 'New', give it a custom name (e.g., CalcString), and type =EVALUATE(A1) in the 'Refers to' box.
- 4. Calculate the Result: Type =CalcString in your desired output cell and press Enter to instantly evaluate the text expression.

Frequently Asked Questions
Why does the EVALUATE function return a #NAME? error in Excel?
This error occurs if you try to type =EVALUATE() directly into a standard cell. EVALUATE is a legacy Excel 4.0 macro function and can only be executed through the Name Manager or by using a VBA script.
Can I use the EVALUATE function in Excel for the Web?
No, the EVALUATE function relies on legacy macros and VBA features, neither of which are supported in Excel for the Web. You must use the desktop version of Excel to evaluate text expressions using this method.
Do I need to save my workbook in a special format after using EVALUATE?
Yes. Because the EVALUATE function utilizes macro features, you must save your file as an Excel Macro-Enabled Workbook (.xlsm). If saved as a standard .xlsx file, the defined names using EVALUATE will be removed upon closing.




