Forum Discussion
AjayGujay
Sep 25, 2023Copper Contributor
Generating an Formula using concatenation in excel
Hi There, I am planning to generate a formula using concatenation operation in excel and it actually works but the only issue is it’s not executing it just gives the generated formula as output i...
- 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.
SergeiBaklan
MVP
As variant with OfficeScript
function main(workbook: ExcelScript.Workbook) {
const cell = workbook
.getActiveWorksheet()
.getRange("string")
cell
.setFormula( cell.getValue().toString() )
}
AjayGujay
Sep 26, 2023Copper Contributor
Hi 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, 2023MVP
"...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.