You need to use the array formula for this.
And the formula is:
=MAX(IF(A2=F2:F6;H2:H6;""))
BUT you will need to apply it as a ARRAY FORMULA, so when you enter the above formula:
Push the ctrl + shift as you hit the enter button. And the formula will be shown as:
{=MAX(IF(A2=F2:F6;H2:H6;""))}
And if you have two sheets, the formula will be
=MAX(IF(Sheet1!A2=Sheet2!A2:A6;Sheet2!C2:C6;""))
(Remember to enter F2 and hold down ctrl + shift and then hit enter button and it will be an array formula as: {=MAX(IF(Sheet1!A2=Sheet2!A2:A6;Sheet2!C2:C6;""))}