Description
Use this function to extract a specified number of rows or columns from the beginning or end of a range or array.
Syntax
TAKE(array, rows, [columns])
Inputs
This function accepts the following argument:
| Name | Required | Description | Valid Input |
|---|---|---|---|
array |
Yes | The range or array to extract from. | A cell, a cell range, a dynamic array or a formula which results in any of these. |
rows |
Yes | Number of rows to extract. Positive for top rows, negative for bottom rows. | An integer, a reference to a cell containing an integer, or a formula which results in either of these. |
[columns] |
No | Number of columns to extract. Positive for left columns, negative for right columns. | An integer, a reference to a cell containing an integer, or a formula which results in either of these. |
Examples
Sample data
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Name | Age | City | Salary |
| 2 | John | 35 | New York | 75000 |
| 3 | John | 35 | New York | 75000 |
| 4 | Alice | 28 | Chicago | 65000 |
| 5 | Bob | 42 | San Francisco | 85000 |
Sample formulas
| Use case | Formula | Result | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Extract the first two rows from a data set. | =TAKE(A1:D5, 2) |
This formula creates a new data set containing the first two rows from the source data set. For this data set the formula would return the following:
|
||||||||||||
| Extract the last two rows from a data set. | =TAKE(A1:D5, -2) |
This formula creates a new data set containing the last two rows from the source data set. For this data set the formula would return the following:
|
||||||||||||
| Extract the first two rows and the first two columns from a data set. | =TAKE(A1:D5, 2, 2) |
This formula creates a new data set containing the first two rows and the first two columns from the source data set. For this data set the formula would return the following:
|
||||||||||||
| Extract the first two rows and the last two columns from a data set. | =TAKE(A1:D5, 2, -2) |
This formula creates a new data set containing the first two rows and the last two columns from the source data set. For this data set the formula would return the following:
|
||||||||||||
| Extract the first three UNIQUE rows from the dataset. Note: If there are fewer unique rows than the specified number, then all the unique rows are returned. |
=TAKE(UNIQUE(A1:D5), 3) |
This formula creates a new data set containing the first two UNIQUE rows from the source data set. For this data set the formula would return the following:
|
Notes
- As with all array functions, TAKE dynamically populates results across adjacent cells, starting from the cell containing the TAKE function.
- TAKE:
- Extracts rows or columns from start or end of array.
- Supports positive (start) and negative (end) row/column selection.
- Can extract both rows and columns simultaneously.
Tips
- If you have header row(s), start your array values one row down (for example in the data set above, start with A2 rather than A1) if you don't want the headers to be included.
- TAKE can be combined with:
Related functions
Here are the other array formula functions supported in Workiva spreadsheets.