Forum Discussion
Generating an Formula using concatenation in excel
- Sep 25, 2023
This uses the XLM command EVALUATE within Name Manager where it works correctly just as HansVogelaar 's solution. With 365 the process can be taken a step further and the name can be a Lambda function.
EVALUATEλ = LAMBDA(formula, EVALUATE(formula))
The sole advantage is that EVALUATEλ can be reused with multiple strings.
Let's say your formula is assembled as a text string in cell E2.
Select the cell to the right, i.e. F2.
On the Formulas tab of the ribbon, click Define Name.
In the Name box, enter Eval
In the 'Refers to' box, enter =EVALUATE(E2)
Click OK.
Still in cell F2, enter the formula =Eval
You can use =Eval in other cells directly to the right of a cell with a formula-as-text.
- AjayGujaySep 26, 2023Copper Contributor
HansVogelaar Thanks for the Input Hans… I tried adding =Evaluate(formula) but it didn’t work because excel doesn’t have the evaluate function. Is there any way that I can give you the sample excel for this formula or somewhere we can talk about it?
- PeterBartholomew1Sep 26, 2023Silver Contributor
It does have the EVALUATE function since that pre-dates the introduction of VBA to Office. However, it does not run on a standard worksheet, hence the way it is wrapped within a Name using Name Manager. It may work on a Macro sheet but that is outside my area of knowledge.
- AjayGujaySep 26, 2023Copper ContributorThanks for putting your valuable time on this Peter I will check the work around provided and get back to you in a Private message as well.