I believe the correct total should be 14367 (exclude 1 & 18 from bottom data set given existence of 1 in upper data set).

Irrespective of the above the existing formula still fails to calculate correctly and this is related to an earlier point where the implication was that the upper data set contained zeroes which should be excluded when determining set to calculate... hence my point below re: revision to COUNTIF:

Quote Originally Posted by D.O
The above assumes G27:G60 will only ever contain numerics
In your latest sample the above is not reality ergo the COUNTIF generates an incorrect value... if you change <>0 to >0 then you will find you generate 14367. At this stage I think you need to be fairly clear in terms of requirements.

I would also add that given the multiple of Arrays in your lower dataset this model will perform very poorly in terms of calculation time.