Create a simple AI Agent in Excel VBA
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:-
- Python:- https://tracyrenee61.medium.com/create-a-simple-agent-in-python-to-analyse-waste-2c35555e9e97
- R:- https://tracyrenee61.medium.com/create-a-simple-ai-agent-in-r-to-analyse-waste-2c86603b70e8
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:-
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.
The spreadsheet that is created by the AI Agent can be seen below:-
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








