LET Function Explained
LET function allows us to create names within a function, and assign values and calculations to these names so that they can be later re-used in the function as part of your calculations.
If this sentence doesn’t make any sense to you – don’t freak out, it’s ok 🙂 Keep reading and get to the examples below, we promise you’ll master the LET function by the end of this tutorial 🙂
=LET(name1, name_value1, calculation_or_name2, [name_value2, calculation_or_name3…])
name1 – The first name we want to define.
name_value1 – The value that we wish to assign to name1. This could be a number, a text, a cell reference, or a formula.
calculation_or_name2 – Here we can write the formula using the name1 we’ve just created. Alternatively, keep typing additional names and name_values to define more names. It doesn’t matter if you create 1 name or 10 names – Remember that the last argument in your function will always be the calculation itself that contains all the names you created.
Example (and further explaining… )
Let’s (Pun intended…) take a look at the following example to understand what’s this LET all about…
So basically, we told Excel to create two names – A and B, and assign to them the values 1 and 2, and finally calculate the sum of A+B. So far, so good.
But wait – Why should I use LET in my workbooks? Wouldn’t it be easier to just write =1+2?
There are several benefits of using the LET function –
- Make your functions more readable – By giving meaningful names to your calculations, it’s easier for another user (or you, an hour or so after you wrote the original formula…) to understand what you did there.
- Shorten long formulas and make your calculations easier to maintain and update – By using the LET function, you do not need to repeat complex calculations that appear more than once in your formula. You just define them once at the beginning of the function, and then you just call these calculations by using the name you just created.
- Make your calculations run faster – This one is great in case you work with workbooks that have hundreds of thousands of cells, and there are some repetitive calculations running on these (such as SUMIF, VLOOKUP, etc…) – By using the LET function and calculating each calculation only once, you can improve your performance dramatically. For more resources on this, check Leila Gharani’s formula speed test for the LET function!
This is important – The names we define will only work within the LET function we created. They won’t work if we try to use them in different cells, or even outside of the LET function in the same cell. If you wish to use names on a larger scope, such as the entire workbook – Use Excel’s Named Ranges functionality instead.