Google Sheets function · Array
CHOOSECOLS in Google Sheets: syntax and examples
CHOOSECOLS builds a new array from selected columns of a range. You list the column numbers, and the result follows that order. Negative numbers count from the right, which is handy for the last column.
Syntax
CHOOSECOLS(array, col_num1, [col_num2])
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
array | range | yes | The range or array to take columns from. |
col_num1 | number | yes | Number of the first column to return. Negative numbers count from the right. |
col_num2, ... | number | no | More column numbers, in the order you want them. |
Examples
The examples use this table, starting in A1:
| Name | Team | Sales | Region |
| Ana | A | 120 | North |
| Bob | B | 80 | South |
| Cris | A | 200 | North |
=CHOOSECOLS(A1:D3, 1, 3)Result:
| Name | Sales |
| Ana | 120 |
| Bob | 80 |
Name and Sales only, skipping the columns between them.
Run in a Google Sheet (English US locale) on .
=CHOOSECOLS(A1:D3, 3, 1)Result:
| Sales | Name |
| 120 | Ana |
| 80 | Bob |
Same two columns in reverse order: the output follows the order of the numbers.
Run in a Google Sheet (English US locale) on .
=CHOOSECOLS(A1:D3, -1)Result:
| Region |
| North |
| South |
A negative number counts from the right: the last column.
Run in a Google Sheet (English US locale) on .
=SUM(CHOOSECOLS(A2:D4, 3))Result: 400
One column feeds an aggregate directly.
Run in a Google Sheet (English US locale) on .
=CHOOSECOLS(A1:D3, 2, 2)Result:
| Team | Team |
| A | A |
| B | B |
A column can be repeated.
Run in a Google Sheet (English US locale) on .
Common errors
- A column number beyond the width of the array returns #VALUE!.
- 0 is not a valid column number and returns #VALUE!. Columns start at 1.
- The numbers are relative to the array you pass, not to the sheet. In B1:D3, column 1 is B.
Compared with Excel
Same syntax in Excel 365, where CHOOSECOLS is also available.