I would like to perform a looping IF statement across a range of cells and then add the results together without having to write it out manually 40+ times over in the one cell, like below:

=IF(AND(F17=N4,G17=5),H17,0)+IF(AND(F18=N4,G18=5),H18,0)+IF(AND(F19=N4,G19=5),H19,0)...

All help is greatly appreciated.