Forum Discussion

Hecatonchire's avatar
Hecatonchire
Iron Contributor
Feb 27, 2024
Solved

Formula repeating LAMBDA/MAKEARRAY a result

Hello everyone,   Could you explain to me the difference in results between these 2 formulas (simplified version).   Formula 1 (works well): =LAMBDA(nbC,nbR,LET(Tab,MAKEARRAY(nbR,nbC,LAMBDA(r,c,...
  • PeterBartholomew1's avatar
    Feb 27, 2024

    Hecatonchire 

    What is happening in 'Formula 2' is that the presence of the array in the IFERROR condition causes the result of CHOOSECOLS(Tab, 2) to broadcast to match the error argument in size.  I think the problem may be that CHOOSECOLS(Tab, 2) is still of TYPE 64 (array) despite it returning only one value.

     

    Using '@' to truncate the supposed array may sort this problem

    =LAMBDA(nbC, nbR,
        LET(
            Tab, MAKEARRAY(nbR, nbC, LAMBDA(r, c, c & "-" & r)),
            IFERROR(@CHOOSECOLS(Tab, 2), Tab)
        )
    )(6, 1)

     

Resources