Applies To
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web

Returns the specified columns from an array.  

Syntax

=CHOOSECOLS(array,col_num1,[col_num2],…)

The CHOOSECOLS function syntax has the following arguments:

  • array       The array containing the columns to be returned in the new array. Required.

  • col_num1       The first column to be returned. Required.

  • col_num2      Additional columns to be returned. Optional.

Errors

Excel returns a #VALUE error if the absolute value of any of the col_num arguments is zero or exceeds the number of columns in the array. 

Examples

Copy the example data in the following table and paste it in cell A1 of a new Excel worksheet. If you need to, you can adjust the column widths to see all the data.

Returns an array of columns 1, 3, 5, and 1 again from the array in the range A2:E7.

Data

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

Formulas

=CHOOSECOLS(A2:E7,1,3,5,1)

Returns an array of the last two columns from the array in the range A2:D7 in the order of column three and then column four.

Data

1

2

13

14

3

4

15

16

5

6

17

18

7

8

19

20

9

10

21

22

11

12

23

24

Formulas

=CHOOSECOLS(A2:D7,3,4)

Returns an array of the last two columns from the array in the range A2:D7 in the order of column four and then column three.

Data

1

2

13

14

3

4

15

16

5

6

17

18

7

8

19

20

9

10

21

22

11

12

23

24

Formulas

=CHOOSECOLS(A2:D7,-1,-2)

See Also

Guidelines and examples of array formulas

VSTACK function

HSTACK function

CHOOSEROWS function