'Using XLOOKUP when dynamically assigning rank to a table does not pull the correct data

The issue I am having is trying to use XLOOKUP on a table column that has been generated using a ranking formula.

Table Image

The Rank column is created using the following formula so that it adjusts dynamically depending on the visible columns (auto-filtering) since RANK.AVG or EQ does not take that into account.

=SUMPRODUCT(SUBTOTAL(3,OFFSET(Table2[[#All],[Sales]],ROW(Table2[[#All],[Sales]])-MIN(ROW(Table2[[#All],[Sales]])),0,1)),--([@Sales]<Table2[[#All],[Sales]]))

The XLOOKUP I am using is simple

=XLOOKUP(1,Table2[Rank], Table2[Rep])

The idea is that the field at the top would show the top ranked performer based on the visible rows. The problem is that when filtering the data, the rank column adjusts as it should, but the XLOOKUP does not function as I would expect. It sticks with the originally ranked 1 or even does something complete weird that I can't explain when running combinations of filters in the region column..

Anyone have any advice how I could better structure this to make it function in the intended manner. Any help at all would be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source