Going Stellar

Home/Google Sheets reference

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

ArgumentTypeRequiredWhat it does
arrayrangeyesThe range or array to take columns from.
col_num1numberyesNumber of the first column to return. Negative numbers count from the right.
col_num2, ...numbernoMore column numbers, in the order you want them.

Examples

The examples use this table, starting in A1:

NameTeamSalesRegion
AnaA120North
BobB80South
CrisA200North
=CHOOSECOLS(A1:D3, 1, 3)

Result:

NameSales
Ana120
Bob80

Name and Sales only, skipping the columns between them.

Run in a Google Sheet (English US locale) on .

=CHOOSECOLS(A1:D3, 3, 1)

Result:

SalesName
120Ana
80Bob

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:

TeamTeam
AA
BB

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.

Sources

  1. CHOOSECOLS (Docs Editors Help)

Markdown version · All functions