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.
- 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.
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:
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:
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.
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:
3. And all your selected text strings have been converted to real formulas and get their values as well. See screenshots:
You are guest
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 3 months agoThank you very much!!! GREAT IDEA!!!
- To post as a guest, your comment is unpublished.· 1 years agoHello
For the first defined function way, I have a problem.
when the resources for concatenate function are in another worksheet, Eval function works properly when that resource worksheet is open, But immediately when I close that resource worksheet, Eval function Not working. How I can change the codes for eval function to use closed resource worksheets?
- To post as a guest, your comment is unpublished.· 3 years agoHello 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.· 3 years agouse indirect only works with open workbooks.
solution is to use indirect.ext from morefunc.
- To post as a guest, your comment is unpublished.· 4 years agoHi Hussein,
Just use the INDIRECT function in Excel. Does the same thing.
- To post as a guest, your comment is unpublished.· 4 years agoGreetings, 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.· 4 years agoThe 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.· 5 years agoTo 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.· 2 years agoHi 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.
- To post as a guest, your comment is unpublished.· 5 years agoI 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.· 5 years agoThank 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.· 6 years agoHi 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?
- To post as a guest, your comment is unpublished.· 4 years agoIn 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.· 6 years agoI 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.· 6 years agoi have a question how can i make this text as formula?