# How Many Parts Should I Measure? Sample Size for a Mean

> Source: https://netray.co/tools/inspection-sample-size-to-estimate-mean-calculator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Find the number of pieces to measure so the lot average is known within a given margin at a chosen confidence level.

## Category

quality

## Audience

- Quality engineer
- Metrology technician
- Incoming inspector

## Tool

**Kind:** calculator

**Inputs:**

#### Confidence level

**Key:** conf

**Type:** select

**Default:** 0.95

**Options:**

##### 90%

**Value:** 0.9

##### 95%

**Value:** 0.95

##### 99%

**Value:** 0.99

#### Process standard deviation sigma

**Key:** sigma

**Type:** number

**Default:** 0.012

**Min:** 0.000001

**Step:** 0.001

**Unit:** mm

**Help:** From past data or a pilot run.

#### Allowed margin of error E

**Key:** e

**Type:** number

**Default:** 0.004

**Min:** 0.000001

**Step:** 0.0005

**Unit:** mm

**Help:** How close to the true lot mean you need to be (plus or minus).

#### Lot size N

**Key:** lot_size

**Type:** number

**Default:** 2000

**Min:** 1

**Step:** 100

**Unit:** units

**Outputs:**

#### Z value

**Key:** z

**Expr:** normsinv(1 - (1 - conf) / 2)

**Format:** decimal

#### Sample size, infinite lot

**Key:** n_raw

**Expr:** pow(z * sigma / e, 2)

**Format:** decimal

#### Sample size with finite lot correction

**Key:** n_adj

**Expr:** n_raw / (1 + (n_raw - 1) / lot_size)

**Format:** decimal

#### Pieces to measure

**Key:** n_final

**Expr:** min(lot_size, ceil(n_adj))

**Format:** integer

**Primary:** true

**Description:** Round up and never exceed the lot.

#### Share of lot measured

**Key:** frac

**Expr:** n_final / lot_size * 100

**Format:** percent

**Chart:**

#### Pieces to measure vs allowed margin of error

**Type:** line

**X:** e

**From:** 0.001

**To:** 0.01

**Steps:** 40

**Series:**

- n_final

**Disclaimer:** Assumes roughly normal measurements and a known sigma. If sigma is estimated from a small pilot, add a safety margin.

## Content

**Intro:** Nobody wants to measure more parts than necessary, but measuring too few gives an average you cannot trust. The classic formula n = (z x sigma / E) squared answers the question directly, and this tool adds the lot size correction and a chart so you can trade precision for effort.

**Sections:**

#### How to use it

**Body:** Pick the confidence level, enter the process standard deviation, and decide the margin of error: how close to the true lot average you need to be. Enter the lot size. The result is the number of parts to measure. Halving E roughly quadruples n, which the chart makes plain, so be realistic about the precision you really need.

**Bullets:**

- Use sigma from a control chart or capability study, not tolerance divided by six.
- Set E well above the repeatability of your gauge.
- For tiny lots the correction can cut the sample sharply.

#### The formula

**Body:** For a normal process, the margin of error on a mean is E = z x sigma / sqrt(n). Solving gives n = (z x sigma / E) squared, with z = 1.645, 1.96 or 2.576 for 90, 95 and 99 percent confidence. When the sample is a large share of the lot, the finite population correction n' = n / (1 + (n - 1) / N) lowers the requirement. The tool always rounds up.

#### Worked example

**Body:** With sigma = 0.012 mm, E = 0.004 mm and 95 percent confidence, z = 1.96 and n = (1.96 x 3) squared, which is about 34.6. In a lot of 2000 the correction brings it to about 34, so you round up to 35 parts. At E = 0.002 mm you would need about 138. Moving to 99 percent at the original E raises the need to roughly 60. Use the chart to find the knee where extra precision stops being worth the measuring time.

#### Common mistakes

**Body:** Using the tolerance instead of the actual process sigma overstates the sample. Ignoring gauge variation is worse: if your measurement error is bigger than E, no sample size will deliver the precision you want. Finally, this estimates the average only. To control the spread or the fraction out of tolerance you need other methods such as variables sampling or a capability study.

**Cta:** We can help set up automatic sample size rules inside your ERP inspection plans so inspectors get the right count for each characteristic. Ask for a quick review.

**Faq:**

#### What sigma should I use?

**Answer:** Use the standard deviation from a recent stable process, such as a control chart or a capability study. If you have no data, measure a pilot sample of about 20 and use that, then add some margin because small samples understate spread.

#### Why does the sample get so big for small E?

**Answer:** Because n scales with one over E squared. Doubling the precision needs four times the measurements. This is a property of statistics, not a flaw in the tool.

#### Is this the same as an AQL sample size?

**Answer:** No. An AQL plan decides lot acceptance from the number of defectives. This tool sizes a sample to estimate an average. Different questions, different formulas.

#### What if my data are not normal?

**Answer:** With n above about 30 the average is still close to normal for most shapes, so the formula is a fair guide. For strongly skewed data or small samples, transform the data or use a larger sample.

## Search terms

sample size to estimate mean, how many parts to measure, sample size calculator inspection, margin of error sample size, finite population correction sample size, measurement sample size confidence, n = (z sigma / E)^2, how many samples for first article

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
