ChatGPT for Excel

Mynda Treacy

February 16, 2023

Everyone’s talking about using ChatGPT for Excel and how it can improve your productivity with claims it’ll make you n times more productive and the like. I can tell you it’s not all it’s cracked up to be!

If you want to be more productive in Excel, learn Power Query.

That’s not to say ChatGPT isn’t worth using, but you have to know what to use it for and what not to waste your time on, 'cause believe me, you can waste a lot of time on it.

In this post I’ll show you what the best uses of ChatGPT are for Excel, what not to waste your time on and most importantly, what to watch out for, because it can return a lot of inaccuracies and because it comes across so authoritative, it’s easy to assume it’s right.

Note: these tests were done with ChatGPT-3.


Watch the ChatGPT for Excel Video

Subscribe YouTube


ChatGPT for Excel Function Explanations

Beginners will probably get the most out of ChatGPT because it’s good at answering simple questions.

For intermediate to advanced Excel users, it becomes less useful because it struggles with complex questions.

For example, ask it to explain how a function works and it does a pretty good job. I asked it to explain the XLOOKUP function:


chatgpt explain xlookup


It explains the purpose, the syntax and the various arguments. It stops short of an example, but you could ask a follow up question to get that:


chatgpt example xlookup


It provides a simple example, but there’s a lot more to XLOOKUP not covered here and without knowing what it’s capable of, you wouldn’t know to ask about it.

ChatGPT for Excel Formula Writing

If you have a fairly straight forward formula question, it can usually give you a solution. We get a lot of questions about IF formulas like this one left in the comments on our blog:

“A formula I currently have is as follows; =IF(B45<=50,450,450+((B45-50)*D45))

I still need the above but I also want to add to it that if B45 is left blank, a value of 0 is shown.”

I plugged that question into ChatGPT and it returned the correct answer:


chatgpt excel formula writing


We can see ChatGPT is great at giving you instant answers to simple questions. This is going to save Excel beginners a lot of time. But it comes at a cost.



You’re not learning if you just ask ChatGPT to do the work for you.



Therefore, I recommend you try to find a solution yourself and then if you get an error, a better question to ask is ‘what’s wrong with my formula, it should be doing xyz’.

This way ChatGPT will not only fix your formula, but it’ll also explain where you went wrong and what the correct solution should be.

ChatGPT Troubleshoot Excel Formula Errors

Let’s say you’re trying to write a formula but it’s returning an error. You can simply ask ChatGPT what’s wrong with the formula and it will explain the issues and the solution:


chatgpt troubleshoot excel formula


Keep in mind that ChatGPT doesn’t know what data you’re working with, so if the formula is returning a result, but not the one you were expecting, then it’s probably not going to be able to help with that.

ChatGPT Explain Excel Formulas

If you’ve inherited an Excel file with a complex formula, ChatGPT is good at explaining what that formula does in layman’s terms.


chatgpt explain excel formula


However, it was less good at simplifying that formula and even tries to avoid doing it:


chatgpt simplify excel formula


In hindsight, I should have been more explicit with my question and asked it to simplify it, which I tried next.


chatgpt simply another excel formula


The formula in the screenshot above is truncated, but here’s the complete formula ChatGPT returned:

=CEILING(((IF(C11="consignment",IF(G11>30,(H11-AGO/365*30*IntRate),0),0)+CEILING((IF(B11="Station A",B4,B5)+IF(F11>10,F11,0)-D11),10)+20)/FXRate),10)

It may be shorter, but it returned the wrong result by a factor of nearly 6. It also included 3 pairs of parentheses that weren’t required.

From this we can see that its knowledge of Excel functions isn’t as advanced as it appears. One way to simplify this nested IF formula is like so:

=CEILING(

XLOOKUP([@[Reference station]],$A$4:$A$5,$B$4:$B$5,,0)

-[@[Applicable discount]]

+([@[Nature of Delivery]]="Consignment")*20

+([@[Transport Rate]]>10)*[@[Transport Rate]]

+([@[Credit days]]>30)*([@[Provision for Financial Charges]]-AGO/365*30*IntRate),10)

/FXRate

ChatGPT for Power Query Questions

Similar to Excel formula questions, ChatGPT is also ok at simple Power Query formula questions. For example, I asked it:

“How do you round to the nearest 0.5 in Power Query?”

ChatGPT got confused at first and gave me a formula containing Excel functions. But it returned the wrong answer even then:


chatgpt for power query formula


I asked again and it got it right:


chatgpt explain power query function


Of course, as a beginner you need to know what to do with the code above and while you can ask ChatGPT where to put the code, it’s unlikely to give you the answer you actually need. For example, I only wanted the formula to use in a custom column, so I needed this part of it:

=Number.Round([Number]*2,0)/2

The rest is redundant.

ChatGPT for Power Pivot Questions

ChatGPT did better with the Power Pivot DAX question I asked it. I found a question on our Excel Forum and copied and pasted it word for word to see how ChatGPT would fare.

I’m pleased to say it did quite well and even wrote the formula using the table and column names mentioned in the question:


chatgpt for power pivot functions


However, I suspect that like Excel and Power Query formulas, as the questions get more complex, the answers get less reliable.

ChatGPT for VBA

ChatGPT also did well with the VBA question I found on our Excel VBA forum, returning an almost identical answer to one of our experienced VBA forum moderators:


chatgpt for vba


However, I know it doesn’t always get it right, so don’t count on it being able to automate everything you do 😉

Things to Avoid Asking ChatGPT

I really want to love ChatGPT, and I do for some things but there are some things you should never use it for, well at least not with the current version, which is ChatGPT-3.

First, don’t get it to do math or check math results. It will give you an answer and assure you it’s correct, but unless the result is two digits or smaller, it’s unlikely to get it right, and even then, it might not.

I was horrified at the math results it returned (see screenshot below). It clearly doesn’t have a calculator built into its logic, which I’d have thought is pretty simple to do. Even my Google speaker gets the correct answer.


what not to ask chatgpt


The bottom line is ChatGPT is a natural language AI tool, and it doesn’t have a built in calculator, yet. Maybe it’ll get one in later versions. Until then it should be taught to decline answering math questions.

Asking ChatGPT Leading Questions

If you give it a leading question, it will follow. For example, I asked ChatGPT if Excel has a BETWEEN function. We can see in the screenshot below that there is RANDBETWEEN function in Excel, but no BETWEEN function:


chatgpt mistake on function name


However, because I asked it in a leading way, it went along with me and gave me the answer it thought I wanted, even though it isn’t true. It even went as far as to make up the arguments and then explain them!


chatgpt confirms excel function exists


It’s therefore important to phrase your questions in a neutral way to ensure you don’t get a biased result. That said, even when I started a new chat with an unbiased question, it still assured me there was a BETWEEN function (maybe it was influenced by my previous question):


phrase questions properly for chatgpt

ChatGPT for Excel – The Bottom Line

ChatGPT is a bit like a politician, you have to fact check everything it tells you. Some of it will be right, some of it will be embellished and some of it will be plain wrong.

I’m sure with each iteration of ChatGPT and other large language models we’ll see improvements on the limitations I’ve covered here, and let’s hope improvements in math capabilities arrive soon.

AUTHOR Mynda Treacy Co-Founder / Owner at My Online Training Hub

CIMA qualified Accountant with over 25 years experience in roles such as Global IT Financial Controller for investment banking firms Barclays Capital and NatWest Markets.

Mynda has been awarded Microsoft MVP status every year since 2014 for her expertise and contributions to educating people about Microsoft Excel.

Mynda teaches several courses here at MOTH including Excel Expert, Excel Dashboards, Power BI, Power Query and Power Pivot.

13 thoughts on “ChatGPT for Excel”

  1. can anyone clear my below doubt?
    How can I highlight the duplicate numbers in different colors in one column?
    If the duplicate number is between 1 to 10 one color
    If the duplicate number is between 11-20 one color
    If the duplicate number is between 21-30 one color
    If the duplicate number is between 31-40 one color
    If the duplicate number is between 41-50 one color

    What is the formula for that?

    Reply
  2. Just like when talking to humans, the AI needs some context, or prompting, to arrive at the answer you are expecting. Read through the first couple of articles at learnprompting.org to see what I mean. Your ChatGPT experiences will be much better for it!

    P.S. I love the Excel Newsletter from myOnlineTrainingHub. I will never give it up, no matter how the chat bots evolve!

    Reply
  3. ChatGPT replied me with a code sample as shown below to explan the class module but failed to fix the problems with red highlights on first and last lines on VBE. Could you please dig out for me where the errors existed?

    Let’s create a BankAccount class with three properties (AccountNumber, Balance, and AccountType) and two methods (Deposit and Withdraw). We then create a new instance of the BankAccount class and assign it to the variable myAccount, set its properties, and call its Deposit and Withdraw methods to modify the account balance. Finally, we display the current account balance in a message box.

    Public Class BankAccount
    Public AccountNumber As Long
    Public Balance As Double
    Public AccountType As String

    Public Sub Deposit(amount As Double)
    Balance = Balance + amount
    End Sub

    Public Sub Withdraw(amount As Double)
    If amount <= Balance Then
    Balance = Balance – amount
    Else
    MsgBox "Insufficient funds."
    End If
    End Sub
    End Class

    With this class module, you can create new instances of the BankAccount class and use its properties and methods to manage the account balance.

    Dim myAccount As New BankAccount
    myAccount.AccountNumber = 123456789
    myAccount.AccountType = "Savings"
    myAccount.Deposit 1000
    myAccount.Withdraw 500
    MsgBox "Current balance: " & myAccount.Balance

    Reply
  4. Thanks for the examples. I found similar issues with OpenAI when I was experimenting with it. You definitely need to double-check everything it says because it can just make things up. For example, I told it to “Explain how to make a Gantt chart in Excel” and this is what it returned:
    1. Create a new spreadsheet in Excel.
    2. Enter the project tasks in the first column.
    3. Enter the start and end dates of each task in the second and third columns.
    4. Select the entire data range and click on the Insert tab.
    5. Click on the “Gantt Chart” option under the Charts section.
    6. A Gantt chart will be generated in the spreadsheet.
    7. Customize the chart to change the colors and other settings.
    8. Save the spreadsheet.

    Because of all the tutorials on the internet about how to make a Gantt chart using a stacked bar chart, I thought it would probably explain that method, but instead it just made up a fictitious feature. But maybe Microsoft could learn something from this and add this new chart type. 🙂

    Reply
    • great idea for a new chart type, Jon! I suspect the AI has found examples of add-ins that create Gantt charts and it assuming all Excel users have this option. I don’t know how it will ever be able to distinguish between add-ins and built-in Excel features

      Reply
  5. I asked ChatGPT for a LAMBDA formula to calculate the moving range of a Dynamic Array, and I actually collected a dozen or so responses. The descriptions all sounded knowledgeable, but many of the results didn’t work. Some didn’t even use Excel formula syntax, some couldn’t be entered as written, and the ones that didn’t seem to have errors produced calculations that were definitely not moving averages.

    GPT in, GPT out.

    Reply
    • I suspect its lack of knowledge post 2021 is limiting its ability to write LAMBDAs for Excel. Well, I hope that’s the reason.

      Reply
  6. ChatGPT was really wrong with your formula
    =SUMIFS(Table1[Sales],Table1[Year],>=&2000)

    You specified both ranges properly, but the inequality condition has to be expressed as “>=”&2000 or “>=2000″. ChatGPT corrected this inequality without stating that it had done so, missing a teaching moment.

    Worse, ChatGPT added a spurious additional range of A1:A100 to
    =SUMIFS(Table1[Sales],Table1[Year],A1:A100,”>=2000″)

    But it sounded so knowledgeable that even an expert like yourself missed it. Pity the poor beginner who cahn’t get ChatGPT’s formula to work.

    Reply
    • Oh, yeah. I think that was the second or third time I asked it the SUMIFS question. I didn’t take a screenshot the first time and it lost the thread, so I had to ask it again. The first time I tested the result and it worked, and I didn’t notice the erroneous extra argument referencing A1:A100 in the answer I took the screenshot of! Good catch.

      Reply

Leave a Comment

Current ye@r *