Using LET function with arguments?

mrblister

Board Regular
Joined
Nov 20, 2016
Messages
191
Office Version
  1. 2019
Platform
  1. Windows
I have a very long formula, that I currently have to repeat with different arguments.

For example, let's say the long formula is: "addDecimalOne(var)", which the formula adds 0.1 to "var".

I want to run that formula with 2 different vars, then sum it up.

Is there a way to use the LET formula (Excel 2021) to shorten that formula?

This is as close as I can get:
"=LET(var,1,addDecimalOne,(var+0.1+N("this simulates super long formula")),addDecimalOneA,addDecimalOne,var,2,addDecimalOneB,addDecimalOne,addDecimalOneA+addDecimalOneB)"

But Excel won't let me run that formula, as the following error appears due to the second "var": "You can't define the same name twice in a LET function."

Any advice? Note I'm using Excel 2021, so I have access to LET but not necessarily newer functions included in Excel 365.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi mrblister,

Here is a simple example of using the LET function...
Book1
AB
1a3
2b7
3
4Let formula21
Sheet2
Cell Formulas
RangeFormula
B4B4=LET(a,$B$1,b,$B$2,IF(a>b,a+b,a*b))

You might be thinking of making a LAMBDA function. They are generally more complex to write, but much more powerful; like creating your own functions.

Hope that helps,

Doug
 
Upvote 0
Thanks for replying Doug. Unfortunately, Excel 2021 doesn't include LAMDA. Is there no way to do what I want with LET?
 
Upvote 0
It can probably be done, but I couldn't follow exactly what you are trying to do...I am getting tired early tonight LOL. Maybe you could provide an example of your inputs with expected output and post it with XL2BB if you have that option. I almost always have to build formulas step-by-step in multiple cells, and them combine them into the LET function.

Doug
 
Upvote 0

Forum statistics

Threads
1,215,154
Messages
6,123,327
Members
449,098
Latest member
thnirmitha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top