You can build a free p chart template in Excel by setting up four columns (sample ID, sample size, defectives, and proportion defective), calculating the average proportion and control limits with formulas, and then plotting the proportions with the control limits as reference lines. A p chart is a control chart for the proportion of defective items in samples of varying or constant size, and Excel's built-in charting and formulas are enough to produce one without paid add-ins.

This guide walks through a manual template you can save and reuse. The steps are written for Excel on Windows and Mac; labels can differ slightly by version and region, but the formulas and chart types are the same.

What You'll Need

  • Excel (Microsoft 365, Excel 2019 or later recommended) on Windows or Mac. The web version also works, but chart formatting options are more limited.
  • At least 20–25 samples of data, each with a sample size and a count of defective items. Fewer than about 20 samples makes the control limits unreliable.
  • Basic familiarity with entering formulas and selecting ranges.
  • Optional: a separate column for the sample's inspection date or batch number so the chart is readable.

Step-by-Step

  1. Set up the data columns. In a new sheet, put headers in row 1: A1 = Sample, B1 = Sample Size (n), C1 = Defectives (np), D1 = Proportion (p). Enter your sample IDs in column A, the number inspected in column B, and the number found defective in column C, starting at row 2.
  2. Calculate the proportion defective. In D2, enter =IF(B2=0,"",C2/B2). Copy the formula down to the last row of data. Format column D as a percentage or a decimal with 3–4 places. If any sample size is zero, the formula returns blank instead of a divide error.
  3. Calculate the average proportion (p-bar). In an empty cell, for example F2, enter =SUM(C2:C26)/SUM(B2:B26). This weights each sample by its size, which is correct when sample sizes vary. Label the cell "p-bar" in E2. If every sample is the same size, =AVERAGE(D2:D26) gives the same result.
  4. Calculate the control limits. In F3, enter the upper control limit formula =F2+3*SQRT(F2*(1-F2)/B2) and in F4 the lower control limit =MAX(0,F2-3*SQRT(F2*(1-F2)/B2)). These use the sample size in B2. If sample sizes vary, copy the UCL and LCL formulas down a helper column next to each row so each sample gets its own limits. The MAX function stops the lower limit from going below zero, which is not meaningful for a proportion.
  5. Add the limits to the data table for charting. In E1 and F1 (or new columns), create headers "UCL" and "LCL". In E2 enter =$F$3 and in F2 enter =$F$4 for constant sample sizes, then copy down. For varying sample sizes, reference the row-specific limit cells instead. Also add a column for p-bar with the value =$F$2 copied down.
  6. Insert the chart. Select the Sample column, the Proportion column, and the UCL, LCL and p-bar columns (hold Ctrl or Cmd to select non-adjacent ranges). Go to Insert > Charts and choose a Line chart with markers. If Excel plots the wrong series, right-click the chart and use Select Data to assign Sample as the horizontal axis labels and the proportion and limit columns as series.
  7. Format the control limits. Right-click the UCL series, choose Format Data Series, and set a solid line with no markers. Repeat for LCL and p-bar, using a dashed line for p-bar. This makes the actual proportions stand out from the limits.
  8. Add axis titles and a chart title. Use Chart Elements (the plus sign next to the chart) to add Axis Titles. Label the vertical axis "Proportion defective" and the horizontal axis "Sample". Give the chart a title such as "p Chart – Proportion Defective".
  9. Check for out-of-control points. Any proportion above the UCL or below the LCL signals a special cause. Also look for runs of seven or more points on one side of p-bar, or a steady upward or downward trend; these are common run rules and suggest a shift even when no point is outside the limits.
  10. Save as a reusable template. Delete the data but keep the formulas and chart, then use File > Save As and choose Excel Template (.xltx). Next time, open the template, paste new data into columns A–C, and the formulas and chart update automatically.

Common Mistakes

  • Using an unweighted average when sample sizes differ. Averaging the proportions directly gives too much weight to small samples. Use total defectives divided by total inspected.
  • Applying one set of limits to varying sample sizes. The control limits depend on n, so each sample needs its own UCL and LCL when n changes.
  • Leaving the lower limit negative. A negative proportion is impossible; wrap the LCL in MAX(0, …).
  • Including too few samples. Limits from fewer than about 20 samples are unstable and produce false alarms.
  • Plotting counts instead of proportions. A p chart plots the proportion defective; counts belong on an np chart.
  • Forgetting to sort samples in time order. The chart's run rules only make sense if samples are in the order they were produced.

Tips

  • Keep sample sizes roughly equal where possible; it simplifies the limits and makes the chart easier to interpret.
  • Use conditional formatting on the proportion column to highlight values above the UCL or below the LCL in red.
  • Add a data validation rule to column C so defectives cannot exceed the sample size in column B.
  • Name the ranges (Formulas > Define Name) so formulas read clearly, for example =SUM(Defectives)/SUM(SampleSizes).
  • Freeze the header row so labels stay visible as you paste new data.
  • Recompute p-bar and the limits whenever you add a new block of samples; do not mix data from different processes.

Troubleshooting

  • The chart shows a flat line or wrong values. Check that the proportion column contains formulas, not text, and that blank rows are truly empty. Select Data and confirm each series points to the right column.
  • #DIV/0! errors appear. A sample size of zero is being divided into. The IF wrapper in step 2 prevents this; if you removed it, restore it.
  • The control limits look too wide or too narrow. Confirm you used the weighted p-bar and that the sample size in the limit formula matches the actual n for that row.
  • The chart does not update after pasting new data. The chart range may be fixed. Right-click the chart, choose Select Data, and extend the range to cover the new rows, or convert the data to an Excel Table (Insert > Table) so the chart expands automatically.
  • Points fall outside the limits constantly. The process may genuinely be out of control, or the samples may come from different processes or time periods. Plot them separately before concluding there is a problem.
  • The template opens with old data. Save the template with formulas but no data rows, and keep a separate working copy for each project.

Frequently Asked Questions

What is the difference between a p chart and an np chart?

A p chart plots the proportion defective and works with varying sample sizes. An np chart plots the number defective and requires a constant sample size.

Can I make a p chart in Excel for free?

Yes. Excel's formulas and standard line chart are enough; no paid statistical add-in is required.

How many samples do I need?

Aim for at least 20–25 samples so the control limits are stable. More samples give more reliable limits.

Why does my lower control limit show zero?

When p-bar is small or samples are small, the calculated lower limit can be negative. The MAX(0, …) formula sets it to zero, which is the correct floor for a proportion.

Can I use a p chart for varying sample sizes?

Yes, that is its main advantage. Calculate a separate UCL and LCL for each sample using that sample's size.

Does the template work in Excel for the web?

The formulas work, but chart formatting and template saving are more limited in the web version. Use the desktop app for full control.