Try this:
=SUM(IF(AND(H39<=38,H39>=20),1,0),...
If so then maybe this is what you're after.
=SUMPRODUCT((A1<=38)*(A1>={20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39}))*5.38
You might substitute an INDEX() formula for A1 in the formula above to alter the row you are viewing using a number in another cell, such as in cell B1.