Example where it will not work is $(\frac{A}{B})^m = n$. Set $A=B=1$ and then solve for $m$. And example where it will work is:
$(E/c)^2 = p^2+ (mc)^2$. You can drop $c$ and put it back later by dimensional analysis. What is so special with equations in Physics why it always work?