MAP Excel function

The MAP function in Excel is a powerful tool designed to transform arrays efficiently. By applying a user-defined LAMBDA function, you can create new values from an existing set of data. This feature enhances data manipulation capabilities, making complex calculations simpler and more intuitive.

Syntax

=MAP(array, lambda)\n
  • array: The input array or arrays that you want to transform.
  • lambda: A LAMBDA function defining how to transform each element of the array.

Example #1

=MAP(A1:A5, LAMBDA(x, x  2))
This function doubles each value in the range A1 to A5. For values {1, 2, 3, 4, 5}, the result would be {2, 4, 6, 8, 10}.

Example #2

=MAP(B1:B4, LAMBDA(x, IF(x > 10, "High", "Low")))
This function checks each value in B1 to B4 and classifies them as “High” or “Low” based on whether they are greater than 10. For values {5, 12, 8, 15}, the result would be {“Low”, “High”, “Low”, “High”}.

Example #3

=MAP(C1:C3, LAMBDA(x, x & "!"))
This function appends an exclamation mark to each value in the range C1 to C3. For values {“Hello”, “World”, “Excel”}, the result would be {“Hello!”, “World!”, “Excel!”}.

Error handling

  • VALUE!: This error occurs if the size of the input arrays is not the same.
  • NAME?: This error arises when the LAMBDA function is not defined correctly or the name used in the function is invalid.
  • NUM!: This error indicates that the LAMBDA function returned a number that is not valid for the operation being performed.

Conclusion

The MAP function enhances Excel’s capabilities by allowing users to apply a LAMBDA function across an array, thus transforming data efficiently and intuitively. Its potential applications are vast, from simple arithmetic to more complex logical operations, proving to be an essential tool for data analysis in Excel.

Leave a Reply

Your email address will not be published. Required fields are marked *