Ravindra BagaleCourses & study guides

9. Dynamic Arrays

9.7 LAMBDA (Brief)

In short: LAMBDA (Microsoft 365 / Excel 2024) lets you create your own function without VBA.

LAMBDA (Microsoft 365 / Excel 2024) lets you create your own function without VBA.

Steps in Excel – a reusable delivery-fee function

  1. Test the logic in a cell first: =LAMBDA(amt, IF(amt>=499,0,IF(amt>=199,15,IF(amt>=99,25,30))))(270) → 15.
  2. Formulas › Defined Names › Name Manager › New… › Name DELIVERYFEE › Refers to:

    =LAMBDA(amt, IF(amt>=499,0,IF(amt>=199,15,IF(amt>=99,25,30))))

  3. Use it like a built-in function: =DELIVERYFEE(G2); with a spill: =DELIVERYFEE(tblMini[Amount]).

Helper functions MAP, REDUCE, SCAN, BYROW and BYCOL use LAMBDA inside, e.g. running total =SCAN(0, tblMini[Amount], LAMBDA(acc,x, acc+x)). (Compare with the VBA user-defined function in Module 12.13.)

Ravindra Bagale's Tip

LAMBDA thet Name Manager madhe lihila aani chuk asli tar shodhayla avghad jaata – khup students ithe atakatat. Aadhi cell madhe =LAMBDA(...)(test value) asa test kara, barobar aala tarach Name Manager madhe save kara. Ani file dusrya junya Excel var ughadli tar he function chalnar nahi, he lakshat theva.

Practice task

Create a LAMBDA named LATEFLAG that returns "Late" when minutes > 15 else "On time", and use it on the whole Mins column with one formula.