Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to convert text strings to formulas in Excel?

If there are lots of text strings as =A1 + B1 format which you need to convert these text strings to real formulas and calculate their values in your worksheet, unfortunately, there is no direct method to solve it in Excel. But, here I can talk about some interesting tricks for you.

Convert text strings to formulas with User Defined Function

Convert text strings to formulas with Kutools for Excel

Office Tab Enable Tabbed Editing and Browsing in Office, and Make Your Work Much Easier...
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
  • Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
  • More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
  • Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
  • Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
  • Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
  • Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
  • More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.

arrow blue right bubble Convert text strings to formulas with User Defined Function


The following short VBA code can help you to deal with the problem that convert text to formula as these steps:

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Convert text strings to formulas

Function Eval(Ref As String)
Application.Volatile
Eval = Evaluate(Ref)
End Function

3. Save this code and return to your worksheet, enter this formula =Eval(C1) into a blank cell (C1 contains the text string cell which you want to convert to formula), see screenshot:

doc-convert-text--to-formula1

4. Then press Enter key, and select cell D1, drag the fill handle to the range which you want to apply this formula. See screenshot:

doc-convert-text--to-formula1


arrow blue right bubble Convert text strings to formulas with Kutools for Excel

If you don’t like use the above code, you can apply Kutools for Excel’s Convert Text to Formula feature, with its help, you can also convert text strings to formulas at once.

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 30 days. Get it Now.

After installing Kutools for Excel, please do as this:

1. Select the text strings that you want to convert.

2. Click Kutools > Content Converter > Convert Text to Formula, see screenshot:

doc-convert-text--to-formula1

3. And all your selected text strings have been converted to real formulas and get their values as well. See screenshots:

doc-convert-text--to-formula4 -2 doc-convert-text--to-formula5

To know more about this Convert Text to Formula feature.


Related article:

How to convert formula to text string in Excel?


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    willyfred · 1 years ago
    Hello Johnny
    about Hussein’s issue, if the external workbook is closed INDIRECT gives #REF! error. Do you have other solution?
    • To post as a guest, your comment is unpublished.
      Hasan nasralla · 1 years ago
      use indirect only works with open workbooks.


      solution is to use indirect.ext from morefunc.


      regards,
      Hasan nasralla
  • To post as a guest, your comment is unpublished.
    Johnny · 2 years ago
    Hi Hussein,

    Just use the INDIRECT function in Excel. Does the same thing.
  • To post as a guest, your comment is unpublished.
    Hussein · 2 years ago
    Greetings, the above code works perfectly inside the same workbook across different sheets, but in case i have a cell reference to an external workbook it returns #VALUE!. the formulas were calculating normally earlier.
    Example for the formula can't be evaluated correctly: IFERROR(INDEX('[Tracking-OSP Outside Riyadh-07-09-2017.xlsx]Tracking WO'!$U$3:$U$19000,MATCH(A3&"",'[Tracking-OSP Outside Riyadh-07-09-2017.xlsx]Tracking WO'!$B$3:$B$19000,0)),INDEX('[Tracking-OSP Outside Riyadh-07-09-2017.xlsx]Tracking WO'!$U$3:$U$19000,MATCH(value(A3),'[Tracking-OSP Outside Riyadh-07-09-2017.xlsx]Tracking WO'!$B$3:$B$19000,0))).
  • To post as a guest, your comment is unpublished.
    Tamarind · 2 years ago
    The replace = with = works, so relieved. Thank you to whoever discovered and shared this nugget of Excel gold.
  • To post as a guest, your comment is unpublished.
    Rich · 3 years ago
    To clarify my other comment, I mass replaced the "=" character with the same "=" character, and that made the strings turn into formulas.
    • To post as a guest, your comment is unpublished.
      Frans · 4 months ago
      Hi Rich,
      I'm just reading you comment on turning text into a formula. It seems that the function as mentioned above is not working. I'm not really a programmer but what i did is converting a formula into a text and in the text i have to replace a few values and combine it again in one text but now i need to convert it back into a formula. Could you give me a tip.
      Regards
      Frans
  • To post as a guest, your comment is unpublished.
    Rich · 3 years ago
    I don't know if this would always work, but I had a number of cells that had formulas stored as text strings. I did a full worksheet find replace on the "=" character, and all of my strings converted to formulas with that one action.
  • To post as a guest, your comment is unpublished.
    Srini · 3 years ago
    Thank you. Works well with the user defined function... I could do what I could not using the default functions of INDIRECT, ADDRESS et al provided. It fell short when I had a range to be input.
  • To post as a guest, your comment is unpublished.
    Craig Nichol · 4 years ago
    Hi your macro works, though im using it to extract a value from another worksheet that I specify in the workbook. Problem is that i'd like it read this value even when this external workbook is closed, however if it is closes eval returns a REF error. Is there a way that eval can be modified to open/display values of files that are not open?

    Thanks:)
    • To post as a guest, your comment is unpublished.
      Didson · 2 years ago
      In order to have values always available extracted from other workbooks even when they are closed, you should implement some power query. I faced this problem a while ago, and it is working perfectly for me now.
      The problem I am having now though is that I want to update several formulas in "daughter" workbooks, by referencing the source in my "mother" workbook, and through power query I managed to get to the point to have all formulas updated in string format in the daughters sheets, however, even by using the Evaluate function, it seems to not work with lists, conditional formating, nor more complex formulas which use many functions or matrix referencing... :(
      I am reeeeally having a hard time trying to find a way to make this work out now from here on forward...
  • To post as a guest, your comment is unpublished.
    Thomas Tanner · 4 years ago
    I applied the macro as described, but I receive "#VALUE" as an output. Any ideas what could've gone wrong?

    Help would be highly appreciated! Thank you.
  • To post as a guest, your comment is unpublished.
    Huseyin · 4 years ago
    i have a question how can i make this text as formula?