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.
As variant with OfficeScript
function main(workbook: ExcelScript.Workbook) {
const cell = workbook
.getActiveWorksheet()
.getRange("string")
cell
.setFormula( cell.getValue().toString() )
}
- AjayGujaySep 26, 2023Copper ContributorHi Sergei, Thanks for the Input, but this is not a static cell where I am trying use this formula this formula is going to be used for around 120+ columns to do. XLOOKUP based on the column header. Which basically reorders my columns from the server to the order which my team needs. Can you help me how this can be made possible with the VBA?
- SergeiBaklanSep 26, 2023Diamond Contributor
"...but this is not a static cell where I am trying use this formula this formula is going to be used for around 120+ columns to do..."
In general that's doable with OfficeScript, the only exact logic to be defined from which cells to take texts of formulae and to which cell to populate formulae itself.
Above sample was only to illustrate an idea.
- PeterBartholomew1Sep 26, 2023Silver Contributor
Looks pretty understandable. Since I do not have access to Office Script, I tried typing into a Script Lab code window but it showed ExcelScript as an unknown namespace. 😞
- SergeiBaklanSep 26, 2023Diamond Contributor
ScriptLab has bit different interface. Not sure how exactly to run above in it, never used ScriptLab, only read about.
Know no reasons why Microsoft doesn't make OfficeScript available for consumers, at least on some subscriptions.
- PeterBartholomew1Sep 26, 2023Silver ContributorOne of the strengths of Excel is its universality. I have doubts about committing serious effort to getting up to speed on a topic if I cannot communicate it to others and, worse, I may in due course lose access to my own work!