Forum Discussion
Formula repeating LAMBDA/MAKEARRAY a result
- Feb 27, 2024
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)
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)
Thank you for your answer.
I'm going to go to bed less stupid 😁
For my other problem, I solved it by using an INDEX function instead of CHOOSECOLS.
I apply a matrix {1,2} for exemple with SEQUENCE to the row argument.