CHOOSECOLS

Formulas / CHOOSECOLS
Return specific columns from an array.
==CHOOSECOLS(array, col_num1, [col_num2], ...)
  • array - the array to extract columns from
  • col_num1 - the column number to extract
  • col_num2, ... - [OPTIONAL] additional column numbers to extract

Examples

  • =CHOOSECOLS(A1:C5,1,3)

    For example, the above formula will return the first and third columns of an array.

  • =CHOOSECOLS(A1:C5,3,1)

    The function can also be used to select columns in any order. For example, this will return the third and first columns of an array.

  • =CHOOSECOLS(A1:C5,4)

    This example will return an error because it tries to return the fourth column of an array.

  • =CHOOSECOLS(B3:F9,{1,3,5})

    The function can also accept an array constant to select multiple columns at once. This example, will return the first, third, and fifth columns of an array with the array constant {1,3,5}.


Summary

The CHOOSECOLS function is used to create a new array containing only the specified columns from an existing array.

  • The CHOOSECOLS function allows you to select specific columns from an array and return those columns as an array which expands onto the worksheet.
  • The column numbers for the columns to be returned need to be specified, and these numbers refer to the indexes of the columns in the array.
  • The two arguments required for using the CHOOSECOLS function are the array that columns are to be extracted from, and the column number to return.
  • If the column number is out of range, the CHOOSECOLS function throws a #VALUE! error.

Frequently Asked Questions

What is the CHOOSECOLS function?
The CHOOSECOLS function is used to return specified columns from an array.
What is the syntax of the CHOOSECOLS function?
The syntax of the CHOOSECOLS function is =CHOOSECOLS(array,column_name1,[column_name2],…).
What is the array argument?
The array argument is the array to return the columns from. This argument is required.
What is the col_num1 argument?
The col_num1 argument is the first column to return. This argument is required.
What is the col_num2 argument?
The col_num2 argument is additional columns to return. This argument is optional.
What type of data does the CHOOSECOLS function return?
The CHOOSECOLS function returns the specified columns from an array as a new array.
Sourcetable Logo

Work smarter

Al is here to help. Leverage the latest models to
analyze spreadsheets, enrich data, and create reports.

Drop CSV