Something like this might help you out:
Code:
var tagexist as number
foreach pick in BaseCustSp
if (eachpick.tagis[Custom.Tag] <> 0) then
tagexist += 1
endif
nexteach
tagexist = round(tagexist/3,0,-1)
This should provide a result equal to the number of "groups of three" you are looking for.