, , , ,

Using OpenAI’s ChatGPT to Create an Excel Macro for a Real Estate Model

At some point in the past few months, you’ve undoubtedly heard about ChatGPT. It seems everyone is talking about it. But how useful is the tool actually? And in particular, how useful is it to real estate financial modeling professionals?

In this tutorial I show one very real, very helpful application for the engine that powers ChatGPT: OpenAI’s GPT. Use artificial intelligence to write Excel Macros for inclusion in a real estate financial model.

In this video, I create an Excel Macro using OpenAI’s GPT for my Apartment Development Model. The macro performs a residual land value calculation. 

The output created from the OpenAI Playground used for the written tutorial.

How Non-Coders Create Excel Macros – Then and Now

As a bit of background. I’m far from a VBA expert (the programming language used to write Excel Macros). I’d consider my proficiency using VBA somewhere in the novice to intermediate level.

And so, up until a couple of months ago, writing a VBA macro in Excel was a chore. I would use a combination of Excel’s Macro recorder, bits of code I could find on the internet, and my own basic knowledge to create a Macro. I would then test and debug it, often using trial and error to arrive at a workable product.

But that’s all changed now, thanks to OpenAI’s GPT artificial intelligence (AI) tool. Rather than trying to write a Macro myself, the AI does it for me. I simply enter instructions in plain English for what I want it to build for me, and seconds later it’s done.

It is incredible!

Of course, the artificial intelligence doesn’t entirely replace the human. Knowing what you want it to write, the nuances of the functions you’re having it use, and the complexity of the subject matter it’s manipulating is still essential.

To get you started using the tool yourself for writing Excel Macros, I recorded a ~20 minute video where I add a residual land valuation calculation tool to my Apartment Development Model. The AI writes the macro, based on my plain English instructions.

Find the video at the bottom of the post.

Written Tutorial – How to Use GPT to Create an Excel Macro

For those who prefer written instructions in addition to the video tutorial, below find written instructions for how to use OpenAI’s GPT tool to create an Excel Macro. Note that, in the spirit of using as much AI in this blog post as possible, I used OpenAI’s GPT to actually write the following tutorial! It’s not perfect, but pretty good.

To write this tutorial, I used the following prompt in the OpenAI Playground: “Write a tutorial for how to use GPT to create an Excel macro.”

Introduction to Creating an Excel Macro Using GPT

GPT is a powerful artificial intelligence (AI) tool developed by OpenAI. It is a natural language processing (NLP) tool that can be used to generate code from natural language descriptions. This makes it a great tool for automating processes and creating Excel macros. In this tutorial, we will walk through how to use GPT to create an Excel macro.

Step 1: Gather Necessary Information

Before you can use GPT to create an Excel macro, you need to gather some information about the task you want to automate. This should include a description of the task, the inputs and outputs of the task, and any additional information that may be needed. Once you have this information, you can use it to create a natural language description of the task.

Step 2: Create a Natural Language Description

Once you have gathered the necessary information, you can use it to create a natural language description of the task. This should include a detailed explanation of the task, including the inputs, outputs, and any additional information that may be needed. This description should be written in a way that a human would understand, so that GPT can interpret it.

Step 3: Use GPT to Generate Code

Once you have created a natural language description of the task, you can use GPT to generate code from it (Spencer added: go to openai.com, sign up for free, and once signed in go to the ‘Playground’ to add your natural language prompt). GPT will take your description and generate code that can be used in an Excel macro. You can then copy and paste this code into an Excel macro.

Step 4: Test and Debug

Once you have generated the code and copied it into your Excel macro, you should test it to make sure it works as expected. If it does not work as expected, you can use GPT to generate additional code to debug the problem.

Conclusion

Using GPT to create an Excel macro is a great way to automate processes and save time. With GPT, you can create a natural language description of the task and use it to generate code that can be used in an Excel macro. You can then test and debug the macro to make sure it works as expected.

The actual AI prompt I used to create the Excel Macro

Watch the Video Tutorial Where I Use AI to Create an Excel Macro

In the following video, I show you how I use OpenAI’s GPT to create an Excel Macro for my Apartment Development Model. If you’re curious, this is the prompt I fed to the artificial intelligence that created the Macro:

Write an Excel Macro that does the following:

First, changes the value of the cell named Land_Value to 0

Then, uses the Goal Seek feature to set the cell named Dev_Spread to be equal to a value the user enters into a dialog box, by changing the value in the cell named Land_Value.

Finally, name the Macro Residual Land Value.

Let me know if you come up with other ways to use AI to improve real estate financial modeling.

Other use cases for GPT in Commercial Real Estate

I continue to explore other use cases for this technology in commercial real estate. As I find time, I’ll create follow-up tutorials/videos just like this. View our growing AI in Real Estate series page to explore those other use cases.

About the Author: Born and raised in the Northwest United States, Spencer Burton has over 20 years of residential and commercial real estate experience. Over his career, he has underwritten $30+ billion of commercial real estate at some of the largest institutional real estate firms in the world. He is currently President and member of the founding team at Stablewood. Spencer holds a BS in International Affairs from Florida State University and a Masters in Real Estate Finance from Cornell University.