Explanation
This formula uses XLOOKUP twice, bynestingone XLOOKUP inside another.
This is the tricky bit.
We are passing in multiple lookup values, so XLOOKUP internally will calculate multiple match positions.
The result is the original lookup result with fields arranged in the new order.
XLOOKUP supports approximate and exact matching, wildcards (* ?)
for partial matches, and lookups in vertical or horizontal ranges….