What is the formula for range of error?

https://en.wikipedia.org/wiki/Margin_of_error

I suspect it is much more complicated than you ever dreamed. Sample size, variance are probability functions, not absolute.