This is the wrong forum if you know in advance you want a programming answer, you should pose those questions in the Programming forum.
Anyway:
Range("G5:G8").FormulaR1C1 = _
"=INDEX(R4C3:R15C3, MATCH(RC[-1]&""-""&RC[1], INDEX(R4C2:R15C2&""-""&R4C4:R15C4, 0), 0))"
With Range("H5")
.FormulaArray = "=MAX(IF(R4C2:R15C2=RC6,R4C[-4]:R15C[-4],""""))"
.AutoFill Destination:=Range("H5:H8")
End With
You can get code like this by just turning on the macro recorder to record you entering the formulas in one cell, then edit out the "selecting".
Bookmarks