Home>Blogs>Excel Tips and Tricks>How Chat GPT can help to write Complex Excel Function, VBA code and DAX for Power BI
Excel Tips and Tricks

How Chat GPT can help to write Complex Excel Function, VBA code and DAX for Power BI

Introduction

Have you ever tried to write a complex Excel function, VBA code, or DAX using natural language? It can be challenging and time-consuming. If this is your situation, then Chat GPT may be the right tool for you.

Chat GPT is a tool to help non-programmers or non-DAX or Excel users to write Excel functions, VBA Code, and DAX using natural language

You can use Chat GPT to write complex Excel functions, VBA code, and DAX for Power BI.

 

What is Chat GPT?

 

It’s a web-based tool that allows non-programmers to write the code without knowing how to program. Chat GPT is an AI-based model developed by OpenAI. It can generate text like a human based on input prompts. It has been trained on a large dataset.

 

It doesn’t require any special knowledge or skill set from your side as it will automatically generate the code for you when you write down what you want it to do!

 

How to start work on the Chat GPT?

Go to the below URL and log in with your Google or Microsoft Account. You can Sign up with your other email id also.

https://chat.openai.com/

 

Chat GPT
Chat GPT

 

Few Examples of Chat GPT-

Once you have logged in, you can ask your question. For example, here we asked to create an Excel formula to get the first name from a complete name.

 

Excel formula example in Chat GPT
Excel formula example in Chat GPT

We copied the formula and pasted it on the Excel sheet. It is returning the perfect result.

 

Formula on Excel Sheet
Formula on Excel Sheet

 

In the next example, we asked it to write the VBA code to copy the data first sheet to the second sheet with the Supervisor filter given on the select sheet.

 

VBA code using Chat GPT
VBA code using Chat GPT

 

We copied the code and pasted it into a new module inside the visual basic editor and assign that macro on a button.

 

VBA code in Excel
VBA code in Excel

 

In the next example, we asked to write a DAX function to get the Y-o-Y Revenue. It returns the correct result.

 

Note: In a few cases it was returning the incorrect code or answer also. So, we suggest don’t believe blindly on this. First, read the code or formula carefully and test it properly before putting it in your live report or dashboard.

 

Conclusion

Chat GPT is a tool to help non-programmers or non-DAX or Excel experts to write Excel functions, VBA Code, and DAX using natural language. In a few cases, it was returning the incorrect code or answer also. So, we suggest don’t believe blindly on this. First, read the code or formula carefully and test it properly before putting it in your live report or dashboard.

Watch the step-by-step video tutorial:

Click here to download the Excel file used in the above Example

 

PK
Meet PK, the founder of PK-AnExcelExpert.com! With over 15 years of experience in Data Visualization, Excel Automation, and dashboard creation. PK is a Microsoft Certified Professional who has a passion for all things in Excel. PK loves to explore new and innovative ways to use Excel and is always eager to share his knowledge with others. With an eye for detail and a commitment to excellence, PK has become a go-to expert in the world of Excel. Whether you're looking to create stunning visualizations or streamline your workflow with automation, PK has the skills and expertise to help you succeed. Join the many satisfied clients who have benefited from PK's services and see how he can take your Excel skills to the next level!
https://www.pk-anexcelexpert.com