In this article:

Google Sheets LAMBDA Function (Easiest Way to Use It in 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.

Automate repetitive tasks with Lido

Save hours on repetitive and tedious work. Lido is a new spreadsheet that connects your spreadsheets, forms, PDFs, and email inbox.

Trigger
Action
Select trigger
When a cell value in Google Sheets changes
Check Google Sheets for today's date
When a new row is added to Google Sheets
On new Google Form submission
Send me a daily reminder
On new Typeform submission
When a cell value in database changes
Check database for today's date
When a new row is added in database
When a new HubSpot customer is created
Select action
ADDCALENDAREVENT
Creates a one- or multiple-day calendar event with optional attendees
ADDHUBSPOT
Adds an object to Hubspot
ADDSLACKCHANNEL
Create a Slack channel, and optionally add a topic or members
CALLURL
Makes any HTTP request
CREATEGOOGLEDOC
Replaces [@column_name] values in a Google Doc with the corresponding table row's values
CREATEPDF
Replaces [@column_name] values in a Google Doc with the corresponding table row's values, then export it as a PDF
FETCH
Makes any HTTP request and returns the response
INSERTROWS
Inserts given array below defined values in given worksheet
SENDGMAIL
Sends an email using your Google account
SENDOUTLOOK
Sends an email using your Microsoft Outlook account
SENDSLACK
Sends a Slack message
SENDSMS
Sends an SMS message using your Twilio account
UPDATECELL
Updates cells with given values
UPDATEHUBSPOT
Updates a property of a Hubspot object
Trigger is required
Action is required
Get started