In a textbook I read that if $G$ is a global symmetry of the classical Lagrangian, then one has to check $G\times H^2$ anomalies, where $H$ is one of the SM gauge groups.
For example, when $G$ refers to the Baryon number $B$, the contribution of the $SU(2)$ gauge fields is verified by:
$$ SU(2)^2\times B= 2\times 3\times B $$
where only LH fields contribute and the coefficients 2 and 3 come from the dimension of the representation. This shows that $B$ is anomalous, while $B-L$ is not. I therefore wonder if this procedure was applicable to any global symmetry for which the charge value is different for each of the doublet components. As an example I took the electrical charge and the same control gives:
$$ SU(2)^2 \times Q = (-1+0) + 3\times (\frac{2}{3} - \frac{1}{3}) = 0$$
where I make the coefficient 2 disappear to take into account each charge of the doublet. Thus, the $G = Q$ global symmetry is non-anomalous as expected. Likewise for the mixed anomalies $G\times SU(3)^2$ and $G\times Y^2$ which vanish if $G = Q$.
Is this procedure correct for any global symmetry for which the charge is different for each of the doublet components?
Now if a global symmetry $G$ passes gauge anomaly checks, does this automatically imply that $G$ (like $B-L$) is a gauge symmetry in a theory beyond SM, or is it only a hint that it could be a gauge symmetry?