Live data from Hacker News

Lambda: Turn Excel formulas into custom functions

techcommunity.microsoft.com

131–140 of 140 posts

Re: Lambda: Turn Excel formulas into custom functions

#131
post #93
post #84

This is a game-changer level feature. I have been dreaming of this and more other power features for a long while. Well, except for the Name Manager part in their implementation, which seems to be a total disaster. I really hope this is a first version and they are going to keep improving it as they say. One should really define the functions in the cells and be able to reference them like =A1(2). The last thing a be…

Frankly Name Manager could also be way useful if they just generified it. Make it so that you can name a cell. Then,l you get named "variables" and, with your proposed lambda implementation, you get both named and anonymous functions in one. They are orthogonal features. As is, yes, Name Manager seems very ugly.

The disparity between MacOS and Windows on this point is particularly wanting. No scope field. No comment field.

Re: Lambda: Turn Excel formulas into custom functions

#132

Earlier quoted context omitted.

Can you do LAMBDA(...)(x)? That would make it an anonymous function. Of course the real fun starts when you can do: =LAMBDA(f, LAMBDA(x, f(x(x)))(LAMBDA(x, f(x(x)))))

You can, but you can't (currently?) do =A1(x) where A1 is a LAMBDA function. I think LAMBDA(...)(x) is only useful for testing/development, but maybe I'm missing some good use cases.

If need be you could always just define a lisp interpreter.

Re: Lambda: Turn Excel formulas into custom functions

#133

Wow this is cool! I felt that something like this could be transformative to excel for some time. 2014: https://news.ycombinator.com/item?id=8116224 > spreadsheets might be an interesting programming environment if you were restricted to the native functionality with a small addition. Namely, add a new value type: "anonymous function,"... 2019: https://news.ycombinator.com/item?id=21356824 > Excel needs exactly one t…

Totally agree, we even applied to YC 5 years ago with an excel replacement specifically because of this limitation.

The danger here is that MS can just observe your success and add the feature once you've proved it works, and your nice little blue gulf instantly turns red again. Though I might be interested in a redesign of the formula language; excel's is kinda crusty.

Re: Lambda: Turn Excel formulas into custom functions

#134

Earlier quoted context omitted.

Totally agree, we even applied to YC 5 years ago with an excel replacement specifically because of this limitation.

The danger here is that MS can just observe your success and add the feature once you've proved it works, and your nice little blue gulf instantly turns red again. Though I might be interested in a redesign of the formula language; excel's is kinda crusty.

The idea had many downsides. But considering how little excel has changed in the 20 years I’ve used it, I wouldn’t be too worried about that particular issue!

Re: Lambda: Turn Excel formulas into custom functions

#135

Earlier quoted context omitted.

They can also be referenced via the cells. You could argue that cells are themselves named, but those names are really indices into a 2D array, you can have relative references or do offset-based math if needed, and there's indirection (i.e. you can use an arbitrary value as an index to read/write another value). Given all this, an index of a cell containing a lambda is really a lot like a function reference, and can…

Huh, are you sure? I don’t think you can (currently) define a lambda in a cell without also calling it in that cell (which means the cell now evaluates to the function’s return value, not a function). The LAMBDA docs: “If you create a LAMBDA function in a cell without also calling it from within the cell, Excel returns a #CALC! error.” https://support.microsoft.com/en-us/office/lambda-function-b...

It will show #CALC! for that cell because, well, it has to show something for the result of the formula - but the formula didn't evaluate to a "displayable" value.

Re: Lambda: Turn Excel formulas into custom functions

#136

Earlier quoted context omitted.

Huh, are you sure? I don’t think you can (currently) define a lambda in a cell without also calling it in that cell (which means the cell now evaluates to the function’s return value, not a function). The LAMBDA docs: “If you create a LAMBDA function in a cell without also calling it from within the cell, Excel returns a #CALC! error.” https://support.microsoft.com/en-us/office/lambda-function-b...

It will show #CALC! for that cell because, well, it has to show something for the result of the formula - but the formula didn't evaluate to a "displayable" value.

Yeah that wasn't the best example on my part. But I have tried it and confirmed that calling lambdas defined in another grid cell doesn't work.

Specifically:

1) Put =LAMBDA(x, x+1) in A1

2) Try calling =A1(1) from any other cell - it will return #REF!

I'm on the Office Insiders beta track and LAMBDA does work otherwise.

Re: Lambda: Turn Excel formulas into custom functions

#137
post #84

This is a game-changer level feature. I have been dreaming of this and more other power features for a long while. Well, except for the Name Manager part in their implementation, which seems to be a total disaster. I really hope this is a first version and they are going to keep improving it as they say. One should really define the functions in the cells and be able to reference them like =A1(2). The last thing a be…

Actually what might be better is sheet functions. So like pages where you can define input and output cells. Then you top level sheet can invoke the "function" as like "=mypage(A1, A2).N8". That way you get local scope, etc, and even excel noobs could figure it out because it's very visual instead of being a mathematical function.

Re: Lambda: Turn Excel formulas into custom functions

#138

Wow this is cool! I felt that something like this could be transformative to excel for some time. 2014: https://news.ycombinator.com/item?id=8116224 > spreadsheets might be an interesting programming environment if you were restricted to the native functionality with a small addition. Namely, add a new value type: "anonymous function,"... 2019: https://news.ycombinator.com/item?id=21356824 > Excel needs exactly one t…

Totally agree, we even applied to YC 5 years ago with an excel replacement specifically because of this limitation.

Actually what might be better is "sheet functions". So like pages where you can define input and output cells. Then you top level sheet can invoke the "function" as like "=myfunctionsheet{A1=5, A2=9}.N8". That way you get local scope, etc, and you can do more complex stuff because it's very visual instead of being a mathematical function.

Re: Lambda: Turn Excel formulas into custom functions

#139

Earlier quoted context omitted.

The danger here is that MS can just observe your success and add the feature once you've proved it works, and your nice little blue gulf instantly turns red again. Though I might be interested in a redesign of the formula language; excel's is kinda crusty.

The idea had many downsides. But considering how little excel has changed in the 20 years I’ve used it, I wouldn’t be too worried about that particular issue!

Yet here we are. Microsoft is surprising everybody lately.

Re: Lambda: Turn Excel formulas into custom functions

#140

Earlier quoted context omitted.

Totally agree, we even applied to YC 5 years ago with an excel replacement specifically because of this limitation.

Actually what might be better is "sheet functions". So like pages where you can define input and output cells. Then you top level sheet can invoke the "function" as like "=myfunctionsheet{A1=5, A2=9}.N8". That way you get local scope, etc, and you can do more complex stuff because it's very visual instead of being a mathematical function.

Obviously this will be best when used with Name Manager (especially if names can be scoped to the sheet) to name the input and output cells, rather than indexing off the cell ids directly.
Post reply on HN