MAP
TheMAP formula is used to apply a function to every element of one or more arrays and return a new array with the results. The function to be applied is defined by the LAMBDA parameter. This formula is commonly used for data manipulation and transformation.
- How to use
MAPformula? - Examples of using
MAPformula MAPformula not working?- Similar formulas to
MAP
Usage
Use the MAP formula with the syntax shown below, it has 2 required parameters and 1 optional parameter:
=MAP(array1, [array2, ...], LAMBDA)- array1 (required):
The array or range of cells to which the function will be applied. - array2, ... (optional):
Additional arrays or ranges of cells to which the function will be applied. The arrays must have the same length asarray1. - LAMBDA (required):
A function that defines the operation to be performed on each element of the input arrays. The function can be defined using theLAMBDAfunction or as a named function.
Examples
Here are a few example use cases that explain how to use theMAP formula in Google Sheets.
Square every number in an array
Use MAP to apply a function that squares every number in an array and returns a new array with the results.
Convert Celsius temperatures to Fahrenheit
Use MAP to apply a function that converts Celsius temperatures to Fahrenheit and returns a new array with the results.
Filter and map data
Use MAP in combination with FILTER to apply a function to a subset of data and return a new array with the results.
Common Mistakes
MAP not working? Here are some common mistakes people make when using the MAP Google Sheets Formula:
Not providing a function
The most common mistake is forgetting to provide a LAMBDA function as the last argument. This will result in a syntax error.
Mismatched array lengths
If the input arrays have different lengths, the MAP formula will only iterate over elements up to the length of the shortest array. This can result in unexpected behavior or errors.
Incorrect function arguments
If the LAMBDA function takes more arguments than there are input arrays, or if the arguments do not correspond correctly to the input arrays, the formula will return an error.
Related Formulas
The following functions are similar to MAP or are often used with it in a formula:
-
ARRAYFORMULAThe
ARRAYFORMULAformula in Google Sheets allows for the application of a formula to an entire column or range of data, without needing to manually copy the formula to each cell. It is most commonly used to simplify and automate complex calculations across large data sets. -
FILTERThe FILTER formula in Google Sheets is used to filter a range of data based on specified conditions. It returns a new range that only includes the rows that meet the specified conditions. This formula is commonly used to extract specific data from a larger dataset.
-
REDUCEThe
REDUCEformula is used to apply a function to each element of an array, resulting in a single output value. The function specified inLAMBDAis applied to the elements of the array in turn, and the final result is obtained by accumulating these element-wise results. This formula is often used to sum or multiply the elements of an array. -
SORTThe
SORTformula in Google Sheets is used to sort a range of data based on one or more columns. This function can be used to sort data in ascending or descending order, and can also sort by multiple columns. The sorted data can be used for further analysis or presentation. -
TRANSPOSEThe
TRANSPOSEformula in Google Sheets allows you to flip a table of data by turning rows into columns and columns into rows. This can be useful for reorganizing data or preparing it for use in other formulas.
Learn More
You can learn more about the MAP Google Sheets function on Google Support.