I'm trying to re-arrange the columns in a data using xlookup function. But not sure why the formula not working in second case (when I try to do it for the whole table)
I would like to understand why it is not working... Any other solution to achieve column re-ordering using dynamic array formulas is also welcome.
Use INDEX/MATCH/MATCH instead:
=INDEX(D6:G11,MATCH(C17:C22,C6:C11,0),MATCH(D16:G16,D5:G5,0))
As to why it does not work, the first formula is returning a 1 dimensional array to the outer XLOOKUP, while the second is returning a 2 dimensional array which the xlookup does not know how to handle.
Index is made to take two one dimensional arrays, one vertical and one horizonatal and return the intersections.