You might have realised that if you put 'zzz' in cell G11, then in cell E3 you put:
Code:
=INDEX($G$3:$G$11,MAX(IF($A$3:$A$18=$A3,IFERROR(MATCH($B$3:$B$18,$F$3:$F$10,0),9))))
and copy down it will give you the same result.
What's more, if you then edit the formula, select the
$G$3:$G$11 part and press
F9 on the keyboard, then select the
$F$3:$F$10 bit and press
F9 on that too you'll get a formula remarkably like the one in cell D3 (bar semicolons instead of commas).