The combination of AI and LET function in Excel is powerful. It can make formulas faster and easier to manage. But it can also produce formulas that look complicated and scare colleagues. This guide explains what the LET function does, why AI often recommends it, and practical ways to decide when to use it and when to avoid it.
Download the Excel FilesComplete the form below to instantly access the Excel files and Excel Formula Prompting Guide.
Prompting Tips for Writing Formulas with AI – Excel Campus.pdfDownloadAI and LET Function – BEGIN.xlsxDownloadAI and LET Function – FINAL.xlsxDownload Video TutorialWatch on YouTube & Subscribe to our Channel
Join the AI Literacy for Excel Course
What is the LET function?The LET function lets you create named variables inside a formula. These variables store intermediate results. This reduces repeated calculations and can greatly improve performance in large workbooks. The use of AI and LET function in Excel often shows up when a lookup or calculation is repeated several times in a single formula.
Key points about LET
Why AI recommends the LET functionAI models prioritize efficiency. When an AI sees a formula that repeats the same calculation, it suggests LET to avoid duplicated work. For example, if a formula calls XLOOKUP twice, an AI will often rewrite the formula to run XLOOKUP once and store the result in a LET variable.
This is why AI and LET function in Excel often appear together. The AI is optimizing for performance and redundancy. That optimization makes sense technically. It does not always make sense for people who need to read or maintain the workbook.
Step-by-step example: From XLOOKUP to LETThis example uses a sales table and a products table. The goal is to return a product weight and show the word bulk if the weight is over 40.
Build the basic XLOOKUPStart with a simple lookup to return the weight.
Write XLOOKUP to find Product ID in the products table.
This formula returns the weight. It is simple and easy to understand.
Add the IF testNext, wrap the XLOOKUP in an IF to show the word bulk when weight > 40.
Use IF with a logical test that compares the XLOOKUP result to 40.
This works. But the lookup runs twice. That is slow on large datasets. This is where LET helps.
=LET(wt, XLOOKUP([@ProductID], Products[ProductID], Products[Weight]), IF(wt>40, "bulk", wt))
Now the XLOOKUP runs once. The value is stored in wt. The IF uses wt for both the check and the return. That reduces calculation time and avoids duplicated logic.
That short example shows the two main benefits of combining AI and LET function in Excel:
When to use LET and when to avoid itLET is great for performance and for formulas with repeated expressions. But it's not always the best choice for shared workbooks. Decide based on the audience and the file purpose.
Use LET when
Avoid LET when
Remember that AI and LET function in Excel are tools. The right tool depends on the context. If colleagues will ask how the formula works, a simpler approach may save time in the long run.
Alternatives to LET: Prompting AI and using helper columnsIf you want AI to avoid LET, tell it in your prompt. For example:
AI will then provide formulas that may repeat a lookup. That is acceptable in most cases. If the dataset is huge and performance slows, use helper columns instead of LET.
Helper columns explainedHelper columns store intermediate results in cells. They make formulas easy to follow. They also avoid LET if your users do not know it.
Helper columns are essentially the spreadsheet equivalent of LET. The difference is the value is stored in a cell, not a variable inside the formula. For many teams, helper columns are easier to explain and maintain.
Practical tips and best practicesHere are clear, practical rules for using the LET function and for working with AI-generated formulas.
wt for weight.These tips help you balance the strengths of AI and LET function in Excel with real-world maintainability.
Checkout my articles on the LET and LAMBDA functions to learn more about these powerful Excel features.
Final ThoughtsAI and LET function in Excel together solve repeated-calculation problems elegantly. They improve performance and reduce duplication. But they can also make formulas look intimidating. The right choice depends on your team, your data size, and how much you value performance versus immediate readability.
When in doubt, follow this rule:
The combination of AI and LET function in Excel is one of many ways to write better formulas. Use the method that reduces errors, saves time, and keeps your coworkers happy.
Join the AI Literacy for Excel CourseIf you're feeling a bit overwhelmed or behind with all the changes in AI and Excel, then our AI Literacy for Excel Course will help get you up to speed quickly.
In the course you will learn how to use AI to save tons of time with your everyday Excel tasks.
And don't worry, you don't have to share sensitive data to benefit from AI. In the program I explain how to use AI to help with spreadsheet design, process automation, formula writing, and much more.
Click here to learn more and join the program
Link to post: Why AI Writes Crazy LET Formulas in Excel and How to Fix