You can build a p chart template in Excel without any add-in: put your sample sizes and defect counts in two columns, add one calculated column for the proportion defective, then insert a line chart with the control limits plotted as constant lines. The catch most people hit is that a p chart's control limits change when sample sizes differ, so the template needs a third calculated column for the per-sample upper and lower limits, not a single pair of numbers. Once that is set up, the chart updates itself as you paste in new data. The steps below are written for desktop Excel; the same formulas work in Excel on the web, but chart formatting options are more limited there and slightly different between versions.
What You'll Need
- Excel for desktop (Windows or Mac) or Excel on the web. Any recent version works; menu labels can differ slightly by version and platform.
- Your data in columns: an inspection period or date, the number of units checked, and the number of defective units found.
- At least 20 samples, and preferably 25 or more, with roughly 50 or more units per sample. Small samples make the limits too wide to be useful.
- A consistent definition of "defective" written down somewhere, because the chart is meaningless if the criterion changes partway through.
Step-by-Step
- Lay out the data sheet. Put headers in row 1:
A1= Date,B1= n (units inspected),C1= Defectives. Enter your rows from row 2 down. Keep units in each row whole and positive. - Calculate the proportion defective. In
D1typep, and inD2enter=IF(B2>0,C2/B2,""). Copy down. An empty cell is better than an error when a sample size is missing. - Find the centre line. In a spare cell, say
G2, enter=SUM(C2:C101)/SUM(B2:B101). This is the weighted overall proportion, p-bar. Use the same row range as your data. Do not useAVERAGE(D2:D101)— averaging the proportions gives a different, wrong centre line when sample sizes differ. - Add the per-sample limits. In
E1type UCL and inF1type LCL. InE2enter=$G$2+3*SQRT($G$2*(1-$G$2)/B2)and inF2enter=$G$2-3*SQRT($G$2*(1-$G$2)/B2). Copy both down. Where the lower limit comes out negative, replace it with 0 or simply accept that the chart line dips below zero — Excel will plot it, but a negative count of defectives is impossible, so most people set it to 0.If your sample sizes are all identical, you can skip the per-sample columns and use one flat pair of numbers instead, which makes a cleaner chart.
- Insert the chart. Select the Date column, hold Ctrl (Cmd on Mac) and select the p column plus the UCL and LCL columns. Go to Insert > Charts and choose a Line chart, then the option with markers. If Excel puts the wrong series on the horizontal axis, right-click the chart, choose Select Data, and set your date or sample column as Horizontal (Category) Axis Labels.
- Add the centre line to the chart. The easiest route is a helper column: in
G1put the centre line formula result beside each row (for example=$G$2copied down) and add that column as a fourth series. Select the series, then right-click and choose Format Data Series to set the line to a darker colour with no markers. - Format the limits distinctly. Set UCL and LCL to a dashed red line with no markers, and the p series to a solid blue line with small round markers. Readers should never have to guess which line is the data.
- Fix the axis. Right-click the vertical axis, choose Format Axis, set Minimum to 0 and a Maximum slightly above your highest UCL so the limits are not cut off. Set the number format to Percentage if you prefer to read proportions as percentages.
- Add a title and labels. Click the chart title and type something specific, such as "Proportion Defective — Line 3 Final Inspection." Add an axis title for the vertical axis reading "Proportion defective."
- Save it as a template. Delete the data rows but keep the header row, formulas in row 2 and the chart, then save the workbook as your p chart template file. Next month, paste new values into columns A to C and drag row 2's formulas down to match the new row count.
Common Mistakes
Averaging the proportions. This is the single most common error. The centre line must be total defectives divided by total inspected. Averaging row percentages overweights small samples.
Using one flat limit pair with variable sample sizes. If one week you inspect 40 units and the next 400, the limits must move. A static UCL makes small samples look like out-of-control events when they are not.
Plotting counts instead of proportions. A chart of the number of defectives rises and falls with sample size. Always divide by the number inspected unless every sample is identical in size — and even then, say so on the chart.
Flagging a point as out of control when it sits on the limit. A point exactly on the limit is a warning, not proof. Look for a run of points on one side or a trend before acting.
Extending the template without checking row references. Copied formulas with absolute references can quietly lock onto the old data range after you paste in more rows.
Tips
Freeze the header row and turn the range into an Excel Table so formulas fill down automatically when you add rows. Use conditional formatting on the p column to shade rows where p exceeds the UCL, which makes the chart easier to read alongside the numbers. Hide the helper columns once the chart is built; charts still read hidden data if you leave the setting to show data in hidden rows and columns enabled. Keep a separate "notes" column for causes, so when a point breaches a limit you can record what changed that week. Recalculate the centre line every 25 samples or so and treat it as a new baseline, rather than letting one bad month skew the limits forever.
Troubleshooting
Chart shows #DIV/0! or gaps. A sample size of zero or a blank cell is producing an error. Wrap the formulas in IFERROR or fix the source data.
The limits look flat. That happens when sample sizes barely vary, which is normal and fine. Check a couple of values against the formula by hand to confirm.
Points sit outside the chart area. Your axis maximum is too low. Reset it above the highest UCL, or the suspected out-of-control points will vanish off the top.
The wrong column ended up on the axis. Use Select Data and remove then re-add the series with the correct columns.
Numbers changed after copying down. Check for absolute references ($) and confirm the centre line cell is locked while the n reference is not.
If that did not work, rebuild the chart from a fresh blank sheet with five rows of test data. If the small version behaves correctly, the fault is in the data range or a stray formula in the full sheet.
Frequently Asked Questions
What is the difference between a p chart and an np chart?
A p chart plots the proportion defective and works when sample sizes vary. An np chart plots the number defective and assumes a constant sample size.
How many samples do I need before the limits mean anything?
Aim for at least 20 to 25 samples. Fewer than that makes the estimated centre line unreliable.
Can the lower control limit be negative?
Mathematically yes, but a negative proportion is impossible. Most people set it to zero and note it, or leave it and ignore the below-zero portion of the chart.
Do I need an add-in?
No. Built-in formulas and a line chart are enough. Third-party SPC add-ins exist but are not required.
Why does my chart recompute when I paste new data?
Because the formulas reference cells, not fixed numbers. That is the point of the template. Just extend the formulas down to the new last row.
Can I open the template in Excel on the web?
Yes, formulas and charts carry over, though some formatting options are limited compared with desktop Excel.