How to use MAP function in Excel?

In Excel, the `MAP` function is part of the new dynamic array functions introduced in Excel 365 and Excel 2019 (with the appropriate updates). The `MAP` function allows you to perform a calculation on each element in one or more arrays and return an array of the results. Here’s how to use it:

Syntax

MAP(array1, [array2], ..., lambda)
  • `array1, array2, …`: These are the arrays that you want to map over. You can have one or multiple arrays.
  • `lambda`: A custom LAMBDA function where you define how each element in the arrays will be processed. The LAMBDA function takes as many parameters as there are arrays, plus the calculation or operation.

Steps to Use the MAP Function

  • Prepare Your Data: Ensure your data is organized into appropriate arrays. The arrays can be separately listed in different columns or rows.
  • Enter the MAP Function:
    • Click on the cell where you want the result to appear.
    • Enter `=MAP(` and start referencing your arrays.
    • Define the LAMBDA function. This function will specify how you transform each element of your array(s).
  • Define the LAMBDA: The LAMBDA function is key to transforming the data. For example, `LAMBDA(a, a*2)` will take each element `a` from the array and multiply it by 2.

Example

Suppose you have an array in cells A1:A5 containing numbers from 1 to 5, and you want to multiply each by 2.

   =MAP(A1:A5, LAMBDA (a, a * 2))
  • Select a cell where you want the result to start.
  • Enter the formula:
  • Press Enter, and Excel will spill the results into the adjacent cells.

Points to Remember

  • Dynamic Arrays: Ensure you have a version of Excel that supports dynamic arrays because the results will spill over into adjacent cells automatically.
  • Consistency in Array Length: If working with multiple arrays, ensure they are of the same length to avoid errors.
  • Lambda Function Complexity: The LAMBDA function can include any Excel-compatible operations and can be as simple or complex as necessary.

This approach makes it easier to apply the same operation across multiple sets of data efficiently. Make sure your Excel version is updated to fully utilize this function.

Unlock Your Potential

Excel

Basic - Advanced

Access

Access Basic - Advanced

Power BI

Power BI Basic - Advanced

Help us grow the project