6 reasons you should be using the LET function in Google Sheets.
The LET function can have an amazing impact on your Google Sheets formulas.
Imagine for a second that you could lower the time to understand your complex formula down to a few seconds.
Imagine if that same complex formula needed fewer lines.
Every analyst wants that because we all know that 90% of our time is spent reading and working someone else’s formulas. Or reading own old formulas, which is not easy too 😅.
That’s why we’re covering the LET function today.
The LET
function benefits the user in 6 major ways.
Improved Readability
The LET function lets you name parts of your formula (variables). Instead of using cell names or references, use meaningful words to understand what the formula does.
=LET(
...lots...lots...code..her,
ratePerMonth * numberOfMonthes
)
Efficiency
Instead of calculating different parts of your formula many times, calculate them once and name them within the LET function.
Your spreadsheet is a “Formula Machine” that chugs through your formulas on each change. The LET function makes your spreadsheet smarter by doing less repetitive work.
=LET(
sub_result,VLOOKUP("<<<<<<HEAVY_CALCULATIONS>>>>>"),
ifs(sub_result < 1, "OK",
sub_result = 1, "Good",
sub_result > 1, "GREAT!")
)
Simplified Maintenance
Nobody likes changing a chunk of your formula only to figure out that you have to change that same thing 12 other places in the same formula.
The LET function does the calculation one time, then just uses that number many times in other places in your formula.
🤚🏼MY FAVOURITE! Enhanced Error Handling
If you make mistakes in your formulas, the LAST thing you want to do is deconstruct the formula to figure out what you did wrong.
With LET, you can work from the top, using the values to debug and identify issues.
Scalability
Sometimes you need to break up your formula between a few pairs of parentheses.
LET breaks those parentheses apart into manageable parts, making it easy to make complicated formulas even more complicated 🤓.
Reduction in formula length
Long formulas that take up more than 2–3 lines are a nightmare to sift through, especially when you have a long set of them in a single formula.
Naming portions of your formula makes them easier to manage and follow. It won’t take you nearly as long to read and decipher the formula.
By breaking down the individual steps into LET variables, you make the individual steps clear.
If you’re not using LET, you almost definitely can and should be.
Here’s an example to show you what I mean:
=LET(
x, A1 + A2,
y, A3 * A4,
result, x + y,
result
)
Here’s what’s happening in this formula:
x
is assigned the value ofA1 + A2
.y
is assigned the value ofA3 * A4
.result
is then assigned the value ofx + y
.- Finally, the formula returns
result
.
Using the LET function in this way makes it very clear what each part of the calculation is doing.