Sometimes, you have a dataset where you will need to perform lookup starting from last cell to first cell rather than usual first cell to last cell. With XLOOKUP function, the task has become easier as it gives a parameter to control this. While default is from first cell to last cell but if you want to perform last cell to first cell lookup, use following formula
=XLOOKUP(D2,A:A,B:B,,,-1)
If you don't have XLOOKUP yet, you can use below formula
=LOOKUP(2, 1/(A2:A20=D2), B2:B20)