CHOOSECOLS function
CHOOSECOLS pulls specific columns out of an array in any order, including repeats, and returns them as a new array. Negative numbers count from the last column.
Example
Read it as a sentence: from B1:E3 return only the 1st and 3rd columns, the Item and Qty columns.
Syntax
CHOOSECOLS(array, col_num1, [col_num2], ...)
Arguments in [square brackets] are optional.
-
array(required) - Source array or range.
-
col_num1(required) - Column number to return; negative counts from the right.
-
col_num2(optional) - More columns to return, in the order given.
Returns: The chosen columns as a new array.
One CHOOSECOLS formula can fill more than one cell. When the result has several values, they spill into the cells below or to the right of the formula.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=CHOOSECOLS({1,2,3},{3,1}) | 3 | Array of indexes |
=CHOOSECOLS(Items!B1:E3,1,3) | Item | Pick two columns |
=CHOOSECOLS(Items!B1:E3,-1) | Unit Value | Negative from end |
=CHOOSECOLS(Items!B1:E3,1,1) | Item | Repeat column |
=CHOOSECOLS(Items!B1:E3,"2") | Category | Text index |
=CHOOSECOLS(Items!B1:E3,2.7) | Category | Fractional index |
=CHOOSECOLS(Items!B1:E3,5) | #VALUE! | Past last column |
=CHOOSECOLS(Items!B1:E3,0) | #VALUE! | Zero |
The Items sheet these formulas read
Watch out for
- #VALUE! if a column number is 0 or beyond the array.
- Negative numbers count from the last column.
Where it works
- Excel
- CHOOSECOLS arrived in Excel 2024. Older versions do not have it. 365, Excel for the web and Excel 2024; not in older perpetual versions.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Lookup and reference functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .