Guide to Computing Margins of Error for Percentages and Means
In this guide, the phrase "margin of error" is equivalent to "two standard errors" or "a 95% confidence level."  The textbook explains what this means.
First, determine if you need the margin of error for a mean score or for a percentage. If it is a mean score (an average of a continuous variable, e.g., income in dollars, test score points, pounds, inches, etc.), skip to the end of the page and use Formula Four.
If you are dealing with percentages, you must choose among three formulas depending on the information given and requested in the question (if you are not told that it is a mean or average, assume that percentages will be computed):
1. y ou are told only the size of the sample and are asked to provide the margin of error for percentages which are not (yet) known.  This is typically the case when you are computing the margin of error for a survey which is going to be conducted in the future.  It is also useful for getting a general "ballpark" figure for a sample as a whole.  In this case, you use Formula One.
2. You are given a percentage result, e.g., 65% voted for Candidate Blowhard.  In this case you use Formula Two.
3. You are told the margin of error which is acceptable, and asked to compute the sample size.  In this case you use Formula Three. If not told otherwise, assume that any question which asks for a sample size wants a margin of error for percentages.
Formula One:  This is the easy one, you should try to learn to use it in your head: M = 1/SQRT(N).  Caution:  N refers to the sample which answered the question at hand, e.g., if you are asked for the margin of error for the Hispanic respondents, N refers to the number of Hispanics in the sample. The answers will be in proportions, to get percents move the decimal point two digits to the right.  The confidence interval is + or - M.  Thus if M = .04, the confidence interval is +/- 4%.
Formula Two: In this formula, "p" refers to the proportion (not the percentage) giving a certain answer to a question.  For example, if 65% voted for Blowhard, p = .65.  N, as always, refers to the sample which answered the question at hand.    M =  2 * SQRT((p * (1-p))/N). You must do this calculation in the proper order.  First determine p and 1-p.  If p = .65, for example, 1-p means 1-.65 or .35.   Then multiply p times 1-p, divide the result by N, take the square root and multiply the result by 2 (or 1.96 if you are a perfectionist).  This is best done as a chain calculation in your calculator, without writing any of the intermediate steps down.  To get confidence intervals, take p and add M to get the upper bound, subtract M to get the lower bound.  It is conventional to use percentages in reporting the confidence interval.
Formula Three: This formula is used whenever you are asked to compute how large a sample will be needed.  The unexpected thing here is that the size of the population does not matter!   All that matters is how much error you can tolerate.  Take the margin of error you can tolerate, e.g., 4%, and convert it to a proportion, e.g., .04.  This is your "M".  Then use the formula  N = 1/(M*M). Just multiply M by itself (square it) and divide the result into 1 (also called taking the reciprocal). Caution:  In this formula, "N" refers to the number of respondents who will answer the question you will ask or who will be used to compute the statistics you need.  Thus, if you need a result for the residents of Camden County, N refers to the number of Camden County residents you must sample.  If you need a 5% margin of error for each of five counties, the total sample size must be 5 * N.
Formula Four for Mean Scores:  If you need a margin of error for a mean score (an average such as income in dollars or scores on a test), you need to know the standard deviation (sd) and the sample size (N). Ignore any other information you are given, including the size of the population.
Use the following formula: M = 2 * sd / SQRT(N)
In this formula    "*" means multiply.    "/"  means divide.   "SQRT" means take the square root.
To get the confidence interval, add M to the mean to get the upper bound and subtract M from the mean to get the lower bound.
Caution:  Your results in this case are not in proportions.  They are in whatever unit the mean score was measured in,.e.g, dollars, inches, pounds, test score points, etc.  Your answer will be marked wrong if you convert the results for a mean score to percents.