How to Create a LAMBDA in Excel: Step-by-Step Guide
In this article
A LAMBDA in Excel lets you turn a formula you use over and over into a named, reusable function — no VBA or add-ins required. You write the formula once, give it a friendly name, and then call it like any built-in function (for example, =TAX(A1)). To create one, you need a Microsoft 365 subscription (or Excel for the web) and a formula that works on its own. The basic recipe is: open Name Manager, define a new name, and in the “Refers to” box enter =LAMBDA( followed by your parameters, a comma, the calculation, and a closing parenthesis. Save it, then type your new function name in any cell.
What You'll Need
- Microsoft 365 Excel (desktop or web). LAMBDA is not available in Excel 2019, 2016, or earlier perpetual versions, and it is not in Excel for Mac 2019 or older. If you are on a perpetual license, the function will show a #NAME? error.
- A working formula that already produces the result you want when typed directly into a cell. Test it first with real numbers.
- Optional: the Advanced Formula Environment add-in (from Microsoft AppSource) if you prefer a code-editor style interface. The built-in Name Manager is enough for most people.
Step-by-Step
- Build and test the formula first. In a blank cell, type the calculation exactly as you want it to work, using cell references for the parts that will change. For example, to convert Fahrenheit to Celsius, type
=(A1-32)*5/9in B1 and confirm it gives the right answer. This step matters because a LAMBDA is just that formula wrapped in a definition — if the formula is wrong, the LAMBDA will be wrong too. - Open Name Manager. Go to the Formulas tab on the ribbon and click Name Manager. (On Mac, the same button is on the Formulas tab.) You can also press Ctrl+F3 on Windows; on Mac, use the menu Formulas > Name Manager. Labels can differ slightly by Excel version and region, but the Name Manager button is in the same place in current Microsoft 365 builds.
- Click New. The New Name dialog opens with a Name box and a Refers to box.
- Type a name. Use something short and descriptive with no spaces, such as
TO_CELSIUSorFAHRENHEIT. Names cannot look like cell references (soA1is rejected) and cannot contain spaces or most punctuation. Underscores are fine. - Enter the LAMBDA in the Refers to box. Start with an equals sign, then LAMBDA, then your parameters in parentheses, a comma, the calculation, and a closing parenthesis. For the temperature example:
=LAMBDA(temp,(temp-32)*5/9). Heretempis the parameter name — it is a placeholder that will be replaced by whatever value you pass in. You can use up to 253 parameters, but most real-world functions need one to three. - Click OK, then Close. The name now appears in the Name Manager list. You do not need to save the workbook first, but the name is stored in the workbook, so it travels with the file.
- Call your function. In any cell, type
=TO_CELSIUS(212)and press Enter. It should return 100. You can also reference a cell:=TO_CELSIUS(A2). Excel treats it like any other function, including in formulas, charts, and data validation lists. - Test edge cases. Try a blank cell, a negative number, and text. If your formula does not handle text, you may want to wrap it in IFERROR or add a check. For example,
=LAMBDA(temp,IF(ISNUMBER(temp),(temp-32)*5/9,"n/a"))returns “n/a” instead of an error when someone types words. - Edit or delete later. Open Name Manager, select the name, and click Edit or Delete. Editing is instant; deleting removes the function from the workbook, and any cell using it will show #NAME?.
Common Mistakes
- Forgetting the leading equals sign in the Refers to box. Without it, Excel treats the text as a label, not a formula, and the function will not calculate.
- Using a parameter name that matches a cell reference (like
X1orR1C1). Excel rejects the name or misreads the formula. Pick words likevalue,rate, ortext. - Testing the formula only with one input. A LAMBDA that works for 100 may fail for 0 or for text. Test at least three inputs, including a blank cell.
- Assuming it works in older Excel. If you share the workbook with someone on Excel 2019, they will see #NAME? because their version does not know LAMBDA. There is no backward-compatible workaround other than replacing the function with the original formula.
- Using a name that is already taken. If you name your function
SUM, Excel will not let you overwrite the built-in. Choose a unique name, often with an underscore or prefix. - Putting the LAMBDA in a cell instead of Name Manager. Typing
=LAMBDA(...)directly into a cell returns a #CALC! error in most cases because it has no arguments to evaluate. The definition belongs in Name Manager; the call belongs in a cell.
Tips
- Start with a formula you already trust. Copy it from a working cell into the Refers to box, then replace the cell references with parameter names. This reduces typos.
- Use descriptive parameter names.
LAMBDA(price,tax_rate,price*(1+tax_rate))is easier to debug thanLAMBDA(a,b,a*(1+b)). - Keep the calculation simple. If your LAMBDA needs many steps, consider breaking it into two smaller functions or using LET inside the LAMBDA to name intermediate values. LET is supported inside LAMBDA in current Microsoft 365 builds.
- Document it. Add a comment in a nearby cell or use the Name Manager’s Comment field (available in some versions) to note what the function does and what each parameter expects.
- Test in a copy of the workbook before rolling it out to a shared file, especially if others rely on the sheet.
Troubleshooting
If your new function shows #NAME?, the most common cause is that the name was not saved or was typed differently in the cell than in Name Manager. Open Name Manager and confirm the name exists and is spelled exactly the same, including underscores. Second, check that you are on Microsoft 365 — LAMBDA does not exist in older versions. Third, confirm the Refers to box starts with =LAMBDA( and has balanced parentheses.
If you see #VALUE!, one of your parameters received a type it cannot handle, such as text where a number was expected. Wrap the calculation in IFERROR or add an ISNUMBER check. If you see #CALC! when you type the LAMBDA directly into a cell, that is expected — LAMBDA definitions belong in Name Manager, not in a worksheet cell.
If the function works in one workbook but not another, remember that names are stored per workbook. Copy the name by re-creating it in the second file, or copy a cell that uses it and use Paste Special to bring the name across (in some versions, copying the sheet carries names). If the function is slow on large ranges, check whether it is being called thousands of times; consider using a helper column or a single array formula instead.
Frequently Asked Questions
Does LAMBDA work in Excel for Mac?
Yes, in Microsoft 365 for Mac. It is not available in Excel 2019 for Mac or earlier perpetual versions.
Can I use LAMBDA without Microsoft 365?
No. LAMBDA is a Microsoft 365 feature. In older versions you would need VBA or a named formula without parameters, which is not the same thing.
Can I share a workbook that uses LAMBDA?
Yes, but only people on Microsoft 365 will see it calculate. Others will see #NAME?. If you need universal compatibility, keep a plain-formula version in a separate column.
How many parameters can a LAMBDA have?
Up to 253, though practical functions rarely need more than a handful.
Can I call one LAMBDA from another?
Yes. Once a LAMBDA is named, you can use it inside another LAMBDA’s calculation, as long as both are defined in the same workbook.
What happens if I delete the name?
Any cell using that function will return #NAME? until you recreate the name or replace the formula.