Margin of Error (E) is the error that can be tolerated when estimating a value.
For confidence intervals, it is calculated as the critical value multiplied by the standard error -
E = Crit Val * Std Err
First, you look up the critical value from the probability table (t or z), then you calculate the standard error. Multiply these together.
Margin of Error tells you how much 'cushion' to place on your estimated value.
This cushion will be larger or smaller depending on the critical value that the researcher has chosen.
However, to determine sample size (n), the margin of error is chosen, not calculated.
For example, a buyer wants to know the sample size needed to estimate the average cost of shoes. He needs the estimate to be within ten dollars of the true population mean.
In this case, you will use E=10 in the formula for solving sample size.