What is the limit on array size in a google sheets formula?

Viewed 574

I number myself among several people in the Mmultiverse (c) who use two-dimensional arrays in google sheets, typically to produce a rolling total for a set of data - this is a good example.

It looks as though you can have very large arrays in google scripts according to this, but I can't find documentation for their size in a sheet formula: what is the limit (if any), and what impact would this have on the use of Mmult formulas as above?

2 Answers

10,000,000 (10^7).

The array used in an mmult formula is typically a square array. The impact of the 10 million cell limit on a square 2D array is that you can have sqrt(10^7) rows and the same number of columns. In other words, you can process 3162 rows of data using an mmult technique that produces a square 2D array, but not 3163.

With

=sum(sequence(3162,3162))

enter image description here

With

=sum(sequence(3163,3163))

enter image description here

As noted by @player0, many other combinations of height and width are possible in rectangular arrays from 10m rows X 1 column up to 1 row X 10m columns as long as the total number of cells does not exceed 10m.

Sheet formulas are only limited by the sheet size itself, which according to the existing Google Drive documentation, is 5 million cells.

Spreadsheets

​1. Up to 5 million cells or 18,278 columns (column ZZZ) for spreadsheets that are created in or converted to Google Sheets.

  1. Up to 5 million cells or 18,278 columns for spreadsheets imported from Microsoft Excel. The limits are the same for Excel and CSV imports.

  2. If any one cell has more than 50,000 characters, that single cell will not be uploaded.

Formulas calculating on this size such as ARRAYFORMULA() would run very slowly, but they will still return values.

Related