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.

Excel formula: XLOOKUP with multiple criteria

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….

Excel formula: XLOOKUP with logical criteria

Excel formula: XLOOKUP lookup left

Excel formula: XLOOKUP two-way exact match

Excel XLOOKUP function