SUBTOTAL(101,...) is for an Average, hence the #DIV/0! error for Half Standard ... no entries in the range.

SUBTOTAL(102,...) is a COUNT
SUBTOTAL(109,...) is a SUM

From the Help on the function:

HTML Code: 

I don't really understand your layout or logic so I can't really offer much more help.

Regards, TMS

Regards, TMS