Live data from Hacker News

Lambda: Turn Excel formulas into custom functions

techcommunity.microsoft.com

81–90 of 140 posts

Re: Lambda: Turn Excel formulas into custom functions

#81
I use excel a lot and I think I'll struggle to find a use case for this.

As others have mentioned, this is essentially a user-defined function. I generally shy away from these as it will make it difficult to share spreadsheets with others as they may not even know what lambdas are. Auditing lambdas will be a nightmare, as will tracing dependencies.

Re: Lambda: Turn Excel formulas into custom functions

#82

Earlier quoted context omitted.

=LAMBDA(...) does return an anonymous function - and then you use the Names Manager to name it. It is a bit weird and confusing because you currently can’t really use the anonymous functions without naming them, but maybe they’re going to relax that restriction eventually?

The article also says this is valid within the grid: One last thing to note, is that you can call a lambda without naming it. If we hadn’t named the previous formula, and just authored it in the grid, we could call it like this: =LAMBDA(x, x+122)(1) Edit: typo

Yeah, that’s why I added a qualifier. I can’t see that being much use outside of testing/debugging functions, since it would usually be simpler to just write that without the LAMBDA call.

Re: Lambda: Turn Excel formulas into custom functions

#83
post #75
post #59

Microsoft: Hey, we have this new feature. It's called Macros. You can execute any code you like and use it as functions in your spreadsheets. Users: Great! Let's start using it everywhere! Users: Hey! Our spreadsheets have become very slow and hackers break into our systems by executing arbitrary code in our spreadsheets Microsoft: OK! From now on you will have to save workbooks that can execute arbitrary code in a d…

Allow me to reminisce.. in 2012 I created a JavaScript VM extension that executes custom functions inside native Excel. The extension also had a corresponding web-based front-end for creating apps that read/write directly to Excel. This was my baby, but investors (ie, YC) didn't think it was disruptive enough. Now I see these apps (ie, AirTable) pop up every month. Should I open source it?

If you open source it you can't sell it. If you couldn't sell it anyway you might be able to make some money supporting it as open source.

Re: Lambda: Turn Excel formulas into custom functions

#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 beautiful functional environment needs is globals.

Super curious what the future of Excel holds.

Re: Lambda: Turn Excel formulas into custom functions

#85
post #6
post #3

Earlier quoted context omitted.

Yes, but there is no mention of debugging. In the hands of Excel cowboys, this can become another foot gun.

A number of bugs will be solved by moving to it (a copied function is typo’d in one cell, etc) and you can test it pretty easily in a cell. Excel is basically a REPL with cells.

A REPL treated as a software system.

Re: Lambda: Turn Excel formulas into custom functions

#86
post #4

This is extremely significant to simplifying spreadsheets.

I see it making spreadsheets easier to convert into code, too. Many “business programs” begin as a spreadsheet.

Next up: Excel functions running as Azure Functions in the cloud.

Re: Lambda: Turn Excel formulas into custom functions

#87
post #61

Earlier quoted context omitted.

The problem with “macros” is that they can be arbitrary VBA code that can invoke OS functions and foreign applications. Lambdas can only invoke Excel functions that you can invoke anyway from any Excel cell. Lambdas merely add an abstraction mechanism, they otherwise don’t provide access to new functionality.

This is what they said: new capability that will revolutionize how you build formulas in Excel Which isn't really true. I can call macros using the =function(x) capability like forever.

Adding to what others have replied, the difference is simply put: If you can write your custom function as a lambda instead of a VBA function you will not have to save your Workbook as XLSM (M for Macro). That means no warnings when the user opens it and much better security because the lambdas can only call built-in functions and other lambdas.

To be honest, I think this is awesome and has been sorely missed.

Re: Lambda: Turn Excel formulas into custom functions

#88
I always felt VB code and macros were buried away somewhere that made it hard for less technical people to use.

This seems like it lowers the learning curve for, at the very least, adding DRY principals to more every day use cases.

I consider myself fairly comfortable in Excel. The number of times I've been burned in my own (or more likely shared) spreadsheet by things like copying down a formula that got modified in one instance but not all and related issues is staggering.

Being able to have some cells where core logic lives makes it easier for less technical people to understand what's going on, and makes formulae a lot more reusable.

Re: Lambda: Turn Excel formulas into custom functions

#89
post #61

Earlier quoted context omitted.

The problem with “macros” is that they can be arbitrary VBA code that can invoke OS functions and foreign applications. Lambdas can only invoke Excel functions that you can invoke anyway from any Excel cell. Lambdas merely add an abstraction mechanism, they otherwise don’t provide access to new functionality.

This is what they said: new capability that will revolutionize how you build formulas in Excel Which isn't really true. I can call macros using the =function(x) capability like forever.

It’s absolutely true. Most spreadsheets in BigCo are viewed by at least 3 or 4 people. No one likes it when they open a spreadsheet from someone else with a macro because it dramatically increases the learning curve.

If you just had custom functions, you can trace them back pretty quickly and end up with an understanding. Teams will also probably create ‘known’ custom functions for their use case, like converting account Chart of Account codes to finance COA codes etc.

Re: Lambda: Turn Excel formulas into custom functions

#90
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…

Totally agree - this could actually be a really natural bridge into programming for a lot of people whose advanced Excel skills already have them on the cusp.

Name Manager though... Would be really nice if they could come up with some idioms for writing these functions in a multi-line format, with indentation, and give a slightly nicer editor. I realize that might be a bit tricky without changing the language syntax, but after the 2nd nested if-statement I find that I really struggle to follow someone's single-line Excel logic...

Post reply on HN