If I understand your question, I think a regular expression search might do the trick. In the replace dialog, check the box for regular expression and search within formulas.
Try searching for: (Count.*)\).*(Count.\*)\\).*
And replace with: if($1 = 0), "", $1)/7)if($1 = 0), "", $1)/7)
I think that should do it.