Forum Discussion
Prevent Name Manager From Duplicating LAMBDA Formulas
I haven't seen any such behaviour. The workbook-scoped names defining Lambda functions remain unaltered whilst the Range references spawn sheet-local copies.
Perhaps a more detailed example that we can replicate would be in order.
Just checked with your sheet. It does occur too. It doesn't happen when I add a sheet, but when I duplicate one. Make a copy of any of the sheets and then check the name manager. All of the lambda formulas get duplicated with the scope defined to the new sheet.
PeterBartholomew1
- PeterBartholomew1Jan 06, 2023Silver Contributor
The story gets more complicated. I created the Lambdas first and then made the sheet copy and added a new blank sheet without problem. Yet when you do the same, the results are different!
I had wondered whether it could because your Lambdas made explicit reference to worksheet ranges rather than as parameters but that doesn't seem to hold water as a theory.
- Dylan1GJan 06, 2023Copper ContributorBizarre! I was thinking the same, but realized all of my formulas specified tables. Also, getting different results doing the same exact thing of you is super strange. Anyone I should reach out to?
- PeterBartholomew1Jan 06, 2023Silver Contributor
That might be it. If your Lambdas have in-built references to Tables, each time you copy the sheet, you will generate new tables and hence a new copy of any Lambda function that works off the new Tables.
If that is the case then you could avoid the issue by ensuring that all references appear explicitly as arguments of the Lambda function rather than within its formula. A useful technique is to use
= LAMBDA(table, LAMBDA(parameters, Calculation involving table and parameters ) )(Table1)(paramVal)
If you named the Lambdas, the Lambda that has the Table as a required argument should not replicate.