How to Make a Clustered Column Chart in Excel with ChatGPT
Tired of fumbling with Excel's chart builder to compare different data sets? A clustered column chart is perfect for that, but clicking through all the options can be a drag. This tutorial will show you a much faster way: using ChatGPT to write the code that creates a beautiful clustered column chart for you instantly. We'll walk through how to prompt the AI, what to do with the code it gives you, and how to get a pixel-perfect chart in seconds.
What Exactly Is a Clustered Column Chart?
Before we build one, let's quickly cover what it is and why it's so useful. A clustered column chart displays more than one data series in vertical columns that are grouped, or "clustered," together. Each cluster represents a category, and the columns within that cluster represent the different series for that category.
Think of it as the perfect tool for comparison. For example, you might use it to:
- Compare the sales figures for different products (Product A, Product B, Product C) across several months (January, February, March).
- Track website traffic from different sources (Google, Facebook, Email) quarter over quarter.
- Show subscription numbers for different pricing tiers (Basic, Pro, Enterprise) over the course of a year.
In all these cases, the goal is to see how different items stack up against each other within the same category. Instead of creating three separate charts, you get one clear visual that tells the whole story.
Data Prep: Getting Your Spreadsheet Ready
Like any cooking recipe, preparation is everything. ChatGPT is brilliant, but it works best with clean, well-organized data. If you hand it a messy spreadsheet, you’ll get messy results. Fortunately, setting up your data for a clustered column chart is simple.
You need to organize your data in a basic table with clear headers. Place your main categories in the first column and your different data series in the subsequent columns. Here’s a classic example tracking quarterly sales for three different regions.
Your data in Excel should look something like this:
Notice a few things here:
- The first column contains our categories (the quarters), which will become the horizontal X-axis.
- Each subsequent column contains a data series we want to compare (the regions).
- The headers are short and descriptive. No merged cells, no extra empty rows, no fancy formatting. Just the raw data in a grid.
Once your data is structured this way, you're ready for the fun part.
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.
How to Create the Chart with ChatGPT: A Step-by-Step Guide
Now that your data is ready, you can have ChatGPT do the heavy lifting. The AI will write a small script (called VBA code) that you’ll drop into Excel to instantly generate the chart.
Step 1: Write Your Prompt and Provide the Data
Your prompt is your instruction to ChatGPT. The best prompts are specific and include all the necessary information. Start by copying your data table directly from Excel (including the headers) and then write your request.
A good prompt structure includes:
- The Goal: State what you want. "Create a clustered column chart."
- The Data: Paste the data you copied.
- The Specifics: Tell it where the data is and what to include. "The data is in range A1:D5." "Use 'Quarter' for the X-axis." "Give the chart the title 'Quarterly Sales by Region'."
Here’s a full example prompt you could use with the data from above:
Hello! Please write VBA code for Excel to create a clustered column chart based on the following data, which is located in Sheet1 in the range A1:D5.
Data:
Quarter, North Region Sales, South Region Sales, West Region Sales
Q1, 45000, 35000, 52000
Q2, 48000, 38000, 55000
Q3, 55000, 42000, 61000
Q4, 62000, 45000, 68000
Also, please make sure the chart has a title called "Quarterly Sales by Region" and include a legend.Step 2: Generate and Copy the VBA Code
ChatGPT will process your request and generate a block of VBA (Visual Basic for Applications) code. Don't be intimidated by the code - you don't need to understand it, just copy it. It's essentially a set of automated instructions for Excel.
The output will look something like this:
Sub CreateClusteredColumnChart()
'Declare variables
Dim ws As Worksheet
Dim chartObj As ChartObject
Dim chartRange As Range
'Set the worksheet where your data is located
Set ws = ThisWorkbook.Sheets("Sheet1")
'Set the range that contains your data including headers
Set chartRange = ws.Range("A1:D5")
'Create the chart
Set chartObj = ws.ChartObjects.Add( _
Left:=ws.Range("F2").Left, _
Top:=ws.Range("F2").Top, _
Width:=450, _
Height:=300)
'Apply chart properties
With chartObj.Chart
.SetSourceData Source:=chartRange
.ChartType = xlColumnClustered
.HasTitle = True
.ChartTitle.Text = "Quarterly Sales by Region"
.HasLegend = True
.Legend.Position = xlLegendPositionBottom
'Set axes titles if needed
Dim xAxis As Axis
Set xAxis = .Axes(xlCategory, xlPrimary)
xAxis.HasTitle = True
xAxis.AxisTitle.Text = "Quarter"
Dim yAxis As Axis
Set yAxis = .Axes(xlValue, xlPrimary)
yAxis.HasTitle = True
yAxis.AxisTitle.Text = "Sales ($)"
End With
End SubClick the "Copy code" button that usually appears at the top right of the code block in the ChatGPT interface.
Step 3: Run the Code in Excel's VBA Editor
Now it's time to put that code to work in Excel. This part involves a few clicks in a menu you might not have used before, but it's very straightforward.
First, Enable the Developer Tab (If You Haven't Already)
The VBA editor lives in the Developer tab, which is hidden by default in Excel.
- On Windows: Go to File > Options > Customize Ribbon. In the right-hand box, check the box next to Developer and click OK.
- On Mac: Go to Excel > Preferences > Ribbon & Toolbar. In the right-hand box, check the Developer box and click Save.
Next, Insert and Run the Code
With the Developer tab visible, follow these steps:
- Click on the Developer tab in the ribbon.
- Click the Visual Basic button on the far left. This will open the VBA editor in a new window.
- In the menu of the VBA editor, go to Insert > Module. A blank white window will appear. This is your module.
- Paste the VBA code you copied from ChatGPT into this blank module window.
- Finally, click the green "Play" button in the toolbar at the top, or simply press the F5 key on your keyboard to run the macro.
Switch back to your Excel window. Voila! Your clustered column chart, perfectly titled and formatted, should be waiting for you right there on the sheet.
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 4: Customize Your Chart (If Needed)
ChatGPT gets you 95% of the way there in seconds. The chart it creates is a standard Excel chart, which means you can still click on it and make any manual adjustments you want.
Select the chart, and you’ll see the Chart Design and Format tabs appear in the Excel ribbon. From there, you can:
- Change Colors: Click "Change Colors" in the Chart Design tab for different palettes.
- Adjust Fonts: Click on the title or axis labels to format the text just like you would in a normal document.
- Add Data Labels: Go to Chart Design > Add Chart Element > Data Labels to show the exact values on top of each column.
- Tweak the Legend: Click and drag the legend to another position if you'd like.
Tips for Better and More Advanced Results
Using ChatGPT for Excel is a skill, and you can get better at it with a little practice. Here are some tips to improve your results.
- Be Insanely Specific in Your Prompts: The more detail you provide, the less manual tweaking you'll have to do. Try asking for specific colors, font sizes, or even where on the sheet the chart should be placed.
- Ask for Revisions: Not quite right? You don't have to start over. Just ask ChatGPT to modify its own code.
- Troubleshooting Errors: If you get a VBA error in Excel, don't panic. The most common issue is that the sheet name or cell range in the code doesn't match your actual spreadsheet. Correct your sheet name in the code (e.g., change "Sheet1" to "Sales Data") or your cell range. You can even copy the error message and paste it back into ChatGPT, asking it to "debug this code." It’s surprisingly good at finding its own mistakes.
Final Thoughts
Learning to use tools like ChatGPT isn’t about replacing your skills, it's about amplifying them. Instead of getting stuck in the weeds of Excel's menus, you can now generate complex charts with a simple instruction, freeing you up to focus on what the data actually means. This method transforms tedious reporting into a quick, creative process.
For day-to-day analytics where you're constantly working with data from sources like Google Analytics, Shopify, or your CRM, setting everything up in a spreadsheet first can still be time-consuming. We built Graphed for precisely this reason. Instead of exporting data and copy-pasting code, you can connect your platforms directly. From there, you just ask questions in plain English - like "create a dashboard showing my HubSpot deals vs. Google Ads spend this month" - and we generate live, interactive dashboards for you instantly. It's a way to skip the spreadsheet work entirely and get straight to the insights.
Related Articles
Facebook Ads for Lawyers: The Complete 2026 Strategy Guide
Master Facebook ads for lawyers with this comprehensive 2026 strategy guide. Learn proven targeting, budgeting, and conversion tactics that deliver 200-500% ROI.
Facebook Ads for Moving Companies: The Complete 2026 Strategy Guide
Learn how to run Facebook ads for moving companies in 2026. This comprehensive guide covers budget allocation, creative strategies, targeting, and optimization to generate more moving leads.
Facebook Ads for Auto Repair Shops: The Complete 2026 Strategy Guide
Learn how to run Facebook ads for auto repair shops in 2026. Discover targeting strategies, budget recommendations, ad creative tips, and proven tactics to fill your appointment book consistently.