Understanding and Simplifying Complex Excel Formulas with LET and LAMBDA

Learn to LET FORMULAS BE or LET FORMULAS LAMBDA. Simplify complex, long Excel formulas using LET and LAMBDA—then automate with ChatGPT. Move from ordinary to world-class in writing long formulas and get the ability to understand long & difficult formulas and even rewrite them easily if needed.

Mark Handler CA(SA)

To follow please download the example workbook and the ChatCPT Custom Prompts.

Excel power users know the pain of wrestling with complex formulas. Before I either inherited or even worse wrote and forgot how my own long formulas worked (blush, blush). They work (somehow), but good luck explaining them to anyone else... or even remembering how they work yourself six months later!

Then I learnt to either LET FORMULAS BE or LET FORMULAS LAMBDA .........

Since then, there has not been a formula I have not been able to tame, easily, no matter how complicated.

We'll not only show you how easy it will be to convert any formula yourself and demistify any complex calculation, we'll also provide CHATCPT Prompts to automate this process for any long or nasty calculation (download links below). Gone will be the days of over-complicated, difficult to maintain calculations and Sub calculations!!!

It will even become easy to combine multiple formulas into a single calculation with confidence without fear of undue complication.

If this all sounds a bit involved, or you're pushed for time maybe don't worry, just copy our prompts and ask ChatCPT and you'll be done in seconds. You'll see what we mean.

If you deal with complicated calculations, this will be something you will re-use again and again.

Enter LET and LAMBDA - Excel's dynamic duo for formula simplification. These modern functions are like your personal formula organizers, turning chaotic calculations into neat, readable structures. Think of LET as your formula's labeling system, giving meaningful names to those repetitive calculations you keep copy-pasting. LAMBDA takes it a step further, transforming your complex formulas into custom, reusable functions.

Ready to bring some sanity to your Excel formulas? Let's dive in!

Understanding Complex Excel Formulas Without LET

Let's dive into a real-world Excel formula nightmare - the kind that makes your eyes cross and your brain hurt:

excel =IF(SUMIFS(Sales,Date,">="&DATE(2023,1,1),Date,"<="&DATE(2023,12,31))/SUMIFS(Sales,Date,">="&DATE(2022,1,1),Date,"<="&DATE(2022,12,31))>1.1,SUMIFS(Sales,Date,">="&DATE(2023,1,1),Date,"<="&DATE(2023,12,31))*0.15,SUMIFS(Sales,Date,">="&DATE(2023,1,1),Date,"<="&DATE(2023,12,31))*0.1)

Ouch. This formula calculates sales commission rates, but good luck figuring that out at first glance!

Here's what makes traditional complex formulas so challenging:

  • Repetitive Calculations: Notice how SUMIFS(Sales,Date,">="&DATE(2023,1,1),Date,"<="&DATE(2023,12,31)) appears three times

  • Zero Visual Structure: The formula runs on as one endless string

  • Hidden Logic: The business rules (10% vs 15% commission) are buried in the syntax

  • Error-Prone Updates: Need to change the date range? You'll have to update it in three places

The mental gymnastics required to decipher these formulas isn't just frustrating - it's risky. One wrong parenthesis and your calculations could silently produce incorrect results. When formulas grow this complex they become:

  • Hard to validate

  • Difficult to maintain

  • Nearly impossible to explain to colleagues

  • Prone to calculation errors

Think of it as trying to read a book with no paragraphs or punctuation or chapter breaks. Sure the information is there but extracting meaning becomes unnecessarily difficult.

Fortunately there's help available. For those struggling with Excel's complexities, whether it's understanding intricate formulas or managing large workbooks linked with numerous formulas needing high speed and memory. It's essential not only for personal efficiency but also for seamless collaboration within teams. Remember though that while it's crucial to seek assistance when needed such as in understanding complex Excel functionalities it's equally important not to let others consistently take over your responsibilities which could be detrimental in the long run as highlighted in this article.

Simplifying Complex Formulas Using LET

The LET function in Excel is a powerful tool that allows you to define and name variables within a formula, making complex calculations easier to read, write, and debug. It improves performance by calculating expressions once and reusing the result.

Syntax

LET(name1, value1, [name2, value2], ..., calculation)

Arguments

  1. name1, name2, ...: The names of variables you want to define. These must be valid names (e.g., no spaces or special characters).

  2. value1, value2, ...: The values or expressions assigned to the corresponding names.

  3. calculation: The final formula or expression that uses the defined variables.

Key Notes

  • You can define up to 126 name-value pairs.

  • The calculation argument is mandatory and must use at least one of the defined names.

You can define up to 126 name-value pairs.

  • The calculation argument is mandatory and must use at least one of the defined names.

Breaking Down Formulas Visually with LET

To follow please download the example workbook.

Let's transform our messy formula into something more digestible using Excel's LET function. Think of LET as your formula's personal organizer – it helps you name and store intermediate calculations for later use.

Here's how we can restructure our previous sales commission formula:

=LET( Sales2023, SUMIFS(Sales, Date, ">="&DATE(2023,1,1), Date, "<="&DATE(2023,12,31)), Sales2022, SUMIFS(Sales, Date, ">="&DATE(2022,1,1), Date, "<="&DATE(2022,12,31)), GrowthCheck, Sales2023 / Sales2022, IF(GrowthCheck > 1.1, Sales2023 0.15, Sales2023 0.1) )

We've Labled the 2 Sumifs calculations Sales2023 and Sales2022 and added a subcalculation called Growth Check.

This is still a bit difficult to read.

When restructuring complex formulas with LET, adding spaces and line breaks freely within the function aids in visual organization, helping you grasp the logic at a glance and facilitating quick modifications when needed.

You can add spaces and line breaks freely within the LET function – Excel ignores them. Lets do that and see what happens.

=LET(
Sales2023, SUMIFS(Sales, Date, ">="&DATE(2023,1,1), Date, "<="&DATE(2023,12,31)),
Sales2022, SUMIFS(Sales, Date, ">="&DATE(2022,1,1), Date, "<="&DATE(2022,12,31)),

GrowthCheck, Sales2023 / Sales2022,
IF(GrowthCheck > 1.1, Sales2023 0.15, Sales2023 0.1) )

Now that is many times easier to understand. This visual organization helps you scan and understand the formula's logic at a glance, just like reading well-formatted code.

The last line showing the calculation and all the variables and sub-claculations before that. Much easier to read and make sense of.

The real magic happens when you need to modify these formulas. Instead of diving into a maze of nested parentheses, you can quickly locate and adjust the relevant named calculation.

ChatCPT to Convert Formulas to LET

Prompting Chat CPT or any other AI tool could even further speed up this process, below are the suggested prompts to achieve this. Both the below prompt as well as the other suggested AI Prompts for LAMBDA's can be downloaded here .

Prompt A: Convert formulas to LET:

Can you refactor this Excel formula using the LET function? Please:

  1. Isolate and label all sub-calculations clearly.

  2. Separate constant or input values as named variables.

  3. Structure the logic cleanly, putting the main logic last.

  4. Ensure the result is readable, efficient, and reusable.

  5. Here's the formula:

  6. =PUT_YOUR_FORMULA_HERE

Improving Formula Performance Through LET

LET functions aren't just about making formulas easier to read - they're Excel performance powerhouses. When you use traditional nested formulas, Excel recalculates identical expressions multiple times. LET eliminates this redundancy by computing each named expression just once.

Performance Benefits:

This optimization becomes particularly valuable when dealing with large datasets or when the same intermediate calculation feeds into multiple final results.

Key Formatting Tips:

  • Place each variable definition on a new line

  • Use consistent indentation (4 spaces recommended)

  • Add spaces around operators for clarity

  • Align related elements vertically

Creating Custom Functions in Excel with LAMBDA

LAMBDA brings a game-changing capability to Excel: creating custom functions without touching VBA or macros. Think of LAMBDA as your personal function factory, allowing you to package complex calculations into neat, reusable bundles.

Understanding the Basic Syntax of LAMBDA

To follow please download the example workbook.

The basic LAMBDA syntax follows a similar pattern to the LET function:

=LAMBDA(parameter1, parameter2, calculation_using_parameters)

If we Isolate the Parameters Sales and Date as the inputs, lets convert the LET Function we created above to a LAMBDA and Name it CommissionCalc:

=LAMBDA(Sales,Date,
LET(
Sales2023, SUMIFS(Sales, Date, ">="&DATE(2023,1,1), Date, "<="&DATE(2023,12,31)),
Sales2022, SUMIFS(Sales, Date, ">="&DATE(2022,1,1), Date, "<="&DATE(2022,12,31)), GrowthCheck, Sales2023 / Sales2022,
IF(GrowthCheck > 1.1, Sales2023 0.15, Sales2023 0.1) ) )

Making Your LAMBDA Function Permanently Available

To make your LAMBDA function permanently available:

  1. Open the Name Manager (Ctrl + F3)

  2. Click New

  3. Enter a name for your function - in this case "CommissionCalc"

  4. Paste your LAMBDA formula

  5. Click OK

Now you can use your custom function anywhere in the workbook:

=CommissionCalc(A:A,B:B)

Where Column A:A Has the sales values and Column B:B has the date values.

Pro Tip: Create a library of commonly used calculations as named LAMBDA functions. This approach reduces formula redundancy and makes your workbooks more maintainable. In future articles we'll show the best way to create such a custom library which you can use on multiple workbooks.

ChatCPT to Convert Formulas LAMBDA

Prompting Chat CPT or any other AI tool could even further speed up this process, below are the suggested prompts to achieve this. Both the below prompt as well as the other suggested AI Prompts for LET's can be downloaded here.

🧾 Prompt B: Convert the resulting LET into a LAMBDA

Please take the following LET-based formula and wrap it in a reusable LAMBDA function:

1. Use the same variable names and logic from the LET.

2. Declare all required inputs as LAMBDA parameters.

3. Ensure the final result is clean and ready for named use.

4. Add an example of how to call this LAMBDA in a worksheet.

  1. Here's the formula:

  2. =PUT_YOUR_FORMULA_HERE

Summary

The real power of of LET and LAMBDA shines when handling complex calculations.

We started with

=IF(SUMIFS(Sales,Date,">="&DATE(2023,1,1),Date,"<="&DATE(2023,12,31))/SUMIFS(Sales,Date,">="&DATE(2022,1,1),Date,"<="&DATE(2022,12,31))>1.1,SUMIFS(Sales,Date,">="&DATE(2023,1,1),Date,"<="&DATE(2023,12,31))*0.15,SUMIFS(Sales,Date,">="&DATE(2023,1,1),Date,"<="&DATE(2023,12,31))*0.1)

Converted to LET:

=LET(
Sales2023, SUMIFS(Sales, Date, ">="&DATE(2023,1,1), Date, "<="&DATE(2023,12,31)),
Sales2022, SUMIFS(Sales, Date, ">="&DATE(2022,1,1), Date, "<="&DATE(2022,12,31)),
GrowthCheck, Sales2023 / Sales2022,
IF(GrowthCheck > 1.1, Sales2023 0.15, Sales2023 0.1) )

And Finally Simplified with a LAMBDA and have a easier to use compuation:

=CommissionCalc(A:A,B:B)

Conclusion

LET and LAMBDA functions have changed the way we work with complex Excel formulas. These powerful tools turn confusing, nested calculations into simple, easy-to-understand code structures. With the ability to name variables, break down complex logic, and create reusable functions, you have complete control over your spreadsheets.

Think of these functions as your go-to tools in Excel – they simplify complexity, bring order to chaos, and make your workbooks stand out. By using LET and LAMBDA in your everyday Excel tasks, you will:

  • Save a lot of time fixing formulas

  • Create calculations that are easy to understand

  • Build a collection of custom functions

  • Improve the performance of your spreadsheets

Your future self (and your coworkers) will appreciate it when you start using these modern Excel features. Begin with small changes, try new things frequently, and watch as your Excel skills continue to develop.

FAQs (Frequently Asked Questions)

What challenges do complex Excel formulas present and why is simplification important?

Complex Excel formulas often contain repeated sub-calculations that lead to redundancy, making them difficult to read, understand, and maintain. Simplifying these formulas improves efficiency, clarity, and overall formula management in Excel.

How does the LET function help simplify complex Excel formulas?

The LET function allows you to assign names to sub-calculations within a formula, reducing duplication and breaking down complex calculations into manageable parts. This approach enhances readability by introducing line breaks and spaces, making debugging easier and improving formula clarity.

In what ways does using LET improve Excel formula performance?

LET improves calculation speed by evaluating named expressions only once and reusing the results multiple times within a formula. This optimization is especially beneficial when working with large datasets, leading to more efficient formula execution compared to traditional methods.

How can I visually break down Excel formulas for better readability using LET?

You can structure LET formulas with indentation and spacing that mimic coding standards inside Excel cells. Using clear naming conventions for variables within LET helps users understand each part's role in the overall calculation, significantly enhancing formula readability.

What is the LAMBDA function in Excel and how does it simplify creating custom functions?

LAMBDA enables creation of custom reusable functions directly inside Excel without needing macros or VBA coding. By defining parameters and calculations within LAMBDA syntax and registering named functions via Name Manager, users can encapsulate complex logic into manageable, reusable units.

How can combining LET and LAMBDA functions advance formula simplification in Excel?

Combining LET and LAMBDA allows encapsulation of multiple calculation steps defined with LET into clean, reusable LAMBDA functions where only inputs are exposed externally. This modular approach enhances maintainability, simplifies sharing complex logic across workbooks or teams, and streamlines formula design.

What are other benefits of using LET and LAMBDA together in Excel formulas?

In addition to simplifying complex formulas, combining LET and LAMBDA also improves formula readability and reduces the potential for errors. By encapsulating calculation steps within LET, you can assign descriptive names to intermediate results, making the formula easier to understand. Additionally, the use of LAMBDA functions promotes code reuse, eliminating the need to repeat complex logic across multiple formulas. This not only saves time but also reduces the risk of introducing mistakes during formula replication.