function calculateCpk() {
var usl = parseFloat(document.getElementById('usl').value);
var lsl = parseFloat(document.getElementById('lsl').value);
var mean = parseFloat(document.getElementById('mean').value);
var sd = parseFloat(document.getElementById('sd').value);
var resArea = document.getElementById('resultsArea');
var interp = document.getElementById('interpretation');
if (isNaN(usl) || isNaN(lsl) || isNaN(mean) || isNaN(sd) || sd <= 0) {
alert("Please enter valid numerical values. Standard Deviation must be greater than zero.");
return;
}
if (usl = 1.33) {
interp.className = "interpretation-box status-good";
interp.innerHTML = "Result: Capable Process. Your Cpk is above 1.33, indicating the process is capable and stable within the specification limits.";
} else if (cpk >= 1.0) {
interp.className = "interpretation-box";
interp.style.background = "#fff3cd";
interp.style.color = "#856404";
interp.style.border = "1px solid #ffeeba";
interp.innerHTML = "Result: Marginally Capable. Your Cpk is between 1.0 and 1.33. The process is meeting requirements but has little room for error.";
} else {
interp.className = "interpretation-box status-bad";
interp.innerHTML = "Result: Not Capable. Your Cpk is below 1.0. The process will produce defects and needs adjustment or tighter control.";
}
}
Understanding Cpk Calculation for Excel
The Process Capability Index (Cpk) is a statistical tool used to measure the ability of a manufacturing process to produce output within specified limits. In industrial quality control (Six Sigma), Cpk measures how close you are to your specification limits relative to the natural variability of the process.
The Cpk Formula
Cpk is calculated as the minimum of two values: CPU (Upper Capability) and CPL (Lower Capability). The formulas are:
CPU = (USL – Mean) / (3 σ)
CPL = (Mean – LSL) / (3 σ)
Cpk = MIN(CPU, CPL)
Where σ (Sigma) is the standard deviation of the process.
How to Perform a Cpk Calculation in Excel
To calculate Cpk in Excel, you don't need a specific "CPK function." Instead, you use a combination of basic math and logical functions. Assuming your data is as follows:
Cell B1: Upper Specification Limit (USL)
Cell B2: Lower Specification Limit (LSL)
Cell B3: Mean (Average of your data samples)
Cell B4: Standard Deviation (Calculated using =STDEV.S(data_range))
The Excel formula for Cpk would be:
=MIN((B1-B3)/(3*B4), (B3-B2)/(3*B4))
Practical Example
Imagine you are manufacturing a metal rod that must be between 9.95mm (LSL) and 10.05mm (USL). After measuring 50 samples, you find: