Hi Patric,
This formula works for your example but may not for a larger sample of data:
Formula:
=IFNA(INDEX($B$3:$B$5,MATCH(RIGHT(D3,4),RIGHT($B$3:$B$5,4),0)),INDEX($B$3:$B$5,MATCH(MID(D3,3,4),MID($B$3:$B$5,1,4),0)))
See it in the attached:
Index Match Right or Mid.xlsx
Bookmarks