## How to use the LAMBDA function

The LAMBDA function lets you build custom functions using only regular Excel functions, no VBA is needed. These custom functions based on the LAMBDA function are available only in your workbook.

The Name Manager lets you create a unique name for your custom LAMBDA function. What makes the LAMBDA function really powerful is its ability to create recursive formulas.

#### Table of Contents

## 1. LAMBDA Function Syntax

LAMBDA([*parameter1*, *parameter2*, …,] *calculation*)

## 2. LAMBDA Function Arguments

parameter1 |
Optional. A value that you want to use in the custom function, you are allowed to use a cell reference, string, or number. Up to 253 parameters. |

calculation |
Required. A formula to evaluate. Must be the last argument, a result is also required. |

## 3. LAMBDA Function Example

This example demonstrates how to build a custom LAMBDA function, there are three main steps.

- Create a formula.
- Build the LAMBDA function.
- Name the LAMBDA function.

We are going to build a custom LAMBDA function that converts Kelvin to Fahrenheit, it is a simple calculation and works great as a demonstration.

### 3.1 Create a formula

This example shows how to convert Kelvin to Fahrenheit, the calculation is: F = 1.8(K - 273) + 32

Formula in cell C4:

### Explaining formula

#### Step 1 - Subtract Kelvin with 273

The minus operator lets you subtract numbers in an Excel formula.

B4-273

0-273 equals -273

#### Step 2 - Multiply by 1.8

The asterisk character lets you multiply numbers in an Excel formula. The parentheses allow you to control the order of operation.

1.8*(B4-273)

becomes

1.8*-273 equals -491.4

#### Step 3 - Add 32

The plus operator lets you add numbers in an Excel formula.

1.8*(B4-273)+32

becomes

-491.4 + 32 equals -459.4

### 3.2 Build the LAMBDA function

Formula in cell D4:

### Explaining formula

#### Step 1 - Formula

This is the formula we built in section 3.1 There is only one input value in this formula.

1.8*(B4-273)+32

#### Step 2 - LAMBDA function

The LAMBDA function has up to 253 parameters, however, we need only one parameter, in this example named K.

LAMBDA([*parameter1*, *parameter2*, …,] *calculation*)

LAMBDA(K, **1.8*(K-273)+32**)

The bolded part above is the formula we built in section 3.1, cell reference B4 is replaced with parameter K.

#### Step 3 - Pass a value to the LAMBDA function

The LAMBDA function uses parentheses to pass values to the LAMBDA formula.

LAMBDA(K,1.8*(K-273)+32)(B4)

The parameters must be in the same order as you specified them, in this case, it doesn't matter. There is only one parameter.

### 3.3 Name the LAMBDA function

Excel feature "Named ranges" allows us to assign a custom name to the LAMBDA function. I named it KtoF, shown in cell E4 in the image above.

Formula in cell E4:

### How to assign a name to a LAMBDA function

- Go to tab "Formulas" on the ribbon.
- Press with left mouse button on "Name Manager" button. A dialog box appears.

- Press with left mouse button on "New.." button. Another dialog box appears.

- Type a name.
- Paste the LAMBDA function to "Refers to:" field.

- Press with left mouse button on the "OK" button.

- Press with left mouse button on the "Close" button.

The function we created appears if we type the first characters in the function name in a cell.

### 'LAMBDA' function examples

The following 6 articles contain the LAMBDA function.

This article demonstrates two ways to calculate the number of times each word appears in a given range of cells. […]

The MAKEARRAY function returns an array with a specific number of rows and columns calculated by applying a LAMBDA function. […]

This article demonstrates a recursive LAMBDA function and a User Defined Function (UDF) that multiplies numbers in each row with […]

The SUBSTITUTE and REPLACE functions can only handle one string, this article demonstrates two ways to handle more than one […]

The TEXTSPLIT function works only with single cells. If you try to use a cell range the TEXTSPLIT function returns […]

What's on this page Reverse text Insert random characters Convert letters to numbers How to shuffle characters in the alphabet […]

## Functions in this article

### Functions in 'Logical' category

The LAMBDA function function is one of many functions in the 'Logical' category.

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form