Just turn the table upside down.
Then the first matching item will really be the last item, as you desire.
How to turn it upside down? Well, I don't mean literally do that!!
(Today, in 2021, we'd just use XLOOKUP()
and tell it to look last to first instead of first to last. But read on for a solution that would have worked nicely in 2014. Or 2004 or 1994.)
As you may or may not be aware, the INDEX()
function can reorder columns in the range given to it so that the output has a column that was to the right of another column now on its left. Or let you select only some columns, or use one column more than once. It gives you that same opportunity with the rows. People seldom think about the rows though if they like Stephen Kind, they certainly do consider He Who Walks Behind The Rows...
Anyway, how to reverse the rows? The trick in 2014 for making sure all the rows in a range were present in the result (when one had to when leaving the value blank or "0" did not work, which was basically due to having used special selection for the columns) was to use the value ROW(1:1000)
(if there were a thousand rows in the range). Variations on the theme existed, but they revolved around using calculations to make a string and INDIRECT()
to make that something ROW()
would use. I will show that in the formula that follows, but in 2021 we can just use SEQUENCE()
to make the desired high-to-low sequence needed.
The problem with ROW(1:1000)
being written as ROW(1000:1)
trying to get a sequence going down 1 at a time from 1,000 to 1 (1,000, 999, 998, 997,...3, 2, 1) is that Excel cheerfully takes your "wrong" address range and "helpfully" fixes it for you so that it records as 1:1000, not 1000:1... no matter what you do.
But... you know how many rows there are. You gave INDEX()
a range, so you can figure how many rows. Even if you gave it a Named Range. Since you can, you can add 1 to that value, and then subtract the ROW(1:1000)
that Excel will accept. In this example, it would be 1,000 rows, so you use 1,001 like so:
1001 - ROW(1:1000)
so Excel calculates 1001-1 (1000), 1001-2 (999), 1001-3 (998), and so on. See how you get a reverse sequence?
Use that for the row parameter (second parameter) in your INDEX()
function. Now your table is turned upside down.
Since you did this for the rows, you WILL have to specify the columns as well. Since you just have two columns, use the simple array constant {1,2}
for that as you want them in that order. (Nowadays, you could use a (normal rising) SEQUENCE()
for this as well.)
Now your whole table is reversed and you use this as the second parameter in your VLOOKUP()
, the lookup range.
And the first value found is really the last because with the table reversed, you are looking last to first.