Excel Add-In For Statistical Process Control
Excel Add-In For Statistical Process Control
Excel Add-In For Statistical Process Control
Abstract Statistical process control (SPC) descibes a widely-used set of approaches used to detect shifts in processes in, for example, manufacturing. Among these are control charts. Control charts and other SPC techniques have been in use since at least the 1950s, and, because they are comparatively unsophisticated, are often used by management or operations personnel without formal statistical training. These personnel will often have experience with the popular spreadsheet program Excel, but may have less training on a mainstream statistical package. Base Excel does not provide the ability to draw control charts directly, although add-ins for that purpose are available for purchase. We present a free add-in for Excel that draws the most common sorts of control charts. It follows the development of the textbook of Montgomery (2005), so it may be well-suited for instructional purposes.
theory, provide a visual clue as to the stability of the process. When a point on the chart lands outside the control limits, or when certain anomalous behaviours are observed, the operators can be alerted to investigate or perform other actions. Although control charts can be used in many contexts, it will be convenient to imagine the output as representing measurements of quality in manufacturing.
For variable data, we draw the: X charts, for the average of a set of continuous measuments;
R charts, for the range of a set of continuous measurements; S charts, for the standard deviation of a set of continuous measurements; and X charts, for individual measurements.
In each case we provide appropriate control limits. We also allow the user to identify observations that fall outside control limits, and to re-draw the graph excluding those points. For attribute data we implement a set of so-called trend rules, which call for observations to be identied as worthy of further examination if they form patterns obeying certain criteria. For example, one rule says that a pattern is suspicious if two of three consecutive points fall in the region between x + s and x + 2s. Our add-in allows the user to identify when some or all of these patterns are present.
1.4. Implementation
The add-in is implemented in Visual Basic Applications (see, for example, Walkenbach 1999), so no compiled code is necessary. We believe that will make the add-in easy to install and use, even for users whose machines are constrained by, for example, security considerations. Implementation in Excel makes the add-in accessible to that programs huge user base and means that the familiar spreadsheet interface, rather than specialized software, can be used in courses on quality assurance. Our use of Excels well-developed drawing functions produces graphs with a look that should hopefully be familiar to many users.
Excel 2007
Installation of add-ins in Excel 2007 also starts with the user downloading the add-in le to some known location on his or her computer. He or she should then click on the Office button in the top-left corner of the screen. The choice of Excel Options at the bottom of that window produces the Excel Options page, from which the choice of Add-Ins can be made in the left panel. With Excel Add-Ins selected in the Manage drop-down list at the bottom of the page, the user clicks Go to activate the Add-In window, then Browse to locate the add-in le, and then Ok to complete the installation. In this version of Excel the add-in is made available under the Add-In tab, where an entry named Control Charts will be visible under Menu Commands. Clicking that entry will produce the start-up screen.
1.6. Organization
The next section describes the user interface and the way that the user should organize his or her data in order to use the add-in. Sections 3 and 4 give brief descriptions of the charts, for users unfamiliar with the details of their construction. Finally, Section 5 gives conclusions and directions for further development.
size as the rst column. The c chart measures counts (rather than rates) and therefore acts as if every observation is the count in a sample of size 1 unit. So for that chart (as shown in Figure 1) no sample size need be entered. The user should generally have the count data be the rightmost column of interest on the sheet, since by default results are placed in a set of columns starting immediately to the right of the counts (see also below).
Control limits
Across the middle of the window is a set of three checkboxes that allow the user to draw the control limits (UCL/LCL for upper control limit and lower control limit), lines at 2 SD, and lines at 1 SD. For attribute data all three of these boxes are checked by default.
Trend rules
Beneath the contol limit checkboxes is a set of three radio buttons that allow the user to apply dierent subsets of control rules. The Apply Western Electric Rules applies each of a set of eight rules listed in Montgomery (2005, p. 167). (Technically the term Western Electric rules more commonly refers just to the rst four of these, but we have kept the phrase to evoke the entire set.) When this option is selected the program will ag points that produce violations of any of the either rules. When the UCL/LCL only choice is selected, only points that fall outside the lower or upper control limits will be agged, and, of course, No Rules means that no points should be agged. When two plots are produced simultaneously (for example, X and R charts), the rules are applied separately. The Modify Rules button brings up a separate window that allows the user to choose a subset of the rules to be applied. Figure 2 shows the Modify Rules window. In the current version of the add-in, this allows users to select the set of rules that are to be applied when the Apply Western Electric rules button is pressed. In future versions we envision giving the user slightly more specic control over individual rules, allowing him or her to, for example, change the six in rule 5 (Six points...in a row steadily increasing or decreasing) to seven.
Excluding points
When one or more points fall outside a control limit (or violate one of the other rules) it is common to investigate them, to see if the violation can be ascribed to some known
Figure 3: Example of attribute chart with excluded points. cause. Measurements produced when the process is known to be out of control are often exluded and the chart re-drawn. By entering an additional column of data into the points to exclude box, the user can direct that points with entries in that column be excluded from any calculations. Two such points have been excluded in Figure 1. Figure 3 shows the results of pressing Run in Figure 1. Notice that the excluded points still appear on the graph, marked with a special symbol; they are still agged if they contribute to a violation of a relevant trend rule. The 1 in Exclude 1s only refers to the control limit violation rule. When a point lands outside the control limits it is agged with a 1, since rule number 1 has been violated. When the Exclude 1s only box is checked, the user is asking to exclude only points agged in that way. Points that violate other rules, and which are therefore agged with a dierent number, continue to be included in the computations when the Exclude 1s only box is checked. In the current version of the add-in, results are placed immediately to the right of the data. Therefore the points to exclude column should not be placed immediately to the right of the data; doing that will over-write that column and confuse the algorithm. We recommend placing the column of points to exclude to the left of the data.
Result location
By default, results are presented in a set of columns immediately to the right of the data on the workbook. If a location is entered in the location of results box, results will someday
Figure 4: Example of data input for variable data. be placed in that location instead. In fact, in the current version of the add-in this entry is ignored.
relies on the underlying spreadsheet to evaluate them. For example, the X-bar column on the same chart is computed through a call to Excels built-in =AVERAGE function. This choice has been made for programming convenience, but it has the eect that if the user changes the underlying data, some columns will change and others will not. Of particular note is that the Flags columns are computed in VBA and do not update when the data changes. Consequently users cannot change the data and expect the results to be properly updated automatically; instead, they will need to re-run the add-in to produce an updated chart.
The p chart
The p chart helps practitioners look at variations in the rate at which defective items are produced. We envision that sample j consists of nj observations, each of which is either defective or not defective. The sample proportion of defectives within each lot, pj , is computed in the usual way. The chart plots these pj s against sample number. The centerline of the graph is given by p, which is the defect rate from all samples combined (or the value of p provided by the user, if there is one). Control lines for sample j are plotted at p j , p 2j , and p 3j , where j is the usual estimate of standard deviation given by p(1 p)/nj . Very often all the sample sizes will be the same, in which case all the control lines will be horizontal.
The np chart
The np chart is simply a p chart (for the constant sample size case) in which everything has been multiplied by n. This means that the charts vertical axis is expressed in terms of numbers of defectives per lot, rather than in defective rate, which might be easier for nontechnical personnel to interpret. The np chart is not appropriate for variable sample-size data, however, since defect counts will naturally be expected to increase with sample size. This gives rise to a variable centerline, which can be dicult to interpret. The add-in will not permit such a chart to be drawn.
The c chart
The c chart counts the number of defects (not defective items) in a particular sample. This would be appropriate for data arising from a Poisson process, for example. We require a constant sample size (so as to ensure a constant centerline) and we compute the defective rate cj within each sample. The plots centerline is set to a value c, which is either the given value c or, if no value is supplied, the average of the cj . Following the Poisson assumption, we compute the standard deviation of c as c , and draw control lines at c c, c 2 c, and c 3 c.
10
The u chart
The u chart measures the defect rate, rather than the count, in Poisson-type data. For a constant sample size n, then, it is simply a c chart in which everything has been divided by n. When sample sizes vary and no centerline is provided, the centerline u is set at the total number of defects divided by the total sample size. Control lines for sample j are then drawn at u 1, 2, or 3 u/nj .
11
Our estimate of the standard deviation for a single sample is the usual one based on the unbiased estimator of variance, s2 = 1/(n 1) (xi x)2 . Of course s is not unbiased for ; we write E(s) = c4 , where c4 is another value that depends on sample size. (This one we compute directly in our VBA code, using the expression in Montgomery (2005, p. 95). Furthermore we have SD(s) = c4 1 c2 . Therefore the S chart is drawn with the centerline 4 at c4 and control limits at c4 3 1 c2 = B5 and c4 + 3 1 c2 = B6 . 4 4
12
sheet behind the chart, should be able to be suppressed. If results are desired, the user should be able to select the location in which they are displayed. Second, the ability to modify the trend rules (not just select a subset of them) might be useful. Beyond user interface issues, the addition of the s2 , the cumulative sum (CUSUM), and exponentially weighted moving average (EWMA) charts would complete the set of univariate charts detailed in Montgomery (2005). The add-in might be even more useful in an instructional setting if it incorporated some of the process control tools not related to control charts, like, for example, a calculator to implement the ANSI sampling standards.
References
Montgomery DC (2005). Introduction to Statistical Quality Control. 5th edition. John Wiley & Sons, New York, NY, USA. R Development Core Team (2009). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL http: //www.R-project.org/. Scrucca L (2004). qcc: An R Package for Quality Control Charting and Statistical Process Control. R News, 4(1), 1117. URL http://CRAN.R-project.org/doc/Rnews/. Walkenbach J (1999). Microsoft Excel 2000 Power Programming with VBA. IDG Books, Foster City, CA, USA.
Aliation:
Samuel E. Buttrey Code OR/Sb Department of Operations Research Naval Postgraduate School Monterey, CA 93943, United States of America E-mail: buttrey@nps.edu Telephone: +1/831/656-3035