You can probably replace the entire last condition with 0 since anything other than the conditions that should return non-zeroes have been exhausted... then essentially any other condition should return 0.

e.g.

=IF(ISBLANK(J15),"",IF(G15="DS",(countdaily(I15,J15)),IF(G15="DO",(countdaily(I15,J15)),IF(G15="TH",(countTH(I15,J15)),IF(G15="FM",(countFM(I15,J15)),IF(G15="FS",(countdays(I15,J15)),0))))))