MAP

Formulas / MAP
Apply a custom function to an array.
MAP(array1, [array2], lambda)
  • array1 - required, an array to be mapped
  • lambda_or_array<#> - required, an LAMBDA which must be the last argument in the function call, or another array to be mapped

Examples

  • =MAP({1,2,3},LAMBDA(a,a+1))

    The MAP function can be used to apply a formula to every value in an array. For example, this formula adds one to each value of the array {1,2,3}, and returns {2,3,4}. This is a useful way to apply a formula to a range of values quickly and easily.

  • =MAP(A1:A5,LAMBDA(a,a*2))

    The MAP function can also be used to apply a formula to a range of cells. For example, this formula multiplies each value in the range A1:A5 by two, and returns the resulting array. This can be a useful way to transform a range of values quickly and easily.

  • =MAP({1,2,3},{4,5,6},LAMBDA(a,b,a+b))

    The MAP function can also be used to combine two arrays. For example, this formula adds each value in the first array to the corresponding value in the second array, and returns {5,7,9}. This can be a useful way to combine two arrays quickly and easily.

  • =MAP({1,2,3},{4,5,6},{7,8,9},LAMBDA(a,b,c,a+b+c))

    The MAP function can also be used to perform calculations on multiple arrays, like the example above.

Summary

The MAP function provides an easy way to visualize data. It can be used to show values or categories through variations of colors or by different colors. This makes it a useful tool to quickly analyze data.

  • The MAP function maps a custom LAMBDA function to each value in an array and returns an array of values. The LAMBDA function is applied to each value in the array and the result is an array of the same dimensions as the original array.
  • The MAP function is useful when processing each item in an array one by one and for complex formula logic that should be managed in a single location. It is also possible to reuse the same code elsewhere by using a named LAMBDA function with MAP.
  • The MAP function requires two required arguments: array1 and lambda. The array1 argument is the array to be mapped and the lambda argument is the custom lambda function.


Frequently Asked Questions

What is the MAP function?
The MAP function is a function that applies a lambda to each value in an array to create a new value.
What are the arguments for the MAP function?
The MAP function takes two arguments:
  • array1 - required argument
  • lambda_or_array<#> - required argument, this is the lambda to apply to each array passed
What does the MAP function do?
The MAP function applies a lambda to each value in an array to create a new value.
Sourcetable Logo

Work smarter

Al is here to help. Leverage the latest models to
analyze spreadsheets, enrich data, and create reports.

Drop CSV