Python in Excel: How to make a process control chart with Copilot
Want to share your content on python-bloggers? click here.
Many Excel users dismiss statistics as irrelevant, focusing solely on getting the numbers to add up and then moving on, rather than thinking in probabilities and uncertainties. Yet, these numbers often represent moments in time where they’re monitoring for significant changes to alert the business—precisely where statistics shines. Process control charts, in particular, offer an accessible solution.
A process control chart tracks a process over time by plotting data—like daily output or error rates—against a centerline (the average) and control limits (typically three standard deviations from the mean). It’s ideal for ensuring consistency or spotting problems early in repeatable processes, from manufacturing to healthcare or business operations.
These charts blend basic statistics with clear visuals, making them a perfect tool for data analysts. While building them in BI systems or Excel can be tricky, Python simplifies the process—especially with Copilot, which lets you write code using natural language. This blog post explores the process. You can follow along with the exercise file below:
We’ll begin with a familiar and widely recognized dataset: daily weather observations, found in the temps
worksheet of the exercise workbook. Our aim is to identify ‘unseasonable’ days in January by flagging those that fall beyond three standard deviations from the mean temperature.
Instead of building this ourselves in Excel, we’ll use Python and Copilot. If you haven’t used this Advanced Analysis feature before, you can find more details below:
To do this effectively it’s useful to know a little bit of the lingo of process control charts. Specifically we want to define the “lower” and “upper” control limits. In a process control chart, the lower control limit (LCL) and upper control limit (UCL) are statistically calculated boundaries that define the range of acceptable variation in a process, typically set at three standard deviations from the mean. They serve to monitor process stability, helping to identify when a process is out of control due to unusual variation, prompting investigation or corrective action.
We’ll stick with the three standard deviation limit for now and prompt Copilot:
Create a process control chart that compares the average daily temperature to the lower and upper control limits, defined as the mean plus or minus three standard deviations.

Looks great! Ask Copilot move the the legend so it does not overlap with any chart elements:

The process control chart shows the actual temperatures alongside three key elements: the central line, which, as expected, represents the mean, and the red bands, which mark the control limits. In essence, this means that any data points within these limits are deemed “seasonable” or typical.
If we’d like to dig deeper into the code behind this chart—perhaps to understand its construction or tweak it (like adjusting an axis label or changing a color)—we can start by selecting the cell containing the Image object where the plot was generated (in the screenshot, that’s cell A59). From there, we can check the formula bar for the code.
For a roomier view, head to the Formulas tab on the ribbon, open the Editor under the Python group, and explore the code in a larger block. What’s cool is that even with a quick glance, you can see we’ve defined an Upper Control Limit (UCL) and Lower Control Limit (LCL), added them as lines on the plot, and included titles and other details—pretty neat! Python often feels approachable like this, especially for Excel users, and with Copilot’s assistance, it’s even more within grasp.

Weather data seems like a promising choice for analysis since it’s gathered consistently over time, enabling us to detect trends or outliers—such as unseasonable days—using control limits. However, it’s less than ideal because weather isn’t a controlled process; its natural variability and dependence on complex factors make “stability” tricky to pin down or predict.
Instead, let’s switch to the data in the production_yield worksheet, which tracks the daily output of a hypothetical factory or plant. I’ve noticed that after running process control analysis on one worksheet, if you restart Copilot, direct it to a new dataset, and run Advanced Analysis, it seems to carry over the ability to apply process control to the new data. That said, you might still need to nudge Copilot to adjust the legend placement.

Looking at the chart, it’s clear we’ve had some significant ups and downs, especially around January 25th, where the yield spiked well beyond what we’d expect—definitely outside our desired range. This could indicate a process malfunction; even though we produced a lot, those units might have been defective, so it’s worth checking the defect rates for that day.
This highlights an important lesson: a “good” number isn’t always good news if something else, like defects, is at play. By using basic statistics like standard deviations, we can better understand these variations and put our observations into perspective. Great job on this—it’s a solid starting point for digging deeper!
Process control charts are a fantastic, statistically driven tool for quick, at-a-glance monitoring, but they’re not a cure-all. They only track what you choose to measure, so if you’re focusing on the wrong thing, they won’t be much help. Also, they assume your process should be stable, which doesn’t always work for messy, creative, or seasonal tasks. That said, when applied correctly, they’re an excellent way to keep things running smoothly.
What questions do you have about creating process control charts in Excel with Python and Copilot, or about this powerful combination in general? Let me know in the comments.
The post Python in Excel: How to make a process control chart with Copilot first appeared on Stringfest Analytics.
Want to share your content on python-bloggers? click here.