TAKE Function¶
The TAKE function in Excel is used to extract a specified number of rows or columns from the beginning or end of an array or range. This function is useful for retrieving the first or last records from a dataset, creating subsets of data, or working with dynamic arrays.
Key Features of TAKE:¶
- Extracts rows from the beginning or end of an array.
- Extracts columns from the left or right of an array.
- Can extract both rows and columns simultaneously.
- Positive values extract from the start; negative values extract from the end.
- Works seamlessly with other dynamic array functions.
Syntax:¶
- array: The array or range from which to extract rows and/or columns.
- rows: The number of rows to extract. Positive values take from the top; negative values take from the bottom. Use 0 or omit to include all rows.
- columns (optional): The number of columns to extract. Positive values take from the left; negative values take from the right. If omitted, all columns are returned.
How TAKE Works:¶
- If
rowsis positive,TAKEreturns rows from the beginning of the array. - If
rowsis negative,TAKEreturns rows from the end of the array. - If
columnsis positive,TAKEreturns columns from the left side of the array. - If
columnsis negative,TAKEreturns columns from the right side of the array. - If a value exceeds the array dimensions, all available rows/columns are returned.
Examples:¶
1. Extract First 3 Rows:¶
Given a range A1:C10 with data:
Result:
2. Extract Last 2 Rows:¶
Result:
3. Extract First 5 Rows and First 2 Columns:¶
Result:
4. Extract Last 3 Rows and Last Column:¶
Result:
5. Extract All Rows but Only First 2 Columns:¶
Result:
6. Combine with SORT to Get Top N Values:¶
Result:
7. Extract from an Array Constant:¶
Result:
(Returns the first 2 rows and first 2 columns of the array)
Notes:¶
TAKEis available in Excel 365 and Excel 2021 or later versions.- If the absolute value of
rowsorcolumnsexceeds the array dimensions, Excel returns all available rows/columns without error. - Using 0 for
rowsorcolumns(or omitting them) includes all rows or columns respectively. TAKEreturns a#CALC!error if the array is empty.- This function pairs well with
DROP, which removes rows/columns instead of keeping them.
Applications:¶
- Top/Bottom N Analysis: Extract the first or last N records from a sorted dataset.
- Data Pagination: Display specific portions of large datasets.
- Report Summaries: Extract header rows or the most recent entries.
- Dynamic Dashboards: Create live subsets that update automatically.
- Preview Data: Show a quick glimpse of large datasets.
Related Functions:¶
- DROP: Removes a specified number of rows or columns from an array (opposite of TAKE).
- FILTER: Returns rows that meet specified criteria.
- SORT: Sorts an array by specified columns.
- INDEX: Returns a value or reference from a specific position in an array.
- CHOOSECOLS: Returns specified columns from an array.
- CHOOSEROWS: Returns specified rows from an array.
Tip: Combine
TAKEwithSORTto easily extract the top or bottom N items from a dataset based on any column. For example,=TAKE(SORT(data, 3, -1), 10)returns the top 10 items sorted by column 3 in descending order.