Calculates the amount of random sampling error given a range of values and a confidence level. Learn more
In Google Sheets, the MARGINOFERROR(range, confidence) function calculates the margin of error for a sample range of data, given a specified confidence level.
The margin of error is a measure of the uncertainty or potential variability in the sample data.
The function takes two arguments:
range: This is the range of cells containing the sample data for which you want to calculate the margin of error. It can be a single column or row, or a rectangular range.
confidence: This is the confidence level at which you want to calculate the margin of error. It is expressed as a decimal value between 0 and 1. For example, a confidence level of 0.95 represents a 95% confidence level.
The MARGINOFERROR function in Google Sheets uses the following formula to calculate the margin of error:
MARGINOFERROR(range, confidence) = CONFIDENCE(confidence, STDEVP(range), COUNT(range))
Here, STDEVP calculates the standard deviation of the sample range, and COUNT counts the number of data points in the range.
The CONFIDENCE function then uses the standard deviation and sample size to determine the margin of error at the specified confidence level.
Note that the MARGINOFERROR function assumes a normal distribution of the data in the range and is typically used for calculating the margin of error for a sample mean.