Excel does not have a built-in "g chart" type, so you cannot pick one from the Charts menu. A g chart (also written g-chart or G chart) is a rare-event statistical process control chart that counts the number of units inspected between occurrences of a defect or event. You build it in Excel by combining a formula-driven count column with a scatter plot or line chart, which is entirely doable without extra software. The short version: name a starting, baseline stretch of your data, count the inspected units between each recorded event, plot those counts against the event number, then add a centre line and control limits using the g chart formulas.
What You'll Need
- Excel on desktop (Windows or Mac). Building the chart works in Excel for the web too, but the desktop version handles large ranges and scatter formatting more comfortably.
- A data table with one row per inspection or unit, in time order, and a column that flags whether the event occurred (for example a 1/0, Y/N, or defect/no defect column). You can also start from a simple list of row numbers where events happened.
- A rough idea of what counts as normal, so you can set the baseline used to calculate the centre line. This is the average number of units between events when your process is behaving.
- Familiarity with typing formulas and dragging to fill. No add-ins or statistical packages are required.
- Note that menu and ribbon labels can differ slightly between Excel versions, platforms and regions, but the underlying chart tools described here are present in all current versions.
Step-by-Step
- Lay out your data. Put your time-ordered inspection rows in columns A onward. In column A put a sequence number (1, 2, 3...) and in column B put your event flag. A row where the event happened gets a 1; every other row gets a 0. If you already have a list of the row numbers where events occurred, put those numbers in column A and skip the flag column.
- Separate the normal rows from the event rows. The g chart works on the gaps between events, so you need to know where each event sits. Insert a helper column and use a formula like
=IF(B2=1,A2,"")to mark event positions. Filling this down gives you a clean list of event row numbers with blanks everywhere else. - Count the units between events. The gap between one event and the next is the later event's row number minus the earlier event's row number, minus one. If your first event is at row 12 and the next at row 31, the g value is 31 - 12 - 1 = 18 units inspected without an event. Put each gap in its own column, one row per event. Do not include the event row itself in the count, and do not add one to the difference: an off-by-one here is the most common reason a g chart looks wrong.
- Decide whether to count to the start and end of the data. The stretch before your first event and after your last event are incomplete g values. You can either exclude them or use them if they are long, but be consistent. Mixing incomplete and complete gaps distorts the centre line.
- Calculate the average g. The average number of units between events, written
g-bar, is the mean of your gap values. Use=AVERAGE(D2:D50)against your gap column. This becomes the centre line of the chart. - Add the control limits. For a g chart the standard formulas are: lower control limit =
g-bar - 3 * SQRT(g-bar * (g-bar + 1)), and upper control limit =g-bar + 3 * SQRT(g-bar * (g-bar + 1)). Type these into two cells under your average. If the lower limit comes out negative, set it to zero, because a negative count of units is impossible. These two values are the lines you draw on the chart. - Set up the plot data. In two adjacent columns, put the event number (1, 2, 3...) and the matching gap value. Add three more columns filled with the average value, the lower limit and the upper limit, repeated down every row so each line spans the whole chart.
- Insert the chart. Select the event number and gap columns, then go to Insert > Scatter and pick Scatter with Straight Lines and Markers. Straight lines make a step-like pattern that suits rare-event data better than smooth curves.
- Add the centre line and limits as extra series. Right-click the chart, choose Select Data, then Add a series for the average column, a series for the lower limit and a series for the upper limit. Use the event-number column as their X values. Format each as a line with no markers: the centre line often green or grey, the limits red, so they read as thresholds.
- Label the axes. Give the horizontal axis the title "Event number" and the vertical axis "Units between events (g)". A reader must be able to tell what is counted in each gap without reading your spreadsheet.
- Interpret the chart. A point above the upper limit means an unusually long run without an event, which can signal an improvement or a missed detection. A point below the lower limit means events came unusually close together, which often points to a real change in the process. Points inside the limits, wandering around the centre line, are ordinary variation.
- Keep it live. Leave a few blank rows in your gap and limit columns and extend the formulas into them, then set the chart's source range to include those rows. New events you add will then appear without rebuilding the chart.
Common Mistakes
- Off-by-one counting. Counting the difference between event rows without subtracting one inflates every gap by a single unit. Check one gap by hand against the raw rows before trusting the chart.
- Including the event row. The event row is the moment the defect or event occurred; it is not a unit inspected without the event, so it should not be inside the gap.
- Using a mean of raw inspection totals. A g chart is built on gaps between events, not on monthly defect rates. Dividing a month's defects by its units gives you something else entirely.
- Drawing smooth curved lines. A smoothed line makes rare-event steps look like a trend. Straight connecting lines are the honest presentation.
- Leaving a negative lower limit. It will sit below zero on the axis and confuse anyone reading the chart. Cap it at zero.
- Recalculating the centre line on every update. If you recalculate the average from the newest data each time, the limits move with the process and hide the change you are looking for. Fix the baseline and compare new points against it.
Tips
- Keep the baseline period and the monitoring period on separate sheets if you like, but always show them on one chart so the comparison is visible.
- Round display values to whole numbers, because a g chart counts units and half a unit is meaningless.
- If gaps are very large, consider plotting the event number on a log-style axis or splitting the chart, but state plainly that you have done so.
- Add a data label to any point outside the limits so readers can see which event it refers to.
- Name your columns clearly (g value, g-bar, LCL, UCL) so the workbook is readable months later.
Troubleshooting
The chart shows a flat line or one lonely point. Your gap column is probably empty or filled with blanks where the formula expected numbers. Check that the gap values are real numbers, not text produced by a formula returning an empty string.
The limit lines stop partway across the chart. The limit columns were not filled down to the same row count as the event numbers. Fill the formulas to the bottom of the range and re-select the data.
Everything sits below the lower limit. Your centre line is likely calculated from a period when events were rarer. Recheck the baseline, and confirm you have not accidentally mixed complete and incomplete gaps.
Excel treats the gap column as X values. When adding a series, Excel sometimes takes the first selected column as X. Use Select Data and set the X values and Y values explicitly.
The chart does not update when you add rows. Either extend the source range manually or convert your data to a table so the chart follows it. If that did not work, delete the chart and rebuild it from the expanded range; this is faster than hunting for a stale reference.
Too many markers crowd the plot. Set the marker size smaller or remove markers from the centre and limit series, keeping markers only on the g values.
Frequently Asked Questions
Is there a built-in g chart in Excel?
No. Excel offers no g chart type, and there is no statistical process control chart set in the standard Charts menu. You build it from a scatter or line chart plus formulas.
What does the g in g chart stand for?
It stands for the number of units, opportunities or time intervals between events. The chart plots those gaps to show whether rare events are clustering or thinning out.
How is a g chart different from a t chart?
Both plot time between events. A t chart works with continuous time intervals, while a g chart counts discrete units inspected between events. Use a g chart when you count items or opportunities, and a t chart when you measure elapsed time.
Can I make a g chart in Excel for the web?
Yes, the basic approach works: formulas, a scatter chart and extra series for the limits. Formatting is more limited than on the desktop, so fine-tuning marker styles is easier there.
How many gaps do I need before the limits mean anything?
You need enough events to see a pattern rather than a handful of points. Short datasets produce unstable averages, so treat early limits as provisional and revisit them as more events accumulate.
Should the lower control limit ever be zero?
Yes. If the formula returns a negative number, set the lower limit to zero, because you cannot inspect fewer than zero units between events.