How to Make a Control Chart with ChatGPT
Using ChatGPT to build a control chart sounds straightforward, but it’s not as simple as asking it to "make a chart." ChatGPT is a powerful assistant that can handle the heavy lifting, but you still need to know how to guide it and where to apply its output. This article will walk you through two effective methods for creating control charts using ChatGPT - one with a spreadsheet and one with code - and show you how to interpret the results effectively.
What is a Control Chart, Anyway?
Before we build one, let's quickly cover what a control chart is and why it's so useful. A control chart, a key tool in statistical process control (SPC), is a special type of time-series graph that helps you understand if your process is stable and predictable.
It has three main components:
- A center line (CL), which represents the average or mean of your data.
- An upper control limit (UCL), typically set at three standard deviations above the average.
- A lower control limit (LCL), typically set at three standard deviations below the average.
The magic of a control chart is its ability to distinguish between two types of variation:
- Common Cause Variation: The natural, expected "noise" within a stable process. These are the data points that fall between the UCL and LCL.
- Special Cause Variation: Unexpected, unpredictable variation that signals something has changed in your process. These are the data points that fall outside the control limits.
By identifying special cause variation, you know exactly when to investigate a potential problem or celebrate a significant improvement. It stops you from overreacting to normal fluctuations and directs your attention to what truly matters.
Method 1: Using ChatGPT with Google Sheets or Excel
This is the most common and accessible method. We’ll use ChatGPT to generate the formulas we need, then plug them into a spreadsheet program to visualize the data.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Step 1: Prepare Your Data
First, you need data measured over time. For this example, let’s imagine we’re a marketing team tracking the number of daily demo requests from our website for the last 15 days. Your data in Google Sheets might look something like this:
Column A: Date (Day 1, Day 2, etc.)
Column B: Demo Requests (18, 21, 19, 23, etc.)
Step 2: Ask ChatGPT for the Formulas
Now, let's ask ChatGPT to do the math. The key is to be specific with your prompt. Vague prompts lead to vague or incorrect answers. Try something like this:
Your Prompt:
“I have a dataset in Google Sheets of daily demo requests. The numbers are in cells B2 through B16. Can you give me the specific formulas I need to create a control chart? I need:
- The average (for the center line).
- The upper control limit (average + 3 standard deviations).
- The lower control limit (average - 3 standard deviations).”
ChatGPT will process this request and give you the exact formulas to copy and paste:
Sure! Here are the formulas you can use in Google Sheets for your data in B2:B16:
- Average (Center Line): =AVERAGE($B$2:$B$16)
- Upper Control Limit (UCL): =AVERAGE($B$2:$B$16) + (3 * STDEV.S($B$2:$B$16))
- Lower Control Limit (LCL): =AVERAGE($B$2:$B$16) - (3 * STDEV.S($B$2:$B$16))
(Note: The dollar signs ($) lock the cell range, which is helpful when you drag the formula down the column.)
Step 3: Put the Formulas in Your Spreadsheet
Create four new columns next to your data: Average, UCL, LCL, and Demo Requests (yes, duplicate this one - this will help with chart creation).
- In the first cell of your "Average" column (e.g., C2), paste the average formula ChatGPT provided.
- Do the same for the UCL formula in D2 and the LCL formula in E2.
- In F2, simply reference your original data with
=B2. - Now, select cells C2 through F2 and drag the little blue fill handle down to match the length of your data. The constant values (CL, UCL, LCL) should repeat, while your demo requests will populate column F.
Your sheet should now look like this:
A(Date) | B(DemoReqs) | C(Average) | D(UCL) | E(LCL) | F(DemoReqs Line)
Step 4: Build the Chart
With all the data prepared, creating the chart is easy.
- Select all the data from your columns, including the headers (in our example, a range A1:F16).
- Go to Insert > Chart.
- Google Sheets or Excel will likely suggest a line chart, which is what you want. If not, select it from the chart type options.
- You should see four lines: your actual demo request data zigzagging around, and three straight lines for the average, UCL, and LCL.
Pro-Tip: Format your chart for clarity. Make the UCL and LCL lines a different color (like red) and change their style to dashed lines. This makes it instantly clear what the boundaries are.
Method 2: Generating Python Code with ChatGPT
If you're comfortable with a bit of code, you can bypass spreadsheets entirely. This method is faster and more repeatable once it's set up. You can use a free tool like Google Colab to run the Python code.
Step 1: Give ChatGPT Your Data and Request
This time, our prompt will ask for a complete script. We’ll even provide the data directly in the prompt.
Your Prompt:
“Please write a Python script using the pandas and matplotlib libraries to create a control chart. Here is my data for daily demo requests: [18, 21, 19, 23, 20, 17, 25, 22, 19, 20, 28, 16, 21, 19, 22]. The chart should show the data points, a center line for the average, an upper control limit at +3 standard deviations, and a lower control limit at -3 standard deviations.”
Step 2: Get and Run the Code
ChatGPT will produce a well-commented Python script. It will look something like this:
import pandas as pd import matplotlib.pyplot as plt import numpy as np
Your provided data
data = [18, 21, 19, 23, 20, 17, 25, 22, 19, 20, 28, 16, 21, 19, 22]
Create a pandas Series from the data
series = pd.Series(data)
Calculate control chart lines
mean = series.mean() std_dev = series.std() ucl = mean + 3 * std_dev lcl = mean - 3 * std_dev
Create the plot
plt.figure(figsize=(12, 6)) plt.plot(series, marker='o', linestyle='-', label='Demo Requests') plt.axhline(mean, color='green', linestyle='--', label='Center Line (Mean)') plt.axhline(ucl, color='red', linestyle='--', label='Upper Control Limit (UCL)') plt.axhline(lcl, color='red', linestyle='--', label='Lower Control Limit (LCL)')
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Add titles and labels for clarity
plt.title('Control Chart for Daily Demo Requests') plt.xlabel('Day') plt.ylabel('Number of Requests') plt.legend() plt.grid(True) plt.show()
Simply copy this code, paste it into a Google Colab notebook, and run it. You'll get a professional-looking control chart instantly, no spreadsheet manipulations required.
How to Read Your New Control Chart
You’ve made the chart. Now what? Interpreting it is the final, most crucial step.
- Look for Outliers: Are there any points above the UCL or below the LCL? In our example, the data point at day 11 (value 28) shot well above the UCL. This is a special cause worth investigating. What happened that day? Did a big marketing campaign launch? Did a partner publish a blog post about us? This isn't just noise, it's a signal.
- Look for Trends or Patterns: Statistical process control has specific rules for identifying non-random patterns, even if all points are within the limits. Watch for things like seven or more consecutive points all trending up or all trending down, or seven consecutive points that are all above or below the average. These also signal a shift in your process.
Tips for Getting the Best Results from ChatGPT
- Be Hyper-Specific: The quality of your prompt determines the quality of the output. Mention your software (Google Sheets), your data range ($B$2:$B$16), and the exact calculations you need.
- Question its Formulas (Gently): For a simple standard deviation, ChatGPT is usually accurate. But for more complex calculations, it can sometimes make minor errors. Do a quick sense check. Did the
LCLformula correctly subtract the standard deviation part? It's always smart to verify. - Do NOT Paste Sensitive Data: Never paste confidential customer or company financial data into a public large language model. Use examples or generic data structures to get the formulas or code, then apply them to your secure data yourself.
- Iterate and Refine: Don't stop at the first answer. Follow up with clarification questions. "That's great, but how do I make sure the LCL doesn't go below zero if the standard deviation is very large?" or "Can you modify the Python code to circle outliers in red?" Chatting with it is the best way to refine the output to your exact needs.
Final Thoughts
ChatGPT is an incredibly powerful assistant for tasks like building control charts. By providing clear prompts, you can offload the mental burden of remembering statistical formulas or writing code from scratch, allowing you to focus on the insights hidden in your data. It shines in a partnership role, where it handles the math, and you handle the implementation and interpretation.
While this approach significantly cuts down on manual work, we've focused on eliminating that work entirely. Reporting doesn’t have to be a multi-step process. Using Graphed, you can connect your data sources - like Google Analytics, your ad platforms, or your CRM - and simply ask in natural language for what you need to see. Instead of asking for formulas and building charts manually, you can ask, "Show me a chart of daily website sessions over the last 30 days," and instantly get a real-time, shareable dashboard without ever opening a spreadsheet.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.