Why does non-recursive LAMBDA/LET slow things down?

adamdom

New Member
Joined
Sep 24, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all! Hopeful that you can help me speed up some of my formulas. I'm building a chain of LAMBDA functions and the most recent one is running really slowly and I can't figure out why because if I run the exact same formula just filling in the variables, it runs instantly. Details below:

Runs slowly (2+ minutes): LAMBDA(x,BYROW(x,LAMBDA(r,IFERROR(MATCH(TRUE,ARR_Row_Detail(x,ROW(r)-1)<>0,0),-1)))) <- passing in ARR_Grid_Full_Detail for x
Runs slowly (2+ minutes): LET(x,ARR_Grid_Full_Detail,BYROW(x,LAMBDA(r,IFERROR(MATCH(TRUE,ARR_Row_Detail(x,ROW(r)-1)<>0,0),-1))))
Runs instantly: LET(x,ARR_Grid_Full_Detail,BYROW(x,LAMBDA(r,IFERROR(MATCH(TRUE,ARR_Row_Detail(ARR_Grid_Full_Detail,ROW(r)-1)<>0,0),-1))))

For context this is running on ~9000 rows so I understand why calc times could build up in general but I dont understand why doing the function one way runs instantly (< 2 seconds) and when I just pass in the variable to a lambda it takes forever.

Other definitions in name manager in case helpful (all run instantly and do exactly what I want):
ARR_Row_Detail: =LAMBDA(grid,row,OFFSET(grid,row-1,0,1,num_dates))
num_dates: 31
ARR_Grid_Full_Detail: =OFFSET('Raw Data'!$A$1,1,MATCH(MIN('Raw Data'!$1:$1),'Raw Data'!$1:$1,0)-1,COUNT('Raw Data'!$G:$G)-1,MATCH(MAX('Raw Data'!$1:$1),'Raw Data'!$1:$1,0)-MATCH(MIN('Raw Data'!$1:$1),'Raw Data'!$1:$1,0)+1) <- basically just returns a grid (~9000 x 31) that I am looking for.

Happy to answer questions and thanks in advance!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top