NoCode and AI
Excel and VBA

ChatGPT for Oil and Gas - Part 2: Data and VBA

Alan Mourgues
February 15, 2024

In Part 1 (here), we explored all the text-related capabilities of the ChatGPT language model, including text generation, proofreading, translation, and summarization.

Today, we're building upon that base-layer capability and cranking it up a notch. The following examples will clearly demonstrate where the real power of this tool lies!

Prompt: 

as a reservoir engineer, your task is to use the exponential decline formula to generate a synthetic production profile for a gas field. initial rate is 10 MMscfd and decline rate is 2% per annum. Provide your output in a table with year and rate, for only the first 10 years

Output:

The reply first presents the exponential decline formula, outlines its input parameters and units, and then proceeds to create the table, exactly as requested:

Let’s assume now that we already have a certain production profile in an Excel sheet, like so:

What you can do is create a screenshot of the table and the chart, and paste it directly into the ChatGPT interface, then prompt away:

Prompt:

this is a historical gas production profile. can you forecast production based on that trend until year 15?

Sometimes, depending on the image quality, ChatGPT may struggle with reading the data and making calculations and inferences from it. You just need to keep probing and providing guidance to steer it towards the desired destination.

Output:

Here’s the response which includes a chart and a table with the projected production.

Think about this for a second: we didn’t process any data, we didn’t provide a database or a table with numbers. All we did was paste an image, and it was smart enough to recognize the image, digitize the data, fit a regression trend, and use that trend to extrapolate the data… all from a screenshot!

How about, instead of asking ChatGPT to create a table with an exponential-decline production profile, we ask it to generate a piece of VBA code that can create such a table inside Excel, with user-defined inputs for the initial rate and the decline rate?

This is what it looks like: imagine we have a simple table with two values; the Initial rate in cell B1 in MMscfd, and the decline rate in cell B2:

Prompt:

Generate a VBA code snippet to generate a production profile in column B using the exponential decline formula. Initial rate is in cell B1 in MMscfd, and decline rate is in cell B2. Put the headers “Year” and “Rate MMscfd” in cells A4 and B4 and write the profile for 10 years

Output:

Unlike the previous issue, I cannot link you to the actual ChatGPT conversation because sharing chats with images is not yet supported by OpenAI. Instead, you can view a short clip demonstrating how the VBA code is generated, pasted into the Excel VBA editor, and run, in this LinkedIn post, here.

Once the code is implemented in VBA, you can edit the input parameters in your table and rerun the code to update both the table and the chart.

Of course, you might argue that there is no need for code in this case since the decline formula is quite simple, and it's more efficient to have the chart linked to a table built from formulas referencing the inputs. However, the point is to demonstrate how effortlessly one can create code without needing much knowledge of VBA at all!

Let’s now rebuild the production table, this time from live formulas. What we want to do is add sliders or scroll bars so that the user can drag them to change the inputs and see how the table and chart dynamically update. Don’t know how to do it? Not to worry, let's ask ChatGPT for instructions.

Prompt: 

give me instructions on how to generate a slider in excel to change the value of cell B1 between 1 and 100

Output:

This is the reply we received, complete with a step-by-step set of instructions:

Once you follow these instructions, you'll end up with something like this:

Pretty neat, isn't it?

Let’s leave it here for now. In the next installment, we'll move onto Python and data analytics to continue being blown away by what ChatGPT can do. Stay tuned.

---

PS: Everything I’m sharing through this series was demonstrated on-screen during a webinar I gave on November 16, 2023. Watch it here:

More Tools

Explore a curated collection of valuable resources in our Store, all designed to help you upskill. Currently, you can take advantage of three exclusive, limited-time offers, each crafted to aid in funding our initial marketing efforts.

Alan is a Consulting Petroleum Reservoir Engineer with 20+ years of international industry experience. Alan is the founder of CrowdField, a marketplace that connects Oil & Gas and Energy businesses with a global network of niche talent for task-based freelance solutions. His mission is to help skilled individuals monetize their knowledge as the Energy transition unfolds, by bringing their expertise to the open market and creating digital products to sell in CrowdField's Digital Store.

Featured...

All blog posts

"O&G AI Wave"
Newsletter

Subscribe to O&G AI Wave – your indispensable guide to the evolving world of AI and NoCode and their practical applications for Oil & Gas professionals.

Our newsletter brings you the latest trends and insights in AI and NoCode technologies directly impacting the O&G sector.

Every issue is packed with expert analyses and practical tips to help you navigate and leverage these transformative technologies.

Don’t miss out on the opportunity to stay ahead of the trend and future-proof your career in this incredibly dynamic field.

How we can help

At CrowdField, our mission is to empower YOU—helping you showcase your skills in the open market and monetize them effectively. Here's how you benefit from being with us:

👉 Make your mark and find freelance opportunities by listing yourself in our freelancer directory to get noticed. Join us for free here.

👉 Turn your skills into digital products that sell. We'll help you polish, launch, and list them in our Store, promote them on our LinkedIn page, to our email subscribers, and feature your success in a case study on our Blog, amplifying both your product and personal brand. Whether you're at the idea stage, midway through implementation, or nearing completion, if you see potential for monetization, we're interested. Take the first step by getting in touch to start a conversation at hello@crowdfield.net.

👉 Discover bargains in our digital store with heavily discounted prices during our market discovery period. Take advantage of these limited-time offers as we expand our network. Dive in now and find your gem! Got to Store