MAPformula 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
LAMBDAparameter. This formula is commonly used for data manipulation and transformation.
- How to use
- Examples of using
MAPformula not working?
- Similar formulas to
MAP formula with the syntax shown below, it has 2 required parameters and 1 optional parameter:
- 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 as
- LAMBDA (required):
A function that defines the operation to be performed on each element of the input arrays. The function can be defined using the
LAMBDAfunction or as a named function.
ExamplesHere are a few example use cases that explain how to use the
MAPformula in Google Sheets.
Square every number in an array
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
MAP to apply a function that converts Celsius temperatures to Fahrenheit and returns a new array with the results.
Filter and map data
MAP in combination with
FILTER to apply a function to a subset of data and return a new array with the results.
MAPnot working? Here are some common mistakes people make when using the
MAPGoogle 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
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.
The following functions are similar to
MAP or are often used with it in a formula:
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.
The 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.
REDUCEformula is used to apply a function to each element of an array, resulting in a single output value. The function specified in
LAMBDAis 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.
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.
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.
You can learn more about the
MAP Google Sheets function on Google Support.