How can I create an array in Excel?

How can I create an array in Excel?

To create an array in Excel, you can use the “Array” function, which allows you to input multiple values into a single cell or range of cells. This function can be accessed by typing “=Array(” into the desired cell and then inputting the desired values separated by commas. You can also use the “Array” function in combination with other Excel functions, such as “SUM” or “AVERAGE”, to perform calculations on the array values. Additionally, you can create an array by selecting a range of cells and entering the values directly, then pressing “CTRL + SHIFT + ENTER” to confirm the array formula. This will display the array values in individual cells within the selected range. Arrays in Excel are useful for organizing and manipulating large amounts of data efficiently.

Returns a calculated array of a specified row and column size, by applying a LAMBDA.

Syntax

=MAKEARRAY(rows, cols, lambda(row, col))

The MAKEARRAY function syntax has the following arguments and parameters:

  • rows      The number of rows in the array. Must be greater than zero.

  • cols      The number of columns in the array. Must be greater than zero.

  • lambda       A LAMBDA that is called to create the array. The LAMBDA takes two parameters: 

    • row      The row index of the array.

    • col      The column index of the array.

Errors

Providing an invalid LAMBDA function or an incorrect number of parameters returns a #VALUE! error called “Incorrect Parameters”.

Setting a row or col argument to a value < 1 or to a non-number returns a #VALUE! error.

Examples

Example 1: Create a 2D array representing a simple multiplication table

Copy the following formula into cell C2:

=MAKEARRAY(3, 3, LAMBDA(r,c, r*c))

First MAKEARRAY function example

Example 2: Create a random list of values

Enter the sample data into cells D1:E3, and then copy the formula into cell D4:

=MAKEARRAY(D2,E2,LAMBDA(row,col,CHOOSE(RANDBETWEEN(1,3),”Red”,”Blue”,”Green”)))

Second MAKEARRAY Function example

Cite this article

stats writer (2024). How can I create an array in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-create-an-array-in-excel/

stats writer. "How can I create an array in Excel?." PSYCHOLOGICAL SCALES, 30 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-create-an-array-in-excel/.

stats writer. "How can I create an array in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-create-an-array-in-excel/.

stats writer (2024) 'How can I create an array in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-create-an-array-in-excel/.

[1] stats writer, "How can I create an array in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I create an array in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top