Grok Knows Excel

How to Use AI to Get Help With Formulas, VBA, and More

As Excel users, we often find ourselves facing complex formulas we don’t understand, legacy VBA code we didn’t write, or questions like “how do I even do this?” Microsoft Copilot is a great option … but what if you don’t have a full Copilot license? Are other alternatives available to help us improve our Excel productivity? In this blog post, we’ll walk through how Grok, the AI chatbot developed by xAI, can be used as an intelligent assistant for common Excel tasks.

Video

Overview: What Can Grok Help With in Excel?

Grok impressed us with its wide-ranging Excel knowledge. During our sessions, we explored how to:

  • Understand complex Excel formulas
  • Write new formulas from scratch
  • Make sense of legacy VBA code
  • Generate time-saving VBA macros
  • Get step-by-step answers to everyday Excel questions

Whether you’re an Excel beginner or a seasoned pro trying to speed up reporting or automation tasks, Grok is a handy companion. Let’s walk through six use cases where Grok shines.

1. Understand a Complex Excel Formula

Imagine opening a shared workbook and seeing an intimidating formula that you didn’t write.

Instead of manually breaking it down, we can ask Grok to explain it for us.

Prompt: Explain the following Excel formula: 
=SUMIFS(Table1[Amount], Table1[Date], ">="&C7, Table1[Date], "<="&C8)

Grok gives a clear breakdown of the SUMIFS function. Partial response below:

It describes each argument and contains a summary: this formula calculates the sum of values in the ‘Amount’ column only if the corresponding ‘Date’ falls between the dates in cells C7 and C8. That kind of natural language explanation is a big time saver.

2. Generate the Last Day of Each Month in a Year

Let’s say we want Excel to list the last day of each month based on a year entered in cell C7.

We can simply ask Grok to write the formula for us:

Prompt: "Write a formula for B9 that will generate a list of the last days of each month for the year stored in C7."

Grok returns a clever formula using EOMONTH in an array format and fully explains how it works.

=EOMONTH(DATE($C$7,ROW(INDIRECT("1:12")),1),0)

We can paste the formula into Excel and just like that, we have a dynamic calendar list.

Change the year in C7 and the list updates instantly!

3. Understand Existing VBA Code

Legacy VBA code can be confusing, especially if it’s inherited from another developer. For example, we encounter the following VBA code in our workbook:

Sub WriteFormula()
Dim SumRange As Range
Dim SelectedRowsCount As Single
Dim FormulaCell As Range
Dim FormulaString As String
Set SumRange = Selection
SelectedRowsCount = Selection.Rows.Count
Set FormulaCell = ActiveCell.Offset(SelectedRowsCount)
FormulaString = "=SUBTOTAL(9," & SumRange.Address & ")"
FormulaCell.Formula = FormulaString
FormulaCell.Select
End Sub

Let’s see how Grok can help us make sense of it.

Prompt: "Explain the following Excel VBA code:" 
[Paste macro code here]

Grok breaks down each line systematically—explaining declaration of variables, loop logic, and even a nice summary of what the macro does. Partial response:

It definitely helps to understand what is going on.

4. Modify VBA Code with AI

Once we understand what our VBA macro is doing, we might want to tweak it—like calculating AVERAGE instead of SUM. We just ask:

Prompt: "Change the code to find the average instead of the sum."

Grok provides modified code along with commentary on what changed. We copy, paste it back into the Visual Basic Editor, run the macro, and verify the changes. It really is that easy.

5. Write New VBA Macros With Natural Language

Need a VBA macro from scratch? Tell Grok what we want. For example:

Prompt: "Write a VBA macro that inserts 'As of [date]' (from cell D1) in the center footer of all sheets."

Grok provides full instructions and a working macro. Partial response:

It even explains how to open the developer environment and run the code, making it beginner-friendly. This is excellent for automating documentation or compliance updates that need uniform headers and footers across a workbook.

6. Answer General Excel “How Do I…” Questions

When working on reports or models, we often need step-by-step help. For example, how do we summarize data by region?

We have a worksheet like this:

We would like to create a summary report by region, but we aren’t sure how. Let’s ask Grok.

Prompt: "How do I create a report that summarizes the data in Table1 
and shows totals by region?"

Grok walks us through inserting a PivotTable, choosing the correct fields, dragging them into rows and values, and customizing them for readability. Partial response:

We follow the steps, and bam:

The explanation is practical and actionable.

Summary

Grok proves itself to be an excellent Excel assistant. From understanding and creating formulas, to writing VBA, to walking through common Excel tasks, Grok gives us exactly what we need—without complex jargon. It’s like having a spreadsheet-savvy teammate on call 24/7.

File Download

FAQs

  1. Q: Is Grok free to use?
    A: Grok may require a subscription or access through specific platforms. Check xAI for current availability.
  2. Q: Can Grok replace Excel Copilot?
    A: While it’s not fully integrated into Excel like Copilot, Grok’s answers are practical and accurate, making it a solid alternative for many use cases.
  3. Q: What types of formulas can Grok explain?
    A: Grok can explain everything from IF statements to INDEX-MATCH, XLOOKUP, SUMIFS, and more.
  4. Q: Can Grok create macros that work in all versions of Excel?
    A: Yes, Grok provides VBA code compatible with most versions—instructions usually target Excel 2016 and up.
  5. Q: Is it safe to run VBA code from Grok?
    A: Always review the code before running. Grok-generated code is usually safe, but it’s good practice to inspect it first.
  6. Q: Can Grok troubleshoot errors in my formula?
    A: Yes, just paste the formula and ask for help identifying errors. Grok will often diagnose and fix them.
  7. Q: Does Grok support array formulas?
    A: Yes, Grok can both write and explain dynamic arrays and legacy array formulas.
  8. Q: Can Grok help format tables or charts?
    A: To some extent—Grok helps with setup and high-level steps, but exact formatting details may still need manual adjustment.
Posted in

Jeff Lenning

I love sharing the things I've learned about Excel, and I built Excel University to help me do that. My motto is: Learn Excel. Work Faster.

Excel is not what it used to be.

You need the Excel Proficiency Roadmap now. Includes 6 steps for a successful journey, 3 things to avoid, and weekly Excel tips.

Want to learn Excel?

Our training programs start at $29 and will help you learn Excel quickly.

Leave a Comment