<< Go back to all functions

ARRAY_CONSTRAIN

The ARRAY_CONSTRAIN function in Google Sheets allows you to constrain the size of an array result. It is used to limit the rows and columns that are displayed in the final array. This function is particularly useful when you only need to work with a specific subset of data.

Function Syntax and Parameters

Syntax: ARRAY_CONSTRAIN(input_range, num_rows, num_cols)

Parameters:

  • input_range: The range of cells or array to constrain.
  • num_rows: The number of rows to include in the constrained array.
  • num_cols: The number of columns to include in the constrained array.

Step-by-Step Tutorial

  1. Constraining an array with specific rows and columns:

    • Example: =ARRAY_CONSTRAIN(A1:E5, 3, 2)
    • Result: This formula will create a new array with the top-left 3x2 portion of the A1:E5 range.
  2. Constraining an array to a single row or column:

    • Example: =ARRAY_CONSTRAIN(A1:E5, 1, 5)
    • Result: This formula will create a new array with the first row of the A1:E5 range.

Use Cases and Scenarios

  1. Data Analysis: Extract specific subsets of data from a larger dataset.
  2. Charting: Limit the data range for creating charts or graphs.
  3. Conditional Formatting: Apply formatting rules to a reduced set of data.

Related Functions

  • ARRAYFORMULA: Apply a formula to an entire array or range of cells.
  • FILTER: Extract rows from a range or array that meet specified criteria.
  • SORT: Sorts the rows of a specified array or range.

Related Articles