A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
There appears to be a memory leak in Excel when using LAMBDA function. I have a spreadsheet with a table named BasData containing 4,000 rows of data, about 10 columns. Nothing unusual, just a list of expenses and their categorizations.
Operating on that set of data I have about 20 FILTER formulas using MAP with LAMBDA to get a "spill"-type lists with specific things I am looking for in the data set.
In my case, I get immediate "out of resources" error soon after I open the spreadsheet and add a few rows of data or do a simple addition in the cell. I suspected LAMBDA being the cause. So, I then went through all the MAP+LAMBDA functions and redesigned them using the traditional MAP without LAMBDA. The problem went completely away.
Example (causing errors, all other formulas are very similar):
=FILTER(BasData[Amount],
MAP(BasData[Category],
BasData[Keyword],
LAMBDA(cat, key,
(cat="Foo Bar")\*(key=G71))))
Example or "traditional" solution not using LAMBDA that fixed the problem:
=FILTER(BasData[Amount],
(BasData[Category]="Foo Bar")\*(BasData[Keyword]=G71))
There should be no difference in the outcome of these two functions as they perform identically.
LAMBDA appears to be the root cause here, and given that the error happens when it operates on the whole table of data it is likely due to some memory leak that grows with the invocation of the LAMBDA on every row.