ARRAY_CONSTRAIN: Google Sheets Formulae Explained

Google Sheets is a powerful tool that offers a wide range of functionalities, one of which is the use of formulae. These formulae can perform a variety of tasks, from simple arithmetic to complex data manipulation. One such formula is ARRAY_CONSTRAIN, a function that limits the number of rows and columns in an array or range. This article will delve into the details of this formula, explaining its syntax, usage, and practical applications.

Understanding the ARRAY_CONSTRAIN Function

The ARRAY_CONSTRAIN function in Google Sheets is a versatile tool that can be used to limit the size of an array or range. This function can be particularly useful when dealing with large datasets, as it allows users to focus on a specific subset of data.

Before we delve into the specifics of this function, it is important to understand what an array is. In the context of Google Sheets, an array is a table of values. It can consist of one or more rows and one or more columns. A range, on the other hand, is a group of cells that can be identified by the addresses of the top left and bottom right cells.


The syntax of the ARRAY_CONSTRAIN function is as follows:

ARRAY_CONSTRAIN(array, numRows, numColumns)

This function has three arguments:

  • array - This is the range of cells or array that you want to constrain.
  • numRows - This is the number of rows that you want in the output. If the array has fewer rows than specified, the function will return all the rows.
  • numColumns - This is the number of columns that you want in the output. If the array has fewer columns than specified, the function will return all the columns.

Using the ARRAY_CONSTRAIN Function

Now that we understand the syntax of the ARRAY_CONSTRAIN function, let's look at how to use it in Google Sheets.

Suppose you have a dataset with 10 rows and 5 columns, and you want to limit this to a 3x3 array. You would use the ARRAY_CONSTRAIN function as follows:


This formula will return the first three rows and first three columns of the range A1:E10.

Practical Applications of ARRAY_CONSTRAIN

The ARRAY_CONSTRAIN function can be used in a variety of scenarios. For instance, you might want to use it to limit the number of results returned by another function.

Consider the following example. Suppose you have a dataset of sales data, and you want to find the top 5 salespeople. You could use the SORT function to sort the data in descending order, and then use ARRAY_CONSTRAIN to limit the results to the top 5 rows.

Here's how you would do it:


This formula sorts the range A2:B10 by the second column in descending order, and then limits the results to the top 5 rows and 2 columns.

Common Errors with ARRAY_CONSTRAIN

While the ARRAY_CONSTRAIN function is quite straightforward, there are a few common errors that you might encounter when using it.

Error: #VALUE!

This error occurs when the numRows or numColumns argument is less than 1. Remember, you cannot have an array with zero rows or columns.

Error: #N/A

This error occurs when the array argument is empty. Make sure that the range or array you are trying to constrain contains data.


The ARRAY_CONSTRAIN function is a powerful tool in Google Sheets that allows you to limit the size of an array or range. By understanding its syntax and usage, you can leverage this function to efficiently work with large datasets and perform complex data manipulation tasks.

Remember, the key to mastering Google Sheets formulae is practice. So, don't hesitate to experiment with ARRAY_CONSTRAIN and other functions to see what you can achieve.

Take Your Data Analysis Further with Causal

If you're looking to enhance your data manipulation and visualization beyond what Google Sheets offers, Causal is your go-to platform. Designed specifically for number crunching and data analysis, Causal allows you to perform advanced calculations, create dynamic visualizations, and share interactive dashboards with ease. Ready to streamline your modelling and forecasting? Sign up today and elevate your data game with Causal's intuitive tools.

Move beyond 

Google Sheets

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.