<< Go back to all functions

MAKEARRAY

The MAKEARRAY function in Google Sheets is a powerful tool to create an array of specified dimensions with values calculated by application of a LAMBDA function. Whether you're generating data for analysis, creating customized formulas, or automating repetitive tasks, the MAKEARRAY function simplifies the process. Explore our comprehensive guide to master its application.

Function Syntax and Parameters

Syntax: MAKEARRAY(rows, columns, LAMBDA)

Parameters:

  • rows: The number of rows in the resulting array.
  • columns: The number of columns in the resulting array.
  • LAMBDA: The lambda function used to calculate values for each element of the array.

Step-by-Step Tutorial

  1. Creating a basic array with constant values:

    • Example: =MAKEARRAY(3, 4, 5)
    • Result:
      [
        [5, 5, 5, 5],
        [5, 5, 5, 5],
        [5, 5, 5, 5]
      ]
      
  2. Creating an array with values calculated by a lambda function:

    • Example: =MAKEARRAY(2, 3, LAMBDA(row, col, row * col))
    • Result:
      [
        [0, 0, 0],
        [0, 1, 2]
      ]
      

Use Cases and Scenarios

  1. Data Generation: Create a matrix of random values for simulation purposes.
  2. Custom Formulas: Use a lambda function to simplify complex calculations.
  3. Automation: Generate arrays based on specific patterns or conditions.

Related Functions

  • ARRAYFORMULA: Apply a formula to an entire array or range.
  • ROW: Returns the row number of a specified cell or range.

Related Articles