Logical
LAMBDA function: package reusable custom formulas without macros
Define parameterized worksheet formulas with LAMBDA and call them by name across a workbook.
Turn repeated domain formulas into parameterized LAMBDA functions
LAMBDA(param1, param2, ..., calculation) creates an inline parameterized formula that you can test directly with trailing call arguments such as LAMBDA(cost, price, (price - cost) / price)(A2, B2).
Wrap division inside the LAMBDA body with an IF guard so zero or negative selling prices are flagged cleanly.
=LAMBDA(cost, price, (price - cost) / price)(A2, B2)Try the example
Use the original values or change them to test your understanding.