To answer your question of why SUM(IF... counts:
Starting with the IF((D2

9>0)*(D2

9<=36), these two conditional checks
return arrays of 1 and 0 (actually, they return TRUE and FALSE which are
then coerced into 1 and 0 through the multiplication). When multiplied,
these two arrays create one array of 1s and 0s.
So now you have something like IF({1,1,0,1,0,0,0,1}...or whatever the
results would actually be. Each of these elements are evaluated such as
IF(1,1,0), IF(1,1,0), IF(0,1,0), etc. resulting in a further array of 1s and
0s. This final array is then summed, giving results that mimick a
COUNT-type function.
If you want to see this in action select the cell, then go to Tools,Formula
Auditing, Evaluate Formula.