In fact you don't need the red part of the formula.
=+INDEX(INDEX('Pay lookup table'!$B$2:$F$101,0,MATCH($G$2,'Pay lookup table'!$B$1:$F$1,0)),MATCH(G40,'Pay lookup table'!$A$2:$A$101,0))
You can use the formula in this way.
=INDEX('Pay lookup table'!$B$2:$F$101,MATCH(G40,'Pay lookup table'!$A$2:$A$101,0),MATCH(G2,'Pay lookup table'!$B$1:$F$1,0))
Bookmarks