Comment / uncomment part of the function inside LET in excel

sharshra

Active Member
Joined
Mar 20, 2013
Messages
352
Office Version
  1. 365
How to comment / uncomment within LET function? I´m looking for something similar to using ' to comment / uncomment blocks / lines of codes in VBA.

At present, I´m using a name within LET to pass on the comment. But it´s not just about adding a comment. I would like to comment / uncomment blocks of lines. If I have to try few variations within LET block, without deleting the lines, how can it be done? For example, I would like to try passing 15 to b in the LET block shown below, but still want to keep the current line `b, 10´ for reference.

Excel Formula:
=let(
a, 5,
b, 10,
comment1, "this is simple addition",
a+b)
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try:
Excel Formula:
=let(
a, 5,
b, 10,
comment1,N("this is simple addition"),
a+b)
 
Upvote 0
Thanks @KOKOSEK for quick answer. As mentioned in my first post, I´m already adding the comment as one of the names in LET function. The question is about commenting / uncommenting few lines in the LET function, similar to using ' in VBA.
 
Upvote 0
There isn't a way to comment/uncomment that i'm aware of.

If you want to try different formula for b, but want to conserve the previous formula, i would use this:

Excel Formula:
=LET(
a, 5,
b_, 10,
b, 15,
comment1, "this is simple addition",
a+b)

Or give old b any different name and define the new b in the following line.
 
Upvote 0
There is no comments as we've got in VBA but (maybe I do not understand issue) this still works :

Excel Formula:
=LET(
Myrange,$N$4:$Q$11 + N("
// Data from this range N4:Q11
"),
a,5+N("
// a is my 1st variable
"),
b,10+N("
// b is my 2st variable
"),
a+b+N("
// this
// is
// simple
// addition
"))


Just use Alt+Enter to input comments.
 
Last edited:
Upvote 0
I am responding from work. I've missed the point I think...
As felixstraube said You need to use additional variable.

Excel Formula:
=LET(
a, 5,
b, 10,
tempb, b + N("to keep org b"),
new_b,11 + N("new value of b"),
a+b)
 
Upvote 0
I´m using all these methods, but wanted to know if there is a better way to comment / uncomment within LET without using an additional variable.
 
Upvote 0

Forum statistics

Threads
1,221,503
Messages
6,160,195
Members
451,630
Latest member
zxhathust

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