However, you could also use theLAMBDA functionto create a custom function to combine ranges.
It’s a good example of how the LAMBDA function andLET functionwork well together.
Inside the LET function, the first six lines of code simply assign values to variables.
Once values are assigned, these variables drive the output of the function.
Ifcolindexis less than or equal to the count of the columns inrange1(2),INDEXfetches columns fromrange1.
If thecolindexis greater than 2, INDEX fetches columns fromrange2.
In both cases,rowindexis used to retrieve rows.
LET Function
The Excel LET function lets you define named variables in a formula.
you could use INDEX to retrieve individual values, or entire rows and columns.
The array can be one dimensional, or two-dimensional, determined byrowsandcolumnsarguments.