Calculating Margin of Error

The margin of error (MOE) for a survey tells you how near you can expect the survey results to be to the correct population value. It assesses the precision of a survey’s estimates. This is immensely useful and necessary for quality assurance.
A smaller margin of error suggests that the survey’s results will tend to be close to the correct values.
The formula for the margin of error is calculated by multiplying a critical factor (for a certain confidence level, this is the Z-Value) with the population standard deviation. Then the result is divided by the square root of the number of observations in the sample.


  • Z is the z-value, which corresponds to the desired confidence level (for example, 1.96 for a 95% confidence level).
  • σ is the population standard deviation
  • n is the sample size

Consider a tiny dataset of 5 values: 2, 4, 7, 8, 10. We’ll calculate the margin of error for this dataset at a 95% confidence level.

Using the above formula, we find the sample size=5, standard deviation=3.1193744, and mean=6.2 (in Excel, you can use functions such as COUNT, STDEV.S, AVERAGE to get these values easily).

Next, we need to find the Z value for a 95% confidence level (NOTE this is NOT z-score, which is for finding how far a datapoint is from Mean). We see from the table that it is 1.96. So, we can now calculate the margin of error (MOE), which is=2.8. This is aka critical value.

Therefore, we can say with 95% confidence that the values from an entire population would be between 3.4 (=Mean – MOE) and 9 (=Mean + MOE). Visualizing this would be this:

Let’s do another one as a practice. Consider this small dataset of some canned good (soup, vegetable, broth, etc.) by weight in ounces that we pulled from the production line at random to measure where they are advertised as 16 oz when sold.

As before, we compute the necessary arguments and find that sample size is 5, mean is 15.88. But this time, we want 99% confidence level (instead of 95%), so our critical value (Z-Value) is 2.58.

Therefore, we can say with 99% confidence that the values from an entire population (based on this limited sample test measurements) would be between 15.6 (=Mean – MOE) and 16.2 (=Mean + MOE). Visually, it looks like this:

You can now obviously see numerous uses of this: whether it’s weight, volume, length, diameter, height, weight, dosage of medicine, etc. Understanding the margin of error with a specific confidence level not only ensure accuracy and continous improvement, it also provides protection for liability (false advertising, or worse!). I hope this was informative and interesting.

Related Posts:

Interested in creating programmable, cool electronic gadgets? Give my newest book on Arduino a try: Hello Arduino!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top