r2d2, we already have subnet calculation routines in UDF lib and in an KiXgolf tournament.

anyway, it is not a bit more reliable as the above code is about bullet proof.
_________________________
!

download KiXnet