Sitemap

Create a simple AI Agent in Excel VBA

3 min readDec 22, 2025

--

In my two previous blog posts I discussed how to create a simple AI agent in both Python and R. these blog posts can be read here:-

In this video I am discussing how to create a simple AI Agent in Excel to analyse a spreadsheet that contains waste data.

Get Crystal X’s stories in your inbox

Join Medium for free to get updates from this writer.

The screenshot below is a dataset that I have created in Excel containing simulated waste data:-

Press enter or click to view image in full size

I used Excel VBA to insert a module, being a simple AI Agent, into the workbook. The AI Agent performs the following tasks in order:-

  • Define all of the variables that will be used in the program.
  • Initialise the variables that will be used in the program.
  • Set up a for loop that will iterate through each row of the dataset. It calculates the total weight and total cost of the waste in the dataset.
  • Set up code to divide by zero.
  • Create a new worksheet that summarises the total waste and cost for each category.
  • Create a horizontal bar chart to visualise the total weight of the waste.
  • Give a final message, saying what the average cost per tonne of waste is.
Press enter or click to view image in full size

The spreadsheet that is created by the AI Agent can be seen below:-

Press enter or click to view image in full size

The above code is a very simple AI Agent, which can be modified for the user’s particular needs.

I have created a code review for this blog post, which can be viewed here:- https://youtu.be/v03IGTGfBCc

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.