|Your IF statement is incorrect. It is causing a circular reference which is confusing Excel.|
Since it can't figure out what to do in the cells with the incorrect formulae, it gives you a 0 answer when you try to sum all the "mistakes".
Your IF Statement should read:
When you use L5=0 as your "condition if false", you are actually telling Excel to test and see if L5=0 if K5 <= 40. It can't do because it is trying to evaluate the IF statement in L5. Take your IF statement and put in any other cell, and you'll get TRUE or FALSE based on whatever is in L5 if K5 is not greater than 40.
By the way, if all you want is the total number of overtime hours, and not each individual's OT hours, you could use:
=SUMIF(K5:K16,">40")-COUNTIF(K5:K16,">40")*40 in any cell.