One of the problems with teaching people a bunch of formulas instead of giving practice at how to produce them is that any slight change to the circumstances can make it impossible to see what to do - it's very "brittle" knowledge. But the robust knowledge that comes with having practice deriving the formulas from scratch is if anything easier than memorizing them.
[I don't actually know any of these formulas since they're so simple to derive from scratch, and not often needed in practice. How many times would even an avid experimenter use such a formula in a year?]
The limits of a (sufficiently*) large-sample interval for $\mu$ with known $\sigma$ would written in the form $\bar{x}\pm z_{1-\alpha/2} \sigma/\sqrt{n}$.
For an absolute error type of bound, the bound would be expressed in the form
$z_{1-\alpha/2}\, \sigma/\sqrt{n}\leq a$
from which simple algebraic manipulation - multiply both sides by the positive quantity $\sqrt{n}/a$, giving $\sqrt{n}\geq z\sigma/a$ and since both sides are non-negative, simply square both sides - gives $n\geq \frac{z^2\sigma^2}{a^2}$.
For a "relative error" type of bound, the stated bound would be of the form $z_{1-\alpha/2}\, \sigma/\sqrt{n}\leq k \mu$ for given $k$.
You could then re-arrange exactly as above to get $n\geq \frac{z^2\sigma^2}{k^2\mu^2}$. Alternatively, if you say "let $a=k\mu$" at the start, you have converted it to an absolute error and can simply use the absolute error calculation.
* I imagine you won't have been given any tools for making suitable judgements about this either.