In this article:

Google Sheets LAMBDA Function (Easiest Way to Use It in 2024)

December 5, 2024

Google Sheets LAMBDA

The LAMBDA function in Google Sheets allows users to define their own custom functions directly within the Google Sheets formula bar. This feature enables complex calculations and data manipulations that were previously only possible by writing custom scripts in Google Apps Script or by using complex combinations of built-in functions.

Syntax 

The basic structure of a LAMBDA function is as follows:

LAMBDA(parameter1, parameter2, ..., expression)

Here's a breakdown of each part of the syntax:

  • LAMBDA: This is the function name that signals you are defining a lambda function.

  • parameters: These are the placeholders for the values that you will pass to your lambda function when you call it. You can define zero or more parameters which are separated by commas. Each parameter acts as a variable within the lambda function, representing the input values the function will use when executed.

  • expression: This is the calculation or operation that the lambda function will perform using the parameters provided.It can involve simple calculations, cell references, or combinations of other functions. The expression is what defines the output of your lambda function based on the input parameters.

How to Use the LAMBDA Function in Google Sheets

Follow the process below to use the LAMBDA function in Google Sheets. 

1. Write Your First LAMBDA Function for Simple Math Operations

For example, to add two numbers: type =LAMBDA(a, b, a + b) in a cell, where 'a' and 'b' are the numbers you want to add.

google sheets lambda

2. Execute Your LAMBDA Function with Specific Arguments

To execute your function, add arguments at the end: =LAMBDA(a, b, a + b)(2, 3).

lambda google sheets

This returns the sum of 2 and 3.

lambda function google sheets

3. Expand Your LAMBDA Use for Complex Calculations

For more complex formulas, we’ll calculate the average of three numbers: =LAMBDA(a, b, c, (a + b + c) / 3)(5, 10, 15). This calculates the average of 5, 10, and 15.

google sheets lambda function

4. Incorporate Cell References in LAMBDA Functions

Use cell references instead of direct numbers: =LAMBDA(a, b, a + b)(A1, B1) adds the values in cells A1 and B1.

lambda in google sheets

5. Save and Name Your LAMBDA for Repeated Use

Name your LAMBDA function for reuse. Go to Data > Named ranges...,

Then, define a name and click "Done". Use this name instead of the whole expression.

6. Test Your Named LAMBDA Function in Practice

Call your named function in a cell with its parameters: If your addition function is named "add", type =add(A1, B1) to use it.

7. Troubleshoot and Correct Common LAMBDA Function Errors

Check for typos, incorrect cell references, or syntax errors if there are issues. Make sure parameters are correctly utilized.

We hope that you now have a better understanding of how to use the Google Sheets LAMBDA function. If you enjoyed this article, you might also like our article on how to set up image functions in Google Sheets or our article on how to make labels on Google Sheets.

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->