# Google Sheets MAP Function (How to Use It in 2024)

May 8, 2024

The MAP function in Google Sheets allows you to apply a specified operation to each element of a range or an array, essentially mapping one set of values to another through the operation you define.

The basic syntax of the MAP function is as follows:

=MAP(array1, [array2, ...], lambda)

Where:

array1, [array2, ...]: These are the ranges or arrays over which you want to perform the operation. You can specify multiple arrays, and the MAP function will perform the operation element-wise across these arrays.

lambda: This is a LAMBDA function that defines the operation to be performed on each element(s) of the specified array(s). The lambda function takes as many arguments as there are arrays specified and applies a calculation or transformation to these elements.

## How to Use the MAP Function in Google Sheets

Below we have outlined the steps you can follow to use the MAP function in Google Sheets effectively:

Suppose you have a list of sales figures for different products in column A, and you want to apply a 10% discount to all products that have sales over \$100. The original sales figures are in A2:A10, and you want the discounted prices (where applicable) to appear in B2:B10.

Here's an example:

### Step 2: Type Your Formula

Click on cell B2 where you want to start displaying the discounted prices. Enter the following formula:

=MAP(A2:A10, LAMBDA(x, IF(x > 100, x*0.9, x)))

The breakdown of the formula is as follows:

LAMBDA(x, ...): This introduces the lambda function where x represents each value in your specified range (A2:A10).

IF(x > 100, x*0.9, x): This is the condition you're applying. It checks if the value (x) is greater than \$100. If it is, it multiplies the value by 0.9 (applying a 10% discount). If not, it leaves the value unchanged (x).

### Step 3: Press Enter

After typing the formula, press Enter. The results should immediately appear in B2:B10, with each applicable sales figure discounted by 10%, and figures \$100 or below remaining unchanged.

If the formula doesn't work as expected, double-check each part of the lambda function for syntax errors or logical mistakes.

We hope that this article has helped you and given you a better understanding of how to use the MAP function in Google Sheets.

Get Google Sheets productivity and automation tips delivered straight to your inbox