CHOOSECOLS picks columns out of a table and returns just those. You can pick them in any order, repeat them, and count from the right. It is the quick way to cut a wide table down to the columns a report needs.
The arguments
- array is the block to choose from.
- col_num1, col_num2, … are positions inside that block, counted from 1. In
A2:D7, 1 is column A and 4 is column D. A negative number counts back from the end: -1 is the last column and -2 the one before it.
The result has one column for each number you give, in that order. =CHOOSECOLS(A2:D7,4,1) puts the salary first and the staff ID second. The numbers can come from an array constant, {1,4}, or from a calculation such as SEQUENCE(1,2).
Why not just reference the columns?
You could write =A2:A7 and =D2:D7 side by side, but then every column is its own formula and you can't pass the result into another function. CHOOSECOLS returns one array that you can sort, filter or stack. For example, =SORT(CHOOSECOLS(A2:D7,1,4),2,-1) ranks staff by salary and shows only two columns.
Combining it with FILTER
FILTER returns every column of the rows it keeps. To return only some of those columns, nest CHOOSECOLS around it:
=CHOOSECOLS(FILTER(A2:D7,B2:B7="IT"),1,4)
This returns the ID and salary of the IT staff. Because the test is made on the full table, you can filter on a column that you don't show.
Counting from the right
Negative numbers are useful when the table can gain columns. =CHOOSECOLS(A2:H50,-1) always returns the last column, even if someone inserts another one before it. A fixed number would silently return the wrong column.
Errors
A column number of 0, or a number beyond the width of the array, returns #VALUE!. In a 4-column array, both CHOOSECOLS(array,5) and CHOOSECOLS(array,-5) fail.
Results are values
The result is a spilled array of values, not a live reference to the original cells. It follows the source when the source changes, but you can't format the source cells by formatting the result.
If you need to remove columns instead of choosing them, DROP is shorter. To keep the first few columns, use TAKE. To pick rows instead, use CHOOSEROWS.
CHOOSECOLS needs Microsoft 365, Excel 2024 or later, or Excel for the web. Earlier versions can use INDEX with an array of column numbers.