Examples using the Lambda Function in Numbers

Hi, I've worked out how to use Lambda.Apply but I cannot work out how to actually use the Lambda function to define a sub-formula that accepts up to 253 parameters as input.


I searched online and cannot find a single working example. Even Apples on help text does not provide me anything I can use to start using Lambda.


Any help appreciated.

Mac Studio, macOS 15.4

Posted on Apr 6, 2025 7:15 AM

Reply
8 replies

Apr 6, 2025 5:55 PM in response to iwaddo

Here the same example using LET



In G2, filled down:


LET(taskComp,B2,quality,C2,timeliness,D2,effort,E2,weight,F2,(taskComp*0.4+quality*0.3+timeliness*0.2+effort*0.1)*weight)



Not as succinct as a regular formula, but using named inputs does have its convenience, and makes things easier to debug and audit.


SG

Apr 6, 2025 12:58 PM in response to iwaddo

Here's a worked example using the LAMBDA function in Numbers.



In G2, filled down:


=LAMBDA.APPLY(B2, C2, D2, E2, F2, 
LAMBDA(taskComp, quality, timeliness, effort, weight, 
 (taskComp * 0.4 + quality * 0.3 + timeliness * 0.2 + effort * 0.1) × weight))


Numbers doesn't seem to allow a Lambda function to be named so it can be easily reused. Nevertheless it does allow logic to be encapsulated while using named variables, making it easier to reapply the logic elsewhere in a document.


For simple logic regular formulas are probably easier. But once the logic starts getting more complex, with conditionals, Lambda functions do seem to offer advantages.


SG

Apr 7, 2025 12:20 AM in response to SGIII

I can see how LET adds some clarity but it is not much different to working in a table with a header column especially as the colours remain in a normal formula unlike in LET


Would be interesting to test if there is a discernible difference in speed with lots and lots of rows.


I've many uses for a user defined function but if Lambda is not going to do it then I'm struggling to see the point of adding it.

Apr 7, 2025 6:07 AM in response to iwaddo

iwaddo wrote:

I can see how LET adds some clarity but it is not much different to working in a table with a header column


You mean a Header Row at the top of the table, I think.


Note that if you want to see the names in the Formula Editor as in your screenshot then (on the Mac) 'Use header names as labels' turned on at Numbers > Settings must be turned on.


You don't need to worry about that setting with LET or LAMBDA. And LET or LAMBDA allow you to work with names when you don't have things in a nice table format, or want to quickly apply the same logic in some other area of the document.


Traditional formulas work nicely in most situations, as your screenshot shows, but I can see where LET or LAMBDA can make things more portable, easier to debug, and easier to audit.


SG





This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Examples using the Lambda Function in Numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.